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


Joined: 13 Aug 2003
Posts: 8
Location: Poland

PostPosted: Sun Sep 07, 2003 12:29 pm   

Script help
 
How do I execute a script? How to make a script that when somebody tells me "fireshield" then my character casts a fireshield on him, waits 5 seconda and then folls into a meditation to regenerate mana...

SOMEBODY tells you "fireshield"
cast fireshield SOMEBODY
~5
deep meditation

can enybody help me ?
Reply with quote
Theoden
Newbie


Joined: 07 Aug 2002
Posts: 9
Location: Australia

PostPosted: Sun Sep 07, 2003 2:09 pm   
 
I am no guru ,but I think your after a trigger.I do it something like this.
#TRIGGER {%w tells you fireshield} {cast fireshield %1;#ALARM +5 {deep meditation}}

Hope it helps
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Sep 07, 2003 7:20 pm   
 
Minor correction. You need parentheses around items you want to address as %1-%99.
#TRIGGER {(%w) tells you fireshield} {cast fireshield %1;#ALARM +5 {deep meditation}}

Or, for editor entry:
Pattern: (%w) tells you fireshield
Value: cast fireshield %1;#ALARM +5 {deep meditation}
Reply with quote
julo133
Newbie


Joined: 13 Aug 2003
Posts: 8
Location: Poland

PostPosted: Tue Sep 09, 2003 10:41 pm   
 
And how do i make it in a script, and how do i execute a script?
I want to make that when (%w) tells me fireshield then i cast it on him and when (%w) tells me iceshield then i cast an ice shield on him...i seen #IF thing in other scripts but i can't understand it becaus zuggsoft didn't make any tutorial for making scripts :/
Reply with quote
DMUS
Beginner


Joined: 01 Sep 2003
Posts: 19
Location: USA

PostPosted: Wed Sep 10, 2003 12:43 am   
 
Just use the same script that Lightbulb wrote for you and replace the spell name with the spell you want it to trigger on and cast.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Sep 10, 2003 10:02 am   
 
It's Theoden's script, I just corrected a critical typo.

A script is just a collection of triggers, aliases, variables, or other settings all of which contribute to achieving a single purpose (such as doing spellups on request). It may be a single setting. It might be several hundred. Depends on the purpose of the script.

From the sound of it, you want to make a simple spellup robot. The easiest way is what DMUS said. To paraphrase, make one trigger for each spell you want to cast. When you've made the triggers, you've made the script. All you do to execute the script is log on. It will execute itself whenever someone tells you the right word or phrase for a particular spell.

You will need to make sure the pattern is correct. Theoden left out the double-quotes and so did I. They are special characters to zMUD, so you'll have to put a ~ in front of them if you do need them.

Command Line
#TRIGGER {(%w) tells you ~"iceshield~"} {cast iceshield %1;#ALARM +5 {deep meditation}}

Editor
Pattern: (%w) tells you ~"iceshield~"
Value: cast iceshield %1;#ALARM +5 {deep meditation}

To understand how these work, see the HELP on #TRIGGER, Pattern Matching (there's a link from #TRIGGER), and #ALARM.
Reply with quote
julo133
Newbie


Joined: 13 Aug 2003
Posts: 8
Location: Poland

PostPosted: Wed Sep 10, 2003 2:11 pm   
 
ok thanx
Reply with quote
julo133
Newbie


Joined: 13 Aug 2003
Posts: 8
Location: Poland

PostPosted: Thu Sep 11, 2003 6:17 pm   
 
I have one more question...i put scripts in CLASSES? when i write something in there and click <save> it disapears...and if i wan't to use command #IF where i must write it ?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Sep 11, 2003 8:50 pm   
 
You don't have to use CLASSES. They can be useful but aren't required. Settings should be created individually, not as Class Scripts. For instance, if you want to make a trigger push the Triggers button, then the New button, or click the arrow-button next to New and select New Trigger. The Class Script tab is to allow easy review of all the settings in the Class.

#IF is usually used in the Value section of an alias, button, macro, or trigger.
Reply with quote
julo133
Newbie


Joined: 13 Aug 2003
Posts: 8
Location: Poland

PostPosted: Thu Sep 11, 2003 9:05 pm   
 
#TRIGGER {(%w) tells you (%w)} {#IF (%2=fireshield) (cast fireshield %1)}
<--this isn't correct....how it supose to be? sorry for my english. im from poland
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Sep 12, 2003 4:33 am   
 
It's supposed to be like this.
#TR {(%w) tells you fireshield} {cast fireshield %1}

But, since you insist on using #IF even though it's much more inefficient, it should be like this.
#TR {(%w) tells you (%w)} {#IF (%2 = fireshield) {cast fireshield %1}}

It's much more inefficient because you'll be triggering on every tell instead of just the fireshield ones.
Reply with quote
julo133
Newbie


Joined: 13 Aug 2003
Posts: 8
Location: Poland

PostPosted: Fri Sep 12, 2003 3:27 pm   
 
But thears an #IF command.....why it is triggered on every tell ?
Reply with quote
Rehcra
Novice


Joined: 10 Oct 2000
Posts: 43

PostPosted: Fri Sep 12, 2003 4:34 pm   
 
{(%w) tells you (%w)}

This is the triggered portion of the #trigger.

This will match EVERY time anyone sends you a tell. Putting the first word into %2.

Joe tells you Boo you! --- %2 = "Boo"
Tom tells you Bite Me! --- %2 = "Bite"
etc.

And each time the trigger will run the action of the #trigger

{#IF (%2 = fireshield) {cast fireshield %1}}

Failing to past the #IF test, most times. But:

#TRIGGER {(%w) tells you ~"iceshield~"} ...

Will only match one specfic case. And you can always create several

#TRIGGER {(%w) tells you ~"iceshield~"} ...
#TRIGGER {(%w) tells you ~"fireshield~"} ...
Etc.

There are other ways to do this. Some that would combine mutilple triggers like the ones above, into one. But as you are learning it's easier to break each thing out, rather that try to make each trigger do as much as your can. KISS is the rule.

And makes figuring out why you did something a year from now a lot easier.
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