Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Raver2222
Beginner


Joined: 18 Oct 2002
Posts: 18
Location: Poland

PostPosted: Mon Dec 02, 2002 1:01 pm   

herbal colecting bot
 
Is there somebody eho can help me in writing a bot which would collect herbs

I mean:(if i`m wrong help me becauose i`m not in programming)
1)bot is going on a special path which looks like that @var{sw|w|w|nw|w|n|ne|w}
2)in every room bot gives `command` and waits for 'text1` or `text2` or `text3`
if `text1` again `command`
if `text2` or `text3` go to the next room
if `text1` made two times and go to the next room
3)after 10 rooms do `alias`
finish when any command (e.g. herbbotoff) written or end of path in @var

that`s all
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Dec 02, 2002 7:14 pm   
 
#VAR herbpath {sw|w|w|nw|w|n|ne|w}
#AL herbs {#T+ herbs;#VAR step 1;#VAR command 0}
#CLASS herbs disable
#AL move {#IF (@step > 10) {alias} {#IF (@step > %numitems(@herbpath)) {#T- herbs} {%item(@herbpath, @step);#ADD step 1;command}}}
#TR {text1} {#IF (@command > 0) {#VAR command 0;move} {#VAR command 1;command}
#TR {text2} {move}
#TR {text3} {move}
#CLASS 0
#AL herbbotoff {#T- herbs}

LightBulb
Senior Member
Reply with quote
Raver2222
Beginner


Joined: 18 Oct 2002
Posts: 18
Location: Poland

PostPosted: Mon Dec 02, 2002 9:35 pm   
 
LightBulb you rulezzz
can you write where i must write these vars trigs and aliases?
and could you give there any starting command e.g. herbboton
e
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Dec 03, 2002 2:10 am   
 
Put the commands in the command line. If you want the starting command to be herbboton, just change the name of the alias.

LightBulb
Senior Member
Reply with quote
Raver2222
Beginner


Joined: 18 Oct 2002
Posts: 18
Location: Poland

PostPosted: Tue Dec 03, 2002 9:16 am   
 
hey LightBulb there is a syntax error in this line
#TR {text1} {#IF (@command > 0) {#VAR command 0;move} {#VAR command 1;command}
can you fix it?

e
Reply with quote
cingulli
Wanderer


Joined: 30 Aug 2001
Posts: 53
Location: Finland

PostPosted: Tue Dec 03, 2002 11:30 am   
 
#TR {text1} {#IF (@command > 0) {#VAR command 0;move} {#VAR command 1;command}}
Reply with quote
Raver2222
Beginner


Joined: 18 Oct 2002
Posts: 18
Location: Poland

PostPosted: Wed Dec 04, 2002 10:30 pm   
 
hi again
my bot looks like that

#VAR herbpath {se|e|e|e|n|n|ne|e}
#AL herbs {#T+ herbs;#VAR step 1;#VAR sz 0}
#CLASS herbs disable
#AL move {#IF (@step > 10) {3}{#IF (@step > %numitems(@herbpath)) {#T- herbs} {%item(@herbpath, @step);#ADD step 1;sz}}}
#TR {Znajdujesz *} {#IF (@sz > 0) {#VAR sz 0;move} {#VAR sz 1;sz}}
#TR {Szukasz wszedzie, ale nie znajdujesz zadnych ziol.} {move}
#TR {Nie znajdujesz zadnych ziol.} {move}
#CLASS 0
#AL herbbotoff {#T- herbs}


and it isn`t working

when i put command `sz` it`s starts searching, next mud shows `text2` and searches again which is incorect
then it doesn`t want to go to the next location
i don`t know why
there`s log :

