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
Sinemac
Newbie


Joined: 07 Jan 2018
Posts: 6

PostPosted: Mon Jan 08, 2018 12:37 am   

Is it possible? Creating a trigger question
 
Greetings Folks,

It's been a long time since I've touched zMUD.. but I've gotten interested in playing a MUD I played years ago..

My question is..

when I go into a location I do an "herbs" command and it shows me something like

You forage around for wild herbs.
There are twenty-five batches of siriena here.

or I can do a "poisons" command and it shows me something like this

You forage around for wild poisons.
There are thirty-six batches of shirolos here.

..

right now I go into each location and have to calculate how many herbs/poisons I can take from a location

is there a way to have it automatically pick herbs to a certain point?

let us say that there are eight-six herbs in the location. I want to set a specific number of 25 to be the lowest number..

when I do a herbs or poisons it automatically knows every herb or poison type in the location and picks them down to 25.

Below is a thing I wrote years ago (yes it can be messy, but it works and I learned from piecing together different ideas)....

right now I go into a location and do a herbs or poisons command to see what's there.. then I pp #numberofherbsIwant

and it picks to the number I want and then picks and plants the last herb.. and then I made a very bad #50 inp command that puts all the herbs in my pouches..

Anyway, I was curious if it was possible.. if so, is there a resource that might show me what to do..

Thank you again.

Code:

#CLASS {picking}
#ALIAS preps {
  #va preppo %1
  prepare @preppo
  #T+ prepares
  }
#ALIAS pp {
  #va picktype %2
  #va pickno %1
  #va pickno2 %1
  #T+ picks
  pick @picktype
  }
#VAR preppo {siriena}
#VAR pickno {0}
#VAR picktype {siriena}
#VAR pickno2 {35}
#CLASS 0
#CLASS {picking|prepares}
#TRIGGER {^Right hand ready.} {prepare @preppo}
#TRIGGER {^Right side ready} {prepare @preppo}
#TRIGGER {All of your * has been prepared.} {
  #50 inp @picktype
  #T- prepares
  }
#TRIGGER {^You have regained your right-sided balance} {prepare @preppo}
#CLASS 0
#CLASS {picking|picks}
#TRIGGER {^Right hand ready.} {
  #if (@pickno>0) {
    pick @picktype
    #ad pickno -1
    } {
    plant @picktype
    preps @picktype
    #T- picks
    }
  }
#TRIGGER {^Right side ready} {
  #if (@pickno>0) {
    pick @picktype
    #ad pickno -1
    } {
    plant @picktype
    preps @picktype
    #T- picks
    }
  }
#TRIGGER {^You have regained your right-sided balance} {
  #if (@pickno>0) {
    pick @picktype
    #ad pickno -1
    } {
    plant @picktype
    preps @picktype
    #T- picks
    }
  }
#CLASS 0

Reply with quote
shalimar
GURU


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

PostPosted: Mon Jan 08, 2018 4:47 am   
 
Well there is no single way to go about it, looks like what you have is mostly doing it as is.
You just need to make a trigger on the output of the survey command

#FUNC wordNumber {some script to convert wordnumbers into integers}

Code:
#TR {There are (*) batches of (%w) here.} {
  #IF (@wordNumber(%1)>25) {
    #VAR picktype {%2}
    #MATH pickno {%eval(@wordNumber(%1)-25)}
    }
  }
_________________
Discord: Shalimarwildcat
Reply with quote
Sinemac
Newbie


Joined: 07 Jan 2018
Posts: 6

PostPosted: Mon Jan 08, 2018 6:31 am   
 
Do you know where I can find more info on #FUN .. I tried the help file but it took me to microsoft for some reason.

or wait...

I wonder if I can make a whole list of triggers or something that are tied to numbers..
Reply with quote
shalimar
GURU


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

PostPosted: Mon Jan 08, 2018 7:32 am   
 
#HELP #FUNC
Is the shorthand to the client side help system.
But you would need to cobble it from the various commands and functions.
Something like this would work, as a short example, you would need to expand it out to cover every instance of course.

#FUNC wordNumber {#RETURN %replace(%replace(%replace(%1, "twenty", "2"), "thirty", "3"), "-four", "4")}
_________________
Discord: Shalimarwildcat
Reply with quote
Sinemac
Newbie


Joined: 07 Jan 2018
Posts: 6

PostPosted: Tue Jan 09, 2018 6:57 am   
 
Greetings,

Thanks for the info

I tried #HELP #FUNC and nothing happend in my zMUD.

I tried #HELP on it's own and it opened

https://support.microsoft.com/en-us/help/917607/error-opening-help-in-windows-based-programs-feature-not-included-or-h

So I'm thinking that I cannot used that old help system on Windows 10.

Okay I was trying to understand the function part and was pulling up different scripts that use functions but it's not clicking yet.. I did notice how people are making different text trigger on the same instances.. before I made a trigger for every change in text.. but figured that out..

I wasn't sure where to edit the text in the function you provided.. I wasn't sure if keep adding parenthasis and then like twenty-one and then I noticed there was a 2 after twenty.. I wasn't sure if that was supposed to be a 20.. etc

Code:
#CLASS {picking}
#ALIAS preps {
  #va preppo %1
  prepare @preppo
  #T+ prepares
  }
#ALIAS pp {
  #va picktype %2
  #va pickno %1
  #va pickno2 %1
  #T+ picks
  pick @picktype
  }
#VAR preppo {lestagii}
#VAR pickno {0}
#VAR picktype {lestagii}
#VAR pickno2 {10}
#VAR wordNumber {RETURN %replace( %replace( %replace( %1, "twenty", "2"), "thirty", "3"), "fourty", "4")}
#TRIGGER {There are (*) batches of (%w) here.} {
  #IF (@wordNumber(%1)>25) {
    #VAR picktype {%2}
    #MATH pickno {-25}
    }
  } "" {disable}
#CLASS 0
#CLASS {picking|prepares}
#TRIGGER {^{Right hand ready~.|Right side ready~.|You have regained your right-sided balance~.|You have fully regained your balance~.}} {prepare @preppo}
#TRIGGER {All of your * has been prepared.} {
  #50 inp @picktype
  #T- prepares
  }
#CLASS 0
#CLASS {picking|picks}
#TRIGGER {^{Right hand ready~.|Right side ready~.|You have regained your right-sided balance~.|You have fully regained your balance~.}} {
  #if (@pickno>0) {
    pick @picktype
    #ad pickno -1
    } {
    plant @picktype
    preps @picktype
    #T- picks
    }
  }
#CLASS 0
#CLASS {picking|wordvars}
#CLASS 0
Reply with quote
shalimar
GURU


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

PostPosted: Tue Jan 09, 2018 6:29 pm   
 
the twenty is just the tens digit, you would have to enter more instances of the %replace function to cover the other possible tens and ones digits...
admittedly it's not a pretty script, but it gets the job done.

Also, you left out the # on #RETURN
_________________
Discord: Shalimarwildcat
Reply with quote
Sinemac
Newbie


Joined: 07 Jan 2018
Posts: 6

PostPosted: Tue Jan 09, 2018 11:45 pm   
 
I get an Error when I have the #RETURN .. it leaves if I take the # off.. for some reason.
Reply with quote
shalimar
GURU


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

PostPosted: Wed Jan 10, 2018 1:26 am   
 
Might just be a command that was added with CMUD.
_________________
Discord: Shalimarwildcat
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