Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ Triggers/Aliases and variables

Triggers/Aliases and variables

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  

Posted by Happy Aeryn   (1 post)  Bio
Date Sat 01 Dec 2001 12:53 AM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,062 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 01 Dec 2001 02:52 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Elric   USA  (51 posts)  Bio
Date Reply #2 on Fri 07 Dec 2001 09:55 AM (UTC)
Message
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.

"By the pricking of my thumbs, something wicked this way comes. Open locks, whoever knocks!" MacBeth, Shakespeare
Top

Posted by Elric   USA  (51 posts)  Bio
Date Reply #3 on Fri 07 Dec 2001 09:59 AM (UTC)
Message
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?

"By the pricking of my thumbs, something wicked this way comes. Open locks, whoever knocks!" MacBeth, Shakespeare
Top

Posted by Nick Gammon   Australia  (23,062 posts)  Bio   Forum Administrator
Date Reply #4 on Sun 09 Dec 2001 05:22 AM (UTC)

Amended on Sun 09 Dec 2001 05:24 AM (UTC) by Nick Gammon

Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Elric   USA  (51 posts)  Bio
Date Reply #5 on Sun 09 Dec 2001 06:35 AM (UTC)
Message
What about Aliases? Can I make them pause as well?

"By the pricking of my thumbs, something wicked this way comes. Open locks, whoever knocks!" MacBeth, Shakespeare
Top

Posted by Elric   USA  (51 posts)  Bio
Date Reply #6 on Sun 09 Dec 2001 06:41 AM (UTC)
Message
Nevermind.. I tried it with Queue command and it worked.. This is exactly what I was hoping for... Thanks!

"By the pricking of my thumbs, something wicked this way comes. Open locks, whoever knocks!" MacBeth, Shakespeare
Top

Posted by Skieze   (6 posts)  Bio
Date Reply #7 on Wed 04 Feb 2004 12:01 AM (UTC)
Message
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
Top

Posted by Nick Gammon   Australia  (23,062 posts)  Bio   Forum Administrator
Date Reply #8 on Wed 04 Feb 2004 12:21 AM (UTC)
Message
First question, how do you know what spells are on yourself? I mean, forget scripting, how do you currently know?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Skieze   (6 posts)  Bio
Date Reply #9 on Wed 04 Feb 2004 01:18 PM (UTC)
Message
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
Top

Posted by Nick Gammon   Australia  (23,062 posts)  Bio   Forum Administrator
Date Reply #10 on Wed 04 Feb 2004 08:44 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Skieze   (6 posts)  Bio
Date Reply #11 on Thu 05 Feb 2004 02:55 AM (UTC)
Message
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
Top

Posted by Skieze   (6 posts)  Bio
Date Reply #12 on Tue 10 Feb 2004 02:15 PM (UTC)
Message
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
Top

Posted by Nick Gammon   Australia  (23,062 posts)  Bio   Forum Administrator
Date Reply #13 on Tue 10 Feb 2004 08:03 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Skieze   (6 posts)  Bio
Date Reply #14 on Mon 29 Mar 2004 10:12 PM (UTC)
Message
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}





Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


45,761 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.