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.
Entire forum
➜ MUSHclient
➜ General
➜ alias question
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Brianz19
(11 posts) Bio
|
Date
| Tue 12 Sep 2006 09:43 AM (UTC) |
Message
| i have a couple alias's set for targets, so i type 'j dog' or whatever it sets one alias to kill dog, etc. but when i type j dog i want a message to show up saying target1 is dog or something to that effect. anyone know? | Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #1 on Tue 12 Sep 2006 08:58 PM (UTC) |
Message
| I don't quite understand that. If you type 'j dog' don't you know you are targetting a dog?
Anyway, if you do "send to script" in the alias, you can find the contents of variables with a small script, like this:
Note ("Target is " .. GetVariable ("target"))
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| NeoFryBoy
USA (42 posts) Bio
|
Date
| Reply #2 on Wed 13 Sep 2006 04:11 AM (UTC) |
Message
| Or...
j *
world.send "kill %1"
world.note "Target is %1" | Top |
|
Posted by
| Brianz19
(11 posts) Bio
|
Date
| Reply #3 on Wed 13 Sep 2006 05:39 AM (UTC) |
Message
| Well in the heat of things you can sometimes miss type something and i just want to be sure..i tried both of those things and they didn't work..i think my mushclient is using lua scripting if that helps.
that world.note thing that neofry boy said is exactly what im looking for though perhaps in a different color than white if at all possible. thx in advance | Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #4 on Wed 13 Sep 2006 06:01 AM (UTC) |
Message
| |
Posted by
| Brianz19
(11 posts) Bio
|
Date
| Reply #5 on Wed 13 Sep 2006 08:29 AM (UTC) Amended on Wed 13 Sep 2006 08:40 AM (UTC) by Brianz19
|
Message
| hmm..i tried that it didn't work..let me explain how my alias is set up cause that might be the problem here
so i use the numpad to move and the number 1 on numpad is set to "188"
now there are 2 alias's i have set up for just 1 of these kill alias's -->
alias : j *
send : %1
variable : target
send to : variable
and then the 2nd alias
alias : 188
send : k @target
send to : world
and it has expand variables checked.
does that change anything? i also dont want the note to be sent to the mud cause then it will waste a command ( that's what it deos when i put what you wrote in the 'send' box. also i want the message to be sent when i activate the first alias)
sorry for the trouble =[
edit: was just testing what you wrote and what is happening is when i add the note "Target is %1" it doesn't activate when i type j dog, it activates when i hit the button that actually does the kill alias which is not what i want because then it will do it every time i want to hit that target, and also it's not showing up as a world note it shows up liek this :
k dog
Note "Target is dog"
They aren't here.
* HP:Healthy MV:Fresh > Arglebargle, glop-glyf!?! | Top |
|
Posted by
| Onoitsu2
USA (248 posts) Bio
|
Date
| Reply #6 on Wed 13 Sep 2006 12:22 PM (UTC) |
Message
| well with Nick's latest answer it is somewhat lacking, such as lacking the parenthesis ()
Send("kill %1")
Note("Target is %1")
that is the full syntax, and if that does not work then you might need to turn on the scripting (Ctrl+Shift+6)
and check enable script next to the pulldown list.
Hope you can get this working properly.
Laterzzz,
Onoitsu2 | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #7 on Wed 13 Sep 2006 01:38 PM (UTC) |
Message
| You can simply replace your "j *" alias with this one. Copy the following and paste it in your Aliases dialogue.
<aliases>
<alias
match="j *"
enabled="y"
send_to="12"
sequence="100"
>
<send>world.SetVariable("target", "%1")
world.Note("Target set to: %1" )</send>
</alias>
</aliases>
| Top |
|
Posted by
| Brianz19
(11 posts) Bio
|
Date
| Reply #8 on Wed 13 Sep 2006 02:56 PM (UTC) |
Message
| Thank you everyone for help, and thanks ked that's exactly what i was looking for =] | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #9 on Wed 13 Sep 2006 03:12 PM (UTC) |
Message
|
Quote: well with Nick's latest answer it is somewhat lacking, such as lacking the parenthesis () Actually that is a special case in Lua's syntax, left over from its data description days. You may call a function that takes only a single string as an argument without parentheses, as long as it is unambigously a function call (which it is, in this case).
Personally I prefer the parentheses because I'm so used to seeing them, but you don't technically need to use them in this particular case. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Onoitsu2
USA (248 posts) Bio
|
Date
| Reply #10 on Thu 14 Sep 2006 09:28 AM (UTC) |
Message
| Well I stated that because every time I would attempt that it would complain to high heaven about missing parenthesis.
So I have never had it work without parenthesis, even on a single string argument that us unambiguous as you have stated.
I have never seen documentation on LUA where it is not using the parenthesis either, so I have ALWAYS used them, well except for my very early days of porting my scripts from VB to LUA. Boy that was a doozy of errors about missing parenthesis.
Laterzzz,
Onoitsu2 | Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #11 on Thu 14 Sep 2006 09:01 PM (UTC) |
Message
| Try it, it does work, with a single string argument, but variations won't:
print "hello" --> hello
print string.upper ("hello") --> error: '=' expected near 'string'
print "hello" .. " world" --> error: unexpected symbol near '..'
print 42 --> '=' expected near '42'
Quote:
I have never seen documentation on LUA where it is not using the parenthesis either ...
See:
http://www.lua.org/manual/5.0/manual.html
Section 2.5.7 - Function calls.
A call of the form f{...} is syntactic sugar for f({...}), that is, the argument list is a single new table. A call of the form f'...' (or f"..." or f[[...]]) is syntactic sugar for f('...'), that is, the argument list is a single literal string.
|
- 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.
34,520 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top