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, confirm your email, resolve issues, 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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Variables

Variables

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


Posted by Hathcock   (49 posts)  Bio
Date Sun 28 Dec 2003 02:57 AM (UTC)
Message
Ok, I've tried to figure this out and yet again I'm lost.....can someone tell me step-by-step how to set up a variable.....I hope it's a variable I'm looking for...I have many pipes aliases and triggers that affect certain pipes based on ID#s, I was looking to make a variable so that when I switch to another character I can just type in the right variable and it will switch all the pipes in the aliases and triggers so that they affect the new pipes. Maybe it can't be done, I'm not sure.....but if it can, I'd appreciate the help. I looked in the variables sections here and I'm still lost, so that didn't help
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 29 Dec 2003 05:17 AM (UTC)
Message
You can set up a variable very easily by going to the world configuration screen and scrolling down to the last item - variables (Scripting -> Variables).

Click "Add" and then type a name (eg. "pipe") and the contents (eg. "1234").

Then in your alias or trigger you can expand that variable. eg. an alias might say "fill @pipe".

Check the "Expand Variables" checkbox, and the contents of the pipe variable will replace @pipe.

You can make an alias to change the variable quickly. eg.

Match: newpipe *
Send: %1
Send to: Variable
Variable: pipe

- Nick Gammon

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

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #2 on Mon 29 Dec 2003 09:04 AM (UTC)
Message
If you are looking for a fast way to switch what every pipe does when you switch characters you *might* be able to use an if check or switch in the script to determine which pipes each character uses. It's not gonna be fast or pretty to code a fullscale switch routine that reworks whole pipe sets though and may not even be practical depending what scripting language you're using. Now that I think on that idea a bit more you could probably use a main script to call subscripts based on which character is being played and use Nick's example for how to store which char you're using. Still not fast or pretty but easier than trying to code something to automagically switch the pipes when you switch characters.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by Firgin   (15 posts)  Bio
Date Reply #3 on Tue 16 Mar 2004 12:36 PM (UTC)
Message
Hey again.. Im having the same problem, I have a variable called "axe1" I dont have it in any script or anything, just in the variable box.. and then I have loads with envenom alises, and when I get new axes, I want to just change the axe1 variable, I tried to make a alias "envenom @axe1 with (venom) but it wont work, anyone know why?
thanks
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #4 on Wed 17 Mar 2004 02:30 AM (UTC)
Message
Seems to work for me. Did you check the "expand variables" check box?

- Nick Gammon

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

Posted by Dubthach   (47 posts)  Bio
Date Reply #5 on Wed 17 Mar 2004 02:57 PM (UTC)
Message
I didn't know that Send to: Variable thing. Handy.

It would be nice, however, to have a common syntax in the command box to assign variables without resorting to perl, JS, etc.

@pipe = %1
@tobacco = %2
...and so on

explicitly, instead of having to do it with a Send to.

If this is already possible, great.

Dub
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Wed 17 Mar 2004 08:20 PM (UTC)
Message
If you want to set multiple variables in a trigger or alias, use "send to script" and put in a couple of lines like this:


SetVariable "pipe", "%1"
SetVariable "tobacco", "%2"


That is not much more work than what you suggested.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


27,083 views.

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.