(i write command herbs which starts bot`herbs`)
> sz(i write command for searching)
Zaczynasz szukac ziol.(this text always show after searching command)
> Szukasz wszedzie, ale nie znajdujesz zadnych ziol.(there is text2)
sz(this command has done bot-i don`t know why, there should be command for next location `sw`)
Zaczynasz szukac ziol.
> Szukasz wszedzie, ale nie znajdujesz zadnych ziol.(and then it stops)
HELP
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Dec 05, 2002 5:00 am   
 
I see two mistakes. The first one:
#AL move {#IF (@step > 10) {3}{#IF (@step > %numitems(@herbpath)) {#T- herbs} {%item(@herbpath, @step);#ADD step 1;sz}}}
It needs a space in between, like this:
#AL move {#IF (@step > 10) {3} {#IF (@step > %numitems(@herbpath)) {#T- herbs} {%item(@herbpath, @step);#ADD step 1;sz}}}

And the other mistake is that I didn't put the first move command in the herbs alias.
#AL herbs {#T+ herbs;#VAR step 1;#VAR command 0;move}

I suspect the first mistake might be causing the problem you describe.


LightBulb
Senior Member
Reply with quote
Raver2222
Beginner


Joined: 18 Oct 2002
Posts: 18
Location: Poland

PostPosted: Thu Dec 05, 2002 1:44 pm   
 
hi again
there is mistake, i was checking it in offline first and it doesn`t work correct
i put there log:
(`herbs` - bot starts)
s
sz (`command`)
Znajdujesz (`text1`)
sz (`command` again - it`s ok)
Znajdujesz (`text1` ok)
se
sz
Nie znajdujesz zadnych ziol.(`text3` and there problem starts)
sz(`command` is incorrect)
e(ok)
sz(ok)
Nie znajdujesz zadnych ziol.(i put there `command` again)
ne(it looks ok)
sz(ok)
n(i don`t know why it is here)
sz(?)
Szukasz wszedzie, ale nie znajdujesz zadnych ziol.(`text2` wchich i put)
sz(?)
nw(ok)
sz(ok)
w(?)
sz(?)

I don`t know what`s going on
Please help!


e
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Dec 05, 2002 5:15 pm   
 
It looks like you have another set of triggers somewhere.

LightBulb
Senior Member
Reply with quote
Raver2222
Beginner


Joined: 18 Oct 2002
Posts: 18
Location: Poland

PostPosted: Thu Dec 05, 2002 6:14 pm   
 
hey LightBulb i think i`ve got everything ok if you don`t believe just check it in your zmud offline. I have delete evry trigger and alias and it doesn`t working.Could you repair it?

e
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Dec 06, 2002 2:17 am   
 
I'll test it out later.

If anyone sees what either Raver or I is doing wrong, please speak up. You could save both of us a lot of time and hair pulling.

LightBulb
Senior Member
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Dec 06, 2002 5:46 am   
 
This is why I try to avoid working on scripts in languages I don't know. Since I don't recognize the words being used, I don't pay much attention to them. Here's the problem:

#TR {Znajdujesz *} {#IF (@sz > 0) {#VAR sz 0;move} {#VAR sz 1;sz}}
#TR {Szukasz wszedzie, ale nie znajdujesz zadnych ziol.} {move}
#TR {Nie znajdujesz zadnych ziol.} {move}

As you can see, the first trigger matches all three phrases. This can be prevented either by making the first trigger case sensitive, or by setting an anchor if it starts at the beginning of the line. You can even do both if you want.
#TR {Znajdujesz *} {#IF (@sz > 0) {#VAR sz 0;move} {#VAR sz 1;sz}} {herbs} {case}
or
#TR {^Znajdujesz *} {#IF (@sz > 0) {#VAR sz 0;move} {#VAR sz 1;sz}} {herbs}
or
#TR {^Znajdujesz *} {#IF (@sz > 0) {#VAR sz 0;move} {#VAR sz 1;sz}} {herbs} {case}

Pick one.

You can also combine the other two triggers, like this.
#TR {nie znajdujesz zadnych ziol.} {move}


LightBulb
Senior Member
Reply with quote
Raver2222
Beginner


Joined: 18 Oct 2002
Posts: 18
Location: Poland

PostPosted: Fri Dec 06, 2002 9:13 am   
 
you`re the man LightBulb
How it`s possible that mistake was so simple?
Thanx again.You`re the best one.

e
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net