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


Joined: 07 Dec 2006
Posts: 4

PostPosted: Thu Dec 07, 2006 9:20 pm   

A few questions from a Newbie
 
Hello,
So I was looking through the finished scripts forum and noticed I didn't understand a single thing that these had in them. I read the help files that are here on the web site, but I was wondering if anyone knew of a place I could read about triggers and scripts and how to make them?
I understand the basic, the MUD give you text and you have a trigger that fires in response of that text, but when variable and such get into the mix too heavily, it gets....bad. *laughs*

Another is I play Achaea and am creating some anti-theft triggers. I have one to recognize me taking something out of my pack, but what I can't do is put it BACK into my pack.

Thanks
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Dec 07, 2006 9:38 pm   
 
The easiest way is to think of a problem, and ask people if they know any solutions to it. That way you can understand better why they're doing what they're doing - because you understand the problem. You've done that already.

#trig {You get *(%w) from your *} {put %1 in pack} AutoPut
#trig {You get %d gold sovereigns from your *} {put gold in pack} AutoPut

#alias get {#t- AutoPut;~get %-1;#temp {^(%d)h, (%d)m} {#t+ AutoPut}}

The first two commands create triggers that look for you getting something from your pack. The first one will detect when you get "an adjective adjective noun" from your pack. Since you want to capture the noun and not the adjective, you use *(%w) - the * matches the adjectives, and the %w matches the last word, the noun. The second one looks for any number of gold. See here for more explanation on wildcards in triggers.

The problem comes because this will happen regardless of whether you deliberately got something from your pack or not - hence the alias. Both of the triggers were created in the AutoPut class (which is just like folder). When you type GET 50 GOLD FROM PACK, zMUD will detect the alias GET. First it will turn off the class AutoPut, disabling all the triggers inside it. Next it will send get (the ~ is the quote character, that signals that "get" isn't an alias this time. If you don't have that, you get a loop because that GET will set off the alias again) - the %-1 tells zMUD to add everything you typed after "get" to this GET command that it's sending. If you typed GET 50 GOLD FROM PACK, %-1 will contain 50 GOLD FROM PACK. You can also use %1-99 to represent individual parameters. So %1 will be 50, %2 will be GOLD, %3 will be FROM, and so on.

Finally, this script creates a temporary trigger that will only execute once. It's set to trigger on your prompt, and will re-enable the AutoPut class to stop you from taking anything out until you GET again.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Wonderer
Newbie


Joined: 07 Dec 2006
Posts: 4

PostPosted: Fri Dec 08, 2006 5:44 am   
 
Ok I have the triggers down pat. Had to change some stuff, but in that I learned so it's all good. Still messing with the alilas but again, I'm learning so I'm content.

Though again anti-theft....I'm trying to get one where if I take something off, I automatically put it back on. Then I'll set up an alials to turn it off...but I tried trig (You remove * %w) (wear %1) But it kept just sending WEAR and then it'd ask me what I wanted to wear. Then I looked around and tried trig (You remove * &item) (wear &item) Which did everything I wanted, BUT the stinking little period screwed me over. I tried * after the &item to see if that would eliminate it, but no.

Thanks for the info and links. Helps a bunch.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Dec 08, 2006 11:37 am   
 
Firstly, make sure you use the right kinds of braces and brackets. You should be placing {} around commands, so it should be:

#trig {You remove something} {wear something}

Again, you can do this in a similar manner to the trigger I've given above. Read through the help for wildcards in trigger patterns carefully - you'll probably want to have something similar to what I gave you above.

#trig {You remove *(%w)} {wear %1}

The reason yours doesn't work is because the &varname syntax will set the value of the variable "item" to whatever it detected in the pattern at that point. If you're referring to values of variables in a script, you must use the @ character, so:

#trig {You remove &item} {wear @item}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Wonderer
Newbie


Joined: 07 Dec 2006
Posts: 4

PostPosted: Fri Dec 08, 2006 8:20 pm   
 
Yes....I got the alias to work. Took sometime and well a lot of thinking.
What was happening was that the alias would turn off the AutoPut class, get the vial (what I used to test it with) and turn the AutoPut class back on before the MUD sent that I had taken something from my pack. Therefore, the AutoPut class was on, and the triggers did it's thing. So I just inserted a #WA command for half a second and all is good now. Though if I lag, it will screw me over, but I'm running on the thought and background that I don't lag much. Which is true.

Ok, though I have 1 more questions and that's it, I promise. I read about ^ and $ but I don't understand what they mean in the description.

Thanks for the amazing amount of help Fang.

EDIT: I got the alias that you gave me to work, had to tweak some settings in the zMUD thing. Thanks. Though the questions about ^ and $ are still open.
Again thanks.
Reply with quote
Wonderer
Newbie


Joined: 07 Dec 2006
Posts: 4

PostPosted: Sun Dec 10, 2006 6:17 am   
 
Ok so, I don't know how I could have over looked this, but when I say, get 100 gold from pack, then get vial from pack, vial changes to 100 gold. I looked to see if I could figure out what the problem is, and it is each time i get something out of my pack with that alias, it creates a #class "folder" with whatever I got from my pack. And if I try and get 100 gold from my pack twice, it puts all my gold in my inventory in my pack....it's very strange.

Thanks

EDIT: I'm using exactly what you gave me in the other posts.
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