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
➜ Perlscript
➜ variables and aliases
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| SugarAndTheSun
(7 posts) Bio
|
| Date
| Mon 30 Aug 2004 09:47 PM (UTC) |
| Message
| <aliases>
<alias
match="t"
enabled="y"
sequence="100"
>
<send>$world->SetVariable("target", " ");</send>
</alias>
</aliases>
I'm not really sure how to change a variable with an alias so I figured I'd use my new found knowledge and script it up. Would this be the correct way to go about changing it? My intent was to Type in
T RAT
and it change the target to rat. And then all my other aliases would do something like FRENZY @TARGET. | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #1 on Mon 30 Aug 2004 11:11 PM (UTC) |
| Message
| You need to change it to send to script (the send to pulldown menu).
And the alias works a little different, youll need to use a wildcard.
Match: t *
$world->SetVariable("target", "%1");
and then yes, you can use @target in other aliases/triggers (with expand variables checked). |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| SugarAndTheSun
(7 posts) Bio
|
| Date
| Reply #2 on Tue 31 Aug 2004 09:43 PM (UTC) |
| Message
| Thank you very much! Now might you have any idea on how I could do an #IF statement? Basically ZMUD does
#if(variable=x) {do this if true} {do this if false, but this part is not required}
so how about that in Perl? | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #3 on Tue 31 Aug 2004 09:46 PM (UTC) |
| Message
| if ( some_boolean_condition ) {
statement to be executed;
} else {
another statement to be executed;
}
just like the rest of perl. (MC doesnt use any special commands, it sends it to the script engine to do everything, so anything you can do in perl (with some exceptions) you can do with MC) |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| SugarAndTheSun
(7 posts) Bio
|
| Date
| Reply #4 on Tue 31 Aug 2004 09:51 PM (UTC) |
| Message
| You're just so useful, :)
Thank you so very much. I'm loving MUSH more and more, I think it definately wins the best client award. Just takes a little learning before you like it. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #5 on Sun 05 Sep 2004 05:18 AM (UTC) |
| Message
| To change variables you don't need to use scripting.
Your example could be:
Match: T *
Send: %1
Send to: variable
Variable: target
Here it is ready to be pasted into the alias window:
<aliases>
<alias
match="T *"
enabled="y"
variable="target"
send_to="9"
sequence="100"
>
<send>%1</send>
</alias>
</aliases>
|
- 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.
19,405 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top