Log in

View Full Version : My Suggestion



grave18
08-24-2014, 01:25 PM
Hi.
I prefer add features to the shooter to use a scum bag if stuck on Spectrum Scum.
Thanks.

maroxy
08-24-2014, 08:36 PM
grave18

Why features if you can script? D:

Module.New("Scumbagnestor", function(module)
if Walker.IsStuck() then
if (Creature("Spectral Scum"):isOnScreen()) then
setBotEnabled(false)
if not(Creature("Spectral Scum"):isFollowed()) then
Creature("Spectral Scum"):Follow()
end
if (Self.ItemCount(12237) > 0) then
Self.UseItemWithFollow(12237)
wait(900,1200)
end
setBotEnabled(true)
end
end
module:Delay(1000)
end)

grave18
08-24-2014, 08:43 PM
Hah thanks man ;D

Spectrus
08-24-2014, 09:44 PM
Problem with line 2.

maroxy
08-24-2014, 10:18 PM
Problem with line 2.

What problem? D:

grave18
08-24-2014, 11:09 PM
My character got stuck and did not work; /
My character is often used scumbag even if they did not stop.
Could you do that all the spectrum scum removed ?
Thx.

Furpan
08-24-2014, 11:59 PM
What problem? D:

if Walker.IsStuck then
>
if Walker.IsStuck() then

PROPER TABZ PLX;
Module.New("Scumbagnestor", function(module)
if Walker.IsStuck() then
if (Creature("Spectral Scum"):isOnScreen()) then
setBotEnabled(false)
if not (Creature("Spectral Scum"):isFollowed()) then
Creature("Spectral Scum"):Follow()
end
if (Self.ItemCount(12237) > 0) then
Self.UseItemWithFollow(12237)
wait(900,1200)
end
setBotEnabled(true)
end
end
module:Delay(1000)
end)

Spectrus
08-25-2014, 01:01 AM
if Walker.IsStuck then
>
if Walker.IsStuck() then


this one

maroxy
08-25-2014, 09:01 AM
if Walker.IsStuck then
>
if Walker.IsStuck() then

PROPER TABZ PLX;
Module.New("Scumbagnestor", function(module)
if Walker.IsStuck() then
if (Creature("Spectral Scum"):isOnScreen()) then
setBotEnabled(false)
if not (Creature("Spectral Scum"):isFollowed()) then
Creature("Spectral Scum"):Follow()
end
if (Self.ItemCount(12237) > 0) then
Self.UseItemWithFollow(12237)
wait(900,1200)
end
setBotEnabled(true)
end
end
module:Delay(1000)
end)


this one

Okey, Thanks :p

grave18
08-25-2014, 09:34 AM
Unfortunately, I did not work properly ;(
Maroxy can you do to use a scum bag for all spectrum scum ?? It may work ;/
Thanks

Tibiaperito
08-25-2014, 10:48 AM
Hey,

I'm willing to use similar code for following a specified creature whenever it is on screen, but the thing is that I want to run this module while walker is enabled.
I got my waypoints and loads of conditions written and I simply want to use item on specified creature whenever my bot can see it on my level (no multifloor).
Since I'm a newbie couple of questions:

1. module:Delay(1000) -> this pauses the module and restarts it every second, but it won't make my bot stop following the creature xxx if it's on the screen, right? Can I make it like module:Delay(1000,2500) ?
2. could this be written like this instead of creating a module:

registerEventListener(TIMER_TICK, "xxx")

If yes would it be any better/worse?

3. the most IMPORTANT - could you recommend me a solid tutorial for a complete beginner, something like Spectrus tried to do:
http://forums.xenobot.net/showthread.php?4603-Lua-Tutorial-by-Spectrus

xenobot wiki is really good, but it really lacks many functions and still total basics aren't explained there. Lua official documentation is not as clear as it should be for a total beginner either.

--

Changing some of this code to fit my needs - would it be ok?


Module.New("Scumbagnestor", function(module)
if setBotEnabled(true) then
if (Creature("xxx"):isOnScreen()) then
setBotEnabled(false)
if not (Creature("xxx"):isFollowed()) then
Creature("xxx"):Follow()
end
if (Self.ItemCount(ItemId) > 0) then
Self.UseItemWithFollow(ItemID)
wait(900,1200)
end
setBotEnabled(true)
end
end
module:Delay(1000)
end

Would appreciate replies :)

maroxy
08-25-2014, 12:33 PM
Module.New("Scumbagnestor", function(module)
if Walker.IsEnable() then
if (Creature("xxx"):isOnScreen()) then
setBotEnabled(false)
if not (Creature("xxx"):isFollowed()) then
Creature("xxx"):Follow()
end
if (Self.ItemCount(ItemId) > 0) then
Self.UseItemWithFollow(ItemID)
wait(900,1200) end
setBotEnabled(true)
end
end
module:Delay(1000)
end

1.- The module:Delay(1000) just dont let the Module works for 1000 miliseconds.

2.- Better just use Modules.

3.- Goto C:/Programs/Xenobot/Data and tgere is some files like xb.10.8.17.lu and there are all the Xenobot functions there, with explanations

Tibiaperito
08-25-2014, 01:49 PM
Thanks,

I've seen those function lists and comments to them are nowhere near beginners level :) I simply want to learn total basics, same as Spectrus shown - e.g. what's a variable, what's table etc.

Anyway script doesn't work -



XenoScript Error:
Line #: 20
Error: ')' expected (to close '(' at line 5) near '<eof>'


and when I add ")" -- Module.New("Scumbagnestor", function(module))
then I get other error



Line #: 5
Error: unexpected symbol near ')'

Tibiaperito
08-26-2014, 12:00 PM
Bump, still waiting for some suggestions, please

grave18
08-27-2014, 03:17 PM
Module.New("Scumbagnestor", function(module)
if (Self.ItemCount(xxx) > 0) then
if (Creature("xxx"):isOnScreen()) then
setBotEnabled(false)
if not (Creature("xxx"):isFollowed()) then
Creature("xxx"):Follow()
end
if (Self.ItemCount(ItemId) > 0) then
Self.UseItemWithFollow(ItemID)
wait(900,1200) end
setBotEnabled(true)
end
end
module:Delay(1000)
end

Tibiaperito
08-28-2014, 07:03 PM
I'll check it later if it works, thank you very much.

Nobody mentioned if I may use a delay of a module more randomly let's say module:Delay(1000,2000). Is it possible and is it safer?