Triggers/Aliases and variables

Posted by Happy Aeryn on Sat 01 Dec 2001 12:53 AM — 16 posts, 64,328 views.

#0
I have a magic-user character. Everyone keeps asking me to spell them up.

How to I set up a trigger/alias so I can type "spell up ___" and get it to run down each spell on the person I specify?

I have no idea what veriables I should use in place of the person's name so that I can type any name and have it work on that person.

I assume I need an alias for "Spell up ____" and then a trigger for

cast armor ____
cast shield ____

and so on.

I hope you get what I mean.
Australia Forum Administrator #1
Assuming you have a fixed list of spells you want to cast, this is simply done with one alias. An alias can send multiple lines (just type them into the "send" box). I would suggest something like this:




Alias: spell up *
Send:  cast armor %1
       cast shield %1
       cast blah blah %1    ... and so on ...



The %1 is replaced by whatever matches the wildcard (the *) in the alias line.
USA #2
I was wondering if there was a way to pause between casting. Like after you cast the first two spells. If you could pause for 4 seconds, then continue casting. This way your client could catch up with the server.
USA #3
I have no idea how the SpeedWalk Delay works.. But this is what I mean..


Trigger: * says 'spellup'

Send:
,is now casting on %1
c 'kindred strength' %1
<Pause here for 2 seconds>
c 'elven beauty' %1
<Pause here for 2 seconds>
c 'trollish vigor' %1
<Pause here for 2 seconds>
c 'valiance' %1
<Pause here for 2 seconds>
c 'fly' %1
,revs up the Turbo-Trancer 2000
,enters Turbo-Trance 1 of 2
<Pause here for 2 seconds>
trance
,enters Turbo-Trance 2 of 2
smile %1
<Pause here for 2 seconds>
,begins casting once more
c 'iceshield' %1
<Pause here for 2 seconds>
c 'fireshield' %1
<Pause here for 2 seconds>
c 'dragon wit' %1
<Pause here for 2 seconds>
c 'slink' %1
<Pause here for 2 seconds>
c 'sagacity' %1
<Pause here for 2 seconds>
,looks about for others to cast on!

Can that be done?
Australia Forum Administrator #4
Not exactly how you describe (unless you use timers) however almost.

If you select "Send to world - speedwalk delay" and then go into the "Commands" configuration box and enter "2000" into the speed walk delay box.

Now every line in that trigger will be sent at 2 second intervals. I know you didn't want 2 seconds between *every* one, but most of them. This will be close.

Otherwise, you can, with a bit of scripting, make a series of timers that fire after the appropriate intervals to send the commands, however I think my suggestion above is a lot less work.
Amended on Sun 09 Dec 2001 05:24 AM by Nick Gammon
USA #5
What about Aliases? Can I make them pause as well?
USA #6
Nevermind.. I tried it with Queue command and it worked.. This is exactly what I was hoping for... Thanks!
#7
now that i see how to make an alias for a spellup, how would i one, create a file with a list of the spells in it, and two how can i get mush to check the spells in the list to see if i already have them casted on myself in order to only cast what i need instead of wasting time and mana?

i dont know vb script, so any help would be great

thx

skieze
Australia Forum Administrator #8
First question, how do you know what spells are on yourself? I mean, forget scripting, how do you currently know?
#9
i have been looking at something to do like.....

create a

spellup_list variable {lists all spells to be casted by spellup alias}

spellup_temp variable {temporarialy holds the current spell being casted and adds it to the spellup_spells_list}

spellup_spells_list variable {lists all the current spells successfully casted by the spellup alias}


addspell alias {lets you add new spells to the spellup_list var}

remspell alias {can delete spells from the list}

spellup alias {calls the trigger spell(*):}

spell(*): trigger {reads through the spellup_list variable casting every spell listed}

remspell_list trigger {list of all the messages that spells display when they wear off and when it sees a message it removes the spell from the spellup_spells_list}

i want to sync theses aliases and trigger together in order to make a very efficient spellup alias/trigger setup, however i dunno not know vb but i am slowly filing through the forums picking up bits and pieces of code so hopefully this will become an achievable goal in the future. also any help you can provice would be great!!

thank you,

skieze
Australia Forum Administrator #10
Well, this should get you started. You can copy the whole lot below and click the "paste" button in the aliases configuration list, to insert them all.




<aliases>
  <alias
   name="addspell"
   match="^addspell (\w+)$"
   enabled="y"
   group="spells"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>' get existing spells
slist = Split (GetVariable ("spells"), "|")
snew = lcase (trim ("%1"))
sfound = vbFalse

' check spell not in list already
for each s in slist
  if s = snew then sFound = vbTrue
next

' if there, show error, otherwise add to list
if sFound then
  ColourNote "white", "red", "Spell " &amp; snew &amp; " already in spell list"
else
  if GetVariable ("spells") = "" then
     SetVariable "spells", snew
  else
     SetVariable "spells", GetVariable ("spells") &amp; "|" &amp; snew
  end if
  
  ColourNote "white", "green",  "Spell " &amp; snew &amp; " added to spell list"
end if

</send>
  </alias>
  <alias
   match="^remspell (\w+)$"
   enabled="y"
   group="spells"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>' get existing spells
slist = Split (GetVariable ("spells"), "|")
swanted = lcase (trim ("%1"))
sfound = vbFalse
snewlist = ""
count = 0

' go through list, rebuilding it, and omitting the spell to be deleted 
for each s in slist
  if s = swanted then 
    sFound = vbTrue
  else
    if count &gt; 0 then snewlist = snewlist &amp; "|"
    count = count + 1
    snewlist = snewlist &amp; s
  end if
next

' if not there, show error
if not sFound then
  ColourNote "white", "red", "Spell " &amp; swanted &amp; " not in spell list"
else
  SetVariable "spells", snewlist 
  
  ColourNote "white", "green",  "Spell " &amp; swanted &amp; " removed from spell list"
end if

</send>
  </alias>
  <alias
   name="listspells"
   match="listspells"
   enabled="y"
   group="spells"
   send_to="12"
   sequence="100"
  >
  <send>' get existing spells
slist = Split (GetVariable ("spells"), "|")
count = 0

' list them
for each s in slist

  if count = 0 then ColourNote "white", "blue", "-- Spell list --"
  ColourNote "white", "blue", s
  count = count + 1
next

if count &gt; 0 then
  ColourNote "white", "blue", CStr (count) &amp; " spell(s)"
else
  ColourNote "white", "red", "No spells in list"
end if
</send>
  </alias>
  <alias
   name="spellup"
   match="spellup"
   enabled="y"
   group="spells"
   send_to="12"
   sequence="100"
  >
  <send>' get existing spells
slist = Split (GetVariable ("spells"), "|")
count = 0

' cast them
for each s in slist
  Send "cast '" &amp; s &amp; "'"
  count = count + 1
next

if count &gt; 0 then
  ColourNote "white", "blue", CStr (count) &amp; " spell(s) cast"
else
  ColourNote "white", "red", "No spells in list"
end if
</send>
  </alias>
</aliases>




This implements:

addspell x
remspell x
listspells
spellup

I haven't done the spell wearoff messages, I'll leave you to play with that.
#11
just wanted to take the time to say thank you for the quick response and for the time that you put into helping me with this. the code you provided is working great!! thank you again,


skieze
#12
How to make the addspell alias accept two word spells....?

In the spellup script given above, i have been playing with the \w+ and \s+ combo's but I cannont find a way to alter the alias to accept two word spells that contain a space in the middle. This is kinda a problem since a good majority of the spells on aardwolf contain the same first word and will not work if you only use the second word of the spell so i need to find a way to have addspell accept two word spells.

examples would be

cast 'protection evil'
cast 'protection good'
cast 'detect invisible'
cast 'detect hidden'

Thank you,

Skieze
Australia Forum Administrator #13
For all the matches you need to add in a space. For example, change:

match="^remspell (\w+)$"


to


match="^remspell ([\w\s]+)$"


The expression [\w\s] means "a set of characters containing either words or spaces" and the + means "one or more of them".

However more simply you could say:

match="^remspell (.+)$"

However that would match other things (like $, % etc.) which you may not want. Probably won't matter too much as you are typing it yourself.
#14
alright almost there with the spellup script, hehe last question if this works. what i have now is a variable that holds spells and multiple functions for adding to, removing from and casting the list of spells from the variable. now what i need is a way to make a temporary variable that contains what i currently have casted on myself by use of triggers n such (adding successfully casted spells to the temporary spell var), removing faded spells from the temporary spells variable and then casting everything that is not in the temporary spells variable(spells variable-temporary spells variable) on me when i type spellup. making a trigger for every msg spells give when they wear off is no problem, but knowing how to reverence members inside the temporary spell variable is kicking my butt. any help would be great, the above postings contain the spellup script i am using with the multi word input implemented and below are sample lines of fading spell messages to help you see what im looking to grab for variable manipulation. thank you

skieze

fading spells from a zmud spellup trigger:

#TRIGGER {^Your biofeedback is no longer effective.} {fadespell biofeedback}
#TRIGGER {^You feel less perceptive.} {fadespell perception}
#TRIGGER {^Your battle sense has faded.} {fadespell combat mind}
#TRIGGER {^You feel almost blind at the loss of your magical sight.} {fadespell true seeing}
#TRIGGER {^Your rage ebbs.} {fadespell frenzy}
#TRIGGER {^Your skin feels soft again.} {fadespell stone skin}
#TRIGGER {^Your metabolism reverts to its usual speed.} {fadespell sustenance}





Australia Forum Administrator #15
This sort of thing is what the new array handling in MUSHclient can be made to do.

Basically you need an array (eg. spells) that you can add or remove things to by name.

You might do this (in a script, or "send to script") ...

ArrayCreate "spells" ' make the array
ArraySet "spells", "biofeedback", "" ' add a spell
ArraySet "spells", "perception", "" ' add another

Then to remove one:

ArrayDeleteKey "spells", "biofeedback"