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
RobMacAF
Apprentice


Joined: 09 Jun 2002
Posts: 186
Location: USA

PostPosted: Sat Jun 14, 2003 12:18 am   

Using %1 %2, etc
 
Me again.
I have a script that lets me type:
p ewh 4 right hand

what this does is p=prep
ewh=spell
4=mana amount

Then when the spell is ready it will cast it on my Right hand

The problem is, is there anyway to p ewh 4 right hand 4 left hand 6 head, etc

That way it uses 4 mana casts on the right hand. Then preps the spell again but this time using 4 mana and cast on the left hand, then preps again using 6 and on the head. I want to make it that it will continue going until all of the things that I add there are done casting. The parts of the body can be head, neck, right eye, left eye, skin, right arm, left arm, right hand, left hand, chest, abdomen, right leg, left leg, back, nerves

The amount of mana I put into each will vary.

So sometimes I might just use
p ewh 4 right hand

Sometimes it might be 20 times longer with all the body parts, etc.
--------------------------------------

Also, can I make it that if I put esh, ish, or iwh in there it will change the spell type so I can do something like this

p ewh 4 right hand 6 left hand esh 5 right hand 7 left hand

This would prep the ewh spell for 4 and 6 and cast on the right and then left hand, then it would change the spell type to esh and then cast that on the right and left hand using the specified mana.

I am guessing this could be achieved using the {|} matching but I am not sure. Any help would be great. Thanks
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Sat Jun 14, 2003 7:32 pm   
 
I am thinking you would want the #ONINPUT triggers.

but if your typig:
p ish 4 left hand 5 right hand
you could have easily just did it this way
p ish 4 left hand
p 5ish righ hand

tring to get this many variables to work might be tough and I wanted to answer you so that you would think about this however some guru might not see it the same as me. I really do need to upgrade.

megamog75
Keeper of the only printable help files for Zmud.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sun Jun 15, 2003 6:05 am   
 
This little script loops through parameters and build a queue of things to prep. If you provide command example for prepping and casting, as well as triggerable text I will help you with writing the appropiate script to preform everything in the queue.

#CLASS {SpellPrepQueue}
#ALIAS p {#IF (%numparam=0) { #ECHO Usage: p ~[prep codes]/~[variable name]} {Body="";Spell="";Mana=0;LastCommit=0;#LOOP 1,%numparam { #IF (%db(@PrepCodes,%param(%i))!="") {#EXEC %db(@PrepCodes,%param(%i));#IF ((@Body!="")&(@Spell!="")&(@Mana>0)) {#ADDKEY SpellQueue %concat(@Spell,":",@Body) @Mana;LastCommit=%i}} { #IF (%isnumber(%param(%i))) {Mana=%param(%i);#IF (%eval(@LastCommit+1)!=%i) { #IF ((@Body!="")&(@Spell!="")&(@Mana>0)) {#ADDKEY SpellQueue %concat(@Spell,":",@Body) @Mana;LastCommit=%i}}} { #IF (%defined(%param(%i))) {LastCommit=0;#LOOPDB @{%param(%i)} {#ADDKEY SpellQueue %key %val;#ADD LastCommit 1;#IF (@LastCommit=%numkeys(@{%param(%i)})) {Spell=%word(%key,1,":");Body=%word(%key,2,":");Mana=%val}};LastCommit=%i}}}}}}
#VAR PrepCodes {eshSpell="esh"lhBody="left hand"rhBody="right hand"-Spell="";Body="";Mana=0save#VAR {%param(%eval(%i+1))} {@SpellQueue}}
#VAR SpellQueue {}
#VAR Body {} {}
#VAR Mana {} {}
#VAR Spell {} {}
#VAR LastCommit {0} {0}
#CLASS 0

The basic usage is what you asked for, I decided that when mana value is changed it should not commit to the queue if it just committed on the last parameter. Also note that the PrepCodes variable is a record variable, and may have trouble importing from the command line. Make sure its value matches. It provides shortcuts for usage and also allows code additions such as the save code and the - code i put in, and once a queue has been saved it can be reloaded simply by putting the variable name. Examples:
p 4 esh lh rh save esh1
p esh1

The queue is formatted be a record variable with keys of spell:part and value of mana. This was done so that a large queueing list would not duplicate any spell+part combo. Also the alias is designed so that changing the mana number will not cause repeated commits with the current spell+part combo. You can extend that functionality so that 2 things must be specified before committing. I was unsure of your muds actual structure so I figured you would want to do the spells in whatever order made the least typing.
Reply with quote
jadamae
Newbie


Joined: 27 Jul 2003
Posts: 2

PostPosted: Sun Jul 27, 2003 11:32 am   
 
quote:
Originally posted by RobMacAF

Me again.
I have a script that lets me type:
p ewh 4 right hand

what this does is p=prep
ewh=spell
4=mana amount

Then when the spell is ready it will cast it on my Right hand




i'm looking to do something very simlar to the code you say you have.
i want to type slk 5 and have it do a loop of kill 1.sl's head; k 2.sl's head and so on till the number i typed is acheved. i've tried linking a promting varable but to no avail and just read about this oninput command with no luck can you mail me your code that does it/ i'm sure i could vamp it to what i need, just i can't seem to get it togeather.

just looking for the simplest way to define a loop with a typed command.. it seems to be alot harder than i imagined
i know vb and there is a vb scripting drop down but zmud has it's own flavor i'm not used to yet thanks again.

Code:


Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Jul 27, 2003 7:05 pm   
 
This doesn't sound "very similar", in fact it doesn't really sound similar at all. Next time (or for further questions on the alias below) please start your own topic.
#AL slk {#IF %isnumber( %1) {#LOOP 1,%1 {k %i.sl's head}} {#SAY Huh?}}
Reply with quote
jadamae
Newbie


Joined: 27 Jul 2003
Posts: 2

PostPosted: Tue Jul 29, 2003 3:31 am   
 
quote:
Originally posted by LightBulb

This doesn't sound "very similar", in fact it doesn't really sound similar at all.


sorry just ment that he could assign a value to a varible within the alias while typing it ex chooseing how much mana to put into each prep sorry i wasted your time. i was wrong.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jul 29, 2003 8:50 am   
 
You didn't waste anyone's time. You just tried to change the subject of the thread, and I'm trying to make sure that doesn't happen. I hope you notice I also answered your question by providing an alias which does exactly what you asked.

I strongly encourage you to start your own topic if you need further help with either your question or the alias. Nobody's time will be wasted by helping you to learn.
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