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?
alias question
Posted by Brianz19 on Tue 12 Sep 2006 09:43 AM — 12 posts, 49,198 views.
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:
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"))
Or...
j *
world.send "kill %1"
world.note "Target is %1"
j *
world.send "kill %1"
world.note "Target is %1"
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
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
Lua is case-sensitive, so it would be:
For different colours, check out:
http://www.gammon.com.au/scripts/doc.php?function=ColourNote
Send "kill %1"
Note "Target is %1"
For different colours, check out:
http://www.gammon.com.au/scripts/doc.php?function=ColourNote
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!?!
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!?!
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
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
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>
Thank you everyone for help, and thanks ked that's exactly what i was looking for =]
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).well with Nick's latest answer it is somewhat lacking, such as lacking the parenthesis ()
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.
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
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
Try it, it does work, with a single string argument, but variations won't:
See:
http://www.lua.org/manual/5.0/manual.html
Section 2.5.7 - Function calls.
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 ...
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.