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


Joined: 11 Jan 2002
Posts: 27
Location: United Kingdom

PostPosted: Thu Apr 11, 2002 10:51 am   

Trigger Question....not as easy as my last one
 
As a quick response

Check out the #math command.

Then insert the variable into your gossip command.
Reply with quote
Rowene
Beginner


Joined: 11 Jan 2002
Posts: 27
Location: United Kingdom

PostPosted: Thu Apr 11, 2002 2:11 pm   
 
I dunno if u can insert the math command into your script as you have done, but this does work (on my machine at least)

#TRIGGER {^INFO~: ~[(%w)~] has gained level %d!}
#var leveller %1
#var level %2
#math level 41-@level
#ALARM +2 {gossip tell Gratz @leveller, only @level until you get to play with the big Boys}

This isn't the most elegant fo scripts, and I'm sure one of the guru's 'll pull me up on something...
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Apr 11, 2002 4:44 pm   
 
In the action part of the trigger, use %1, %2, %3, etc. In the trigger-phrase portion put parentheses around the wildcards you want to use in the action part. In other words, do the same thing with %d that you are doing with %w.

#MATH is for creating/changing variables. What you need here is the %eval function.

#TRIGGER {^INFO~: ~[(%w)~] has gained level (%d)!} {#ALARM +2 {gossip Gratz %1, only %eval(41-%2) until you get to play with the big Boys}}

HINT: Look up the commands and functions people suggest in the helpfile, it will help you avoid obvious errors.

LightBulb
All scripts untested unless otherwise noted
Reply with quote
HariKari
Wanderer


Joined: 16 Feb 2001
Posts: 57

PostPosted: Fri Apr 12, 2002 9:58 am   
 
#class autoGrat
#TRIGGER {^INFO~: ~[(%w)~] has gained level (%d)!} {#ALARM +2 {gossip Gratz %1, only %eval(41-%2) until you get to play with the big Boys;#T+ autoGrat};#T- autoGrat}
#class 0

This creates a group called autoGrat, and it contains the trigger for your auto congrats. When the trigger fires, it will turn itself off for 2 seconds. This should work fine as long as two different people do not level at the same time. But that probably will happen if people group or make formations...

For that case.. this should work.

#TRIGGER {^INFO~: ~[(%w)~] has gained level (%d)!} {#if (!%ismember( %1, @gratList)) {#additem gratList {%1};#ALARM +%random( 2, 5) {gossip Gratz %1, only %eval( 41-%2) until you get to play with the big Boys;#delitem gratList {%1}}}}

That creates a list of people to grat, and after you grat the person, s/he gets removed from the list. I also made it so it'll grat from 2 to 5 seconds, just in case a bunch of people level at the same time, so you will not be gratting all of them 2 seconds after it happens.

-HariKari
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Apr 19, 2002 6:50 am   
 
Use #IF. If (41-%2) > 0 do as before. Otherwise, use your new avatar grat.

LightBulb
Vague questions get vague answers
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Apr 19, 2002 4:08 pm   
 
As for the previous question, it probably can be done. It would involve storing the name and level to variables, then updating the level variable as each new level came in. The name variable would provide a means of checking that all the leveling messages applied to the same person. You would then need to start a timer with the first INFO, and when it expired, send out your grats with the highest level that had been seen. However, I'm not going to attempt writing it for you, as it will take considerable work and testing to get right.

LightBulb
Vague questions get vague answers
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Apr 20, 2002 6:46 am   
 
I say lets put an end to this one...hopefully.

#TRIGGER {^INFO~: ~[(%w)~] has gained level (%d)!} {#IF (%2>41) {gossip Crimson welcomes it's newest Avatar, %1.} {#EXEC %concat("#ALARM ",%char(34),"%1",%char(34)," +2 {gossip Gratz %1, only %eval(41-%2) until you get to play with the big Boys}")}}

There that should make an ALARM with the players name as the id, that provides that each time a player levels the ALARM is overwritten if it hasn't fired yet. I have been using id's with ALARMs for quite a while, but it is undocumented and therefore unsupported.
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