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
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Wed Jan 23, 2002 12:21 am   

Script Help
 
I got the following spell-up script set up, because we arent allowed to have a script that just and casts the spells, so this is all that is legal. Let me show you my script, then I will ask the question:

First all of my triggers go in one class called Spellchkr and all my spells have 3 triggers.

#TR {^You are surrounded by a force shield.} {#VAR shield 1}
#TR {^Your force shield shimmers then fades away.} {#VAR shield 0}
#TR {^Spell: shield for * hours} {#VAR shield 1}

Then there is the alias that checks to see if the conditions are right to cast a given spell:
#ALIAS {c0} {#IF {@%1 = 0} {cast %1}}

And another alias to reset the spells variables if for some reason it doesnt see it wear off/cast:
#ALIAS {s0} {#VAR %1 0}

Then i have all the aliases for the spells put into another alias:
#ALIAS {castall} {c0 shield;c0 sanc;c0 blahblah}

And two more alias to reset and check ALL the spells.
#ALIAS {zeroall} {s0 shield;s0 sanc; etc...}
#ALIAS {checkall} {zeroall;saffects;#CR;#CR;#CR}

Finally there is my status bar, that in the Status Line field i simply put the varable names into, and it gives my 1' and 0's.

Now here is the question, I remort a lot, and when i got i have to gain/prac all those spells over again, which means i have to reconfigure my castall alias and my staus line. Can anyone figure something i could put into my script that would take the following mud output:


You can now use the following skills and spells :
Spell Shield.
Skill Berserk.
Spell Sancuary.

Take that input, and make it add that spell to my castall alias and status line?I cant think of anyway, but please post if you can :)
Thanks in adavnce,
dacheeba
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Jan 23, 2002 7:09 am   
 
The only way I can see to do it is to rewrite some of your existing stuff. Then use something to detect that you are starting over with your character aand set your flags to -1. Your c0 alias can be changed to >0, then you just have to get the triggers in for your gaining the ability to use them to set it to 0. It really is just a matter of chaanging your if's to accomodate another setting of the flag.
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Wed Jan 23, 2002 4:30 pm   
 
ok, im slowly figuring it out but i still need some help. The changes are in bold:

Root
--------
#ALIAS {c0} {#IF {@%1 = 0} {cast %1}}
#ALIAS {s0} {#VAR %1 0}

Body
------
#TR {^You are surrounded by a force shield.} {#VAR shield 1}
#TR {^Your force shield shimmers then fades away.} {#VAR shield 0}
#TR {^Spell: shield for * hours} {#VAR shield 1}
#TR {^Level: %1 Shield} {#VAR shieldlvl %1}


Utility
-----------
#TR {^~[%1~] Me:} {#VAR spuplvl %1}
#ALIAS [checkall} {group;zeroall;#CR;#CR;#CR}
#ALIAS {castall} {#IF @spuplvl>=@shieldlvl} {c0 shield}
#ALIAS {zeroall} {#IF @spuplvl>=@shieldlvl} {s0 shield}
#ALIAS {initiatelvlchecks} {show shield;#WA;show sanc;#WA;etc}

ok i know this will work, but the are 2 things id like to do. First, i want to make the default value for @shieldlvl defined by what it captures, do I just put {%1} at the end of it to get it to do that?
like so:
#TR {^Level: %1 Shield} {#VAR shieldlvl %1 {%1}}

Second, on the initiatelvlcheck
alias i have put in some #WAIT commands, this will wait till it recieves the output and records the value for the @shieldlvl before continuing, correct?If heard #wait was kind of buggy, and if there is a better way to do that part, someone please share :)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Jan 23, 2002 5:53 pm   
 
Put your spells in a stringlist variable. That way, you can use #FORALL with your zeroall and castall aliases and easily add new spells as you learn them using the #ADDITEM command. Sample alias and trigger:

#AL castall {#FORALL @spells {c0 %i}}
#TR {You can now use} {#T+ addspell}
#TR {Spell (*).} {#ADDITEM spells {%1}} {addspell}
#TR {$} {#T- addspell} {addspell}

You could use the same trigger to create a new set of triggers for the spell and add the spell's variable to the status line.

LightBulb
All scripts untested unless otherwise noted
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Wed Jan 23, 2002 6:26 pm   
 
quote:

Put your spells in a stringlist variable. That way, you can use #FORALL with your zeroall and castall aliases and easily add new spells as you learn them using the #ADDITEM command. Sample alias and trigger:

#AL castall {#FORALL @spells {c0 %i}}
#TR {You can now use} {#T+ addspell}
#TR {Spell (*).} {#ADDITEM spells {%1}} {addspell}
#TR {$} {#T- addspell} {addspell}

You could use the same trigger to create a new set of triggers for the spell and add the spell's variable to the status line.

LightBulb
All scripts untested unless otherwise noted


Great suggestion, but how do i filter out non-spellup spell, like magic missile and the such?Also, can i add quotes to the #additem part to capture spells with more than one word?
EDIT
Hmmm, supose i could do it like so:

#AL castall {#FORALL @spells {c0 '%i'}}
#TR {You can now use} {#T+ addspell}
#TR {Spell (%1).} {#IF %1=(Shield|Santuary|Armor)} {#ADDITEM spells {%1}} {addspell}
#TR {$} {#T- addspell} {addspell}

Would that work right?

Also, i dont quite understand how I would make a trgger along the same lines that would put the spells variable into the status line, even more so with the spells varaible being a stringlist. Could you offer more info?
EDIT YET AGAIN
Cant do the thing with the qutation mark like this,:

#AL castall {#FORALL @spells {c0 '%i'}}

because some of the spell have 2 or more words in them, and my variable names are set up so that they cast the variables name, so for the more than one word spells i use the spell number(each spell has a spell nuber for easier casting)
so when if i try to capture the spell names, the ones thathave more than 1 word wouldnt match the vaiables.Make sense?
EXA:

would take this output and put it in the stringlist:

Protection from Fire

Then it would try to cast it as 'Protection from Fire', however there is no @protectionfromfire or any other combo like that because, the way i have it set up, the var name is @152(the spell #).Would it best to use #SUBfor this?ie:

#TR {Spell Protection from Fire.} {#SUB Spell 152.}(not sure on the syntax for that one)
#TR {Spell (%1).} {#IF %1=(Shield|Santuary|Armor|152)} {#ADDITEM spells {%1}} {addspell}
Would that fire the #ADDITEM the way I want?


Thanks,
dacheeba
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Jan 24, 2002 12:33 am   
 
#TR {Spell (%1).} {#IF %1=(Shield|Santuary|Armor|152)} {#ADDITEM spells {%1}} {addspell}
Will never work for you as %1 is an unrecognized pattern matching symbol. I think in the case of your mud that will not be a single word either so you must use *. This requires that you make a small change to your if statment.
#TR {Spell (*).} {#IF %word("%1",1)=(Shield|Santuary|Armor|152)} {#ADDITEM spells {%word("%1",1)}} {addspell}
Note the ""'s around %1 in the script section of the trigger, they aren't always a must but they never hurt and will occasionaly save you hours of head scratching. Also keep in mind that %1 does not exist until the script section, that is why you can't directly use it in your trigger pattern. Otherwise it looks like you have the idea and soon will be telling us how to do things.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jan 24, 2002 7:05 pm   
 
quote:
Great suggestion, but how do i filter out non-spellup spell, like magic missile and the such?

I can think of NO foolproof method of differentiating between spellup/non-spellup spells without human intervention. You asked for a means of adding spells as they became available and that's fairly easy, deciding what type of spells they are generally requires a human at the controls. The method you suggested, checking new spells against a stringlist of all spellup spells, should work fine as it does bring the human element in when you create that stringlist.

On second thought, your spell triggers (3 per spell) rely on knowing the success/failure messages for each spell, I think you'll have to make those individually.

For the status line, create a new variable with the contents of the current status line

#VAR statline {@shield @bless}

When you add a new spell put something like this in the trigger that detects it:
#ST {%expand(@statline,1) ~@%word(%1,1}}
#VAR statline {%expand(@statline) ~@%word(%1,1)}

LightBulb
All scripts untested unless otherwise noted
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