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
Delathriel
Beginner


Joined: 01 Aug 2017
Posts: 16

PostPosted: Wed Aug 02, 2017 9:44 pm   

Herbal bot seeker
 
Hi.

I've managed to compile a small bot script to pick up herbs after browsing the forums. It works perfectly fine except that if I understand the below logic I will only look for another herb if I actually find one. After finding it I'll move on to the next room.
The problem I have with this is that sometimes there're 3 herbs in a room and I'd like to keep looking "Znadujesz" for those herbs until I can't find them anymore "niczego interesujacego".

#ALIAS move {
#IF (@step > 1000) {1000} {
#IF (@step > %numitems( @herbpath)) {#T- herbs} {
%item( @herbpath, @step)
#ADD step 1
sz
}
}
}
#TRIGGER {Znajdujesz *} {
#IF (@sz > 0) {
#VAR sz 0
move
} {
#VAR sz 1
wloz ziola do sloika
sz
}
}
#TRIGGER {niczego interesujacego.} {move}
#CLASS 0

Is it possible to somehow slightly modify the above script to meet my requirements or would it need to be totally changed?

Many thanks for your help in advance.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Wed Aug 02, 2017 11:55 pm   
 
In order for this to work, you need a trigger for the success message and for the fail message.

I can only assume that would be this one here, as i only speak one language myself:

Code:
#TRIGGER {Znajdujesz *} {
  #IF (@sz > 0) {
    #VAR sz 0
    move
  } {
    #VAR sz 1
    wloz ziola do sloika
    sz
  }
}


Which i would change to:

Code:
#TRIGGER {Znajdujesz *} {
  #IF (@sz >= 3) {
    #VAR sz 0
    move
  } {
    #VAR sz %eval(@sz+1)
    wloz ziola do sloika
    sz
  }
}


Alternatively, you could stop keeping track of how many you have found altogether and just have it keep searching until you get the message about it being unable to be found at all or that the area is over searched.
Which may be better if there is a random amount in each room.
_________________
Discord: Shalimarwildcat
Reply with quote
Delathriel
Beginner


Joined: 01 Aug 2017
Posts: 16

PostPosted: Thu Aug 03, 2017 2:50 am   
 
That would be a lot better if I could look for herbs until I find none in a room.

When I can't find anything more in a room the reply message is:

"niczego interesujacego" or "szukasz wszedzie"

Would greatly appreciate it if you'd find a moment to share such a script. : )
Reply with quote
Delathriel
Beginner


Joined: 01 Aug 2017
Posts: 16

PostPosted: Thu Aug 03, 2017 3:36 am   
 
The first script you've mentioned actually puts me in a loop and I endlessly look for herbs in the same room. : )
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Thu Aug 03, 2017 10:59 am   
 
is there a message for when you search but can't find any, yet more is in the room?

#TRIGGER {Znajdujesz} {sz}
#TRIGGER {{niczego interesujacego|szukasz wszedzie}} {move}

And it is looping cause i left the #VAR sz 0 in the true half, not that that matters anymore
_________________
Discord: Shalimarwildcat
Reply with quote
Delathriel
Beginner


Joined: 01 Aug 2017
Posts: 16

PostPosted: Thu Aug 03, 2017 5:34 pm   
 
Can't get it to work. I either don't move, look for herbs indefinately or don't do anything...

I don't want to sound demanding or anything like that but if it wouldn't be a big issue to share such a full script based on the one in my initial post or perhaps a totally new, easier one where I look for herbs until I don't find any and then move on along the path that would be great. Doesn't need to be specific language, I'd probably figure out <text1>, <text2> etc.


#CLASS 0
#CLASS {herbs} {disable}
#ALIAS move {#IF (@step > 1000) {3} {#IF (@step > %numitems( @herbpath)) {#T- herbs} {%item( @herbpath, @step);#ADD step 1;sz}}}
#TRIGGER {Znajdujesz *} {
#IF (@sz > 0) {
#VAR sz 0
move
} {
#VAR sz 1
wloz ziola do sloika
sz
}
}
#TRIGGER {{niczego interesujacego|ale nie znajdujesz zadnych ziol}} {move}
#CLASS 0

sz - looking for herbs
Znajdujesz - found a herb
niczego interesujacego|ale nie znajdujesz zadnych ziol - found nothing
wloz ziola do sloika - puts herbs into a jar

Would immensely appreciate it!
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Thu Aug 03, 2017 9:52 pm   
 
Well i was assuming your move alias worked correctly.
Though looking at the initial #IF statement.... when/why would you want to send '3' to the game?
Also, you never reset your @steps variable.

#CLASS {herbs} {disable}
#ALIAS move {#ADD step 1;#IF (@step > %numitems( @herbpath)) {step=0;#T- herbs} {%item( @herbpath, @step);sz}}
#TR {Znajdujesz} {wloz ziola do sloika;sz}
#TR {{niczego interesujacego|ale nie znajdujesz zadnych ziol}} {move}
#CLASS 0

Something like that should be all you need. and you can delete @sz altogether unless it is used in other settings.
_________________
Discord: Shalimarwildcat
Reply with quote
Delathriel
Beginner


Joined: 01 Aug 2017
Posts: 16

PostPosted: Wed Aug 16, 2017 9:33 pm   
 
Thank you, seems to be working I think. I got myself into a loop as when found or not found there's the "znajdujesz" phrase but I've overcome this I think by including the case sensitivity. : )

#TR {^Znajdujesz *} {wloz ziola do sloika;szukaj ziol}
Reply with quote
Delathriel
Beginner


Joined: 01 Aug 2017
Posts: 16

PostPosted: Sat Sep 09, 2017 4:20 am   
 
Found my answer but not sure how to delete posts...
Reply with quote
Leyline
Wanderer


Joined: 03 Feb 2007
Posts: 64

PostPosted: Tue Dec 26, 2017 1:30 am   
 
Don't delete just because you found the answer, someone may still come and learn the same thing later :)
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