|
climbjtree Newbie
Joined: 14 Aug 2005 Posts: 4
|
Posted: Sun Aug 14, 2005 10:10 am
trying to create a script that does two things. |
I've been trying to create a script that triggers on a line and text, and each time the trigger fires, it adds to a variable.
Each time the variable hits a certain number, I want a command to be sent to the mud, and the variable reset.
It'd go like this:
[important line of text] scrolls by.
#add var1
if var1 = 3, [send desired command, reset var1]
Could anyone help? |
|
|
|
Rappy Wanderer
Joined: 15 Jul 2005 Posts: 96
|
Posted: Sun Aug 14, 2005 10:52 am |
Code: |
#TRIGGER {important line of text} {#ADD var1 1;#IF {@var1 = 3} {do this;var1 = 0}}
|
-Rappy |
|
_________________ Windows 11 Pro,
cMUD 3.34 |
|
|
|
climbjtree Newbie
Joined: 14 Aug 2005 Posts: 4
|
Posted: Sun Aug 14, 2005 11:03 am |
thanks Rappy for the speedy response.
In my brainstorming though, I forgot something.
The trigger is for learning magic, and there are two possible outcomes in the situation.
You practice the spell, and it either says:
You finished practicing.
You think you would have succeeded.
Or:
You finished practicing.
If you think you succeed three times in a row, thats when you need the command to be sent to the mud. If you miss it once, and you just get "You finished practicing," I need the var to be reset.
Is that possible? |
|
|
|
Rappy Wanderer
Joined: 15 Jul 2005 Posts: 96
|
Posted: Mon Aug 15, 2005 10:35 am |
You mean something like this...
untested (damn eLic)
Code: |
#TRIGGER {You finished practicing.$(*)$} {
#IF {%1 = You think you would have succeeded.} {
#ADD var1 1
#IF {@var1 = 3} {
send this to the MUD //3 successes
var1 = 0 //reset variable
}
} {var1 = 0} //oops I didn't succeed, set variable to 0 and try again.
}
|
-Rappy |
|
_________________ Windows 11 Pro,
cMUD 3.34 |
|
|
|
climbjtree Newbie
Joined: 14 Aug 2005 Posts: 4
|
Posted: Tue Aug 16, 2005 9:23 am |
Thanks again Rappy.
However, for some reason, it's not picking up the 'you think you would have succeeded.'
I've tried to fix it myself, but still can't figure it out. Any ideas? |
|
|
|
Kiasyn Apprentice
Joined: 05 Dec 2004 Posts: 196 Location: New Zealand
|
Posted: Tue Aug 16, 2005 2:42 pm |
Code: |
#TRIGGER {You finished practicing.} {
#ALARM +2 {
#IF (@var1 = 3) {
do this
var1 = 0
}
}
}
#TRIGGER {You think you would have succeeded.} {
#ADD var1 1
}
|
not very efficent... but it should work in most cases.. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Tue Aug 16, 2005 11:54 pm |
Zmud supports very powerfull conditional triggers!
Code: |
#TRIGGER {You finished practicing.} {}
#COND {} {
#IF (%trigger="You think you would have succeeded.") {
#ADD var1 1
#IF (@var1>=3)) {
#SAY Do this on third message
#VAR var1 0
}
} {#VAR var1 0}
} {within|param=1} |
|
|
|
|
|
|