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
➜ Lua
➜ Lua Script variables
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Errigour
USA (32 posts) Bio
|
Date
| Mon 18 Jul 2011 03:43 PM (UTC) |
Message
| I want the following code to use i inside the "" qoute marks instead of i.
for i= 1, 7 do
AddAlias("", "i", "cast '@castingspell' @target", alias_flag.Enabled, alias_flag.eExpandVariables, "")
end
| Top |
|
Posted by
| Errigour
USA (32 posts) Bio
|
Date
| Reply #1 on Mon 18 Jul 2011 03:49 PM (UTC) |
Message
| I also want to use AddAlias with more then one flag etc alias_flag.Enabled and alias_flag.eExpandVariables | Top |
|
Posted by
| Errigour
USA (32 posts) Bio
|
Date
| Reply #2 on Mon 18 Jul 2011 05:21 PM (UTC) |
Message
| I also wanna ask one more question here if it's ok.
I want to make an alias
heal *
and if %1 is a number then I want it
to execute a for loop and if %1 is
a word/character then I want it to
execute normaly | Top |
|
Posted by
| Fiendish
USA (2,534 posts) Bio
Global Moderator |
Date
| Reply #3 on Mon 18 Jul 2011 06:28 PM (UTC) Amended on Mon 18 Jul 2011 06:29 PM (UTC) by Fiendish
|
Message
| In reverse order...
if tonumber("%1") then
-- do stuff here if %1 is a number
else
-- do stuff here if %1 is not a number
end
Flags are just magic numbers staggered in such a way that they can be added together. So add them together.
I don't understand your question. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #4 on Mon 18 Jul 2011 08:33 PM (UTC) |
Message
| |
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #5 on Mon 18 Jul 2011 08:49 PM (UTC) Amended on Mon 18 Jul 2011 08:50 PM (UTC) by Nick Gammon
|
Message
|
Errigour said:
I also want to use AddAlias with more then one flag etc alias_flag.Enabled and alias_flag.eExpandVariables
You might find addxml easier to use:
http://www.gammon.com.au/forum/?id=7123
eg.
require "addxml"
addxml.alias {
match = "k",
enabled = true,
expand_variables = true,
send = "kick @target",
sequence = 100,
}
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Errigour
USA (32 posts) Bio
|
Date
| Reply #6 on Fri 22 Jul 2011 11:18 AM (UTC) |
Message
|
alias:heal *
if tonumber("%1") then
if %1 > 0 then
for i = 1, %1 do
Send("heal heal")
end
end
else
Note("heal")
end
I used the code above and when I just type heal it would send
heal to to mud instead of sending Note("heal"). and if I typed heal with a space "heal " or "heal " it sends an error
message my way.
[string "Alias: "]:2: unexpected symbol near '>'
I want to send Send("heal %1") if %1 is a space or a character and it seems to me tonumber recognizes that %1 is a number even if its an empty space.
MUSHclient
It ignores the command all together if I type heal without an argument also and it works if its a character but not
when it's a blank space. So I used "heal*" to fix the ignoring script part and now it just gives me an error when I type heal by itself. I removed the if statement if %1 > 0
and i get this error when typing heal by itself.
[string "Alias: "]:2: unexpected symbol near 'do'
So The Above works accept it doesn't work when I just type heal and leave * null. Is there a better way to do what I am trying to do without sending me an error message when I type heal with a null %1 character? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #7 on Fri 22 Jul 2011 11:26 AM (UTC) Amended on Fri 22 Jul 2011 11:27 AM (UTC) by Nick Gammon
|
Message
|
Errigour said:
I used the code above and when I just type heal it would send
heal to to mud instead of sending Note("heal").
I expect that because your alias matches: heal<space><something> and typing "heal" does not have a space.
Errigour said:
... if I typed heal with a space "heal " or "heal " it sends an error message my way.
I expect that too. It replaces %1 by whatever you had after the space. So if there is nothing after the space it will have given you:
if > 0 then
for i = 1, do
Send("heal heal")
end
end
You really need to convert %1 to a number while it is in quotes. eg.
local count = tonumber ("%1")
if count then -- that is, if it is a number
for i = 1, count do
Send("heal heal")
end
else
Note ("heal")
end -- if
Also:
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Errigour
USA (32 posts) Bio
|
Date
| Reply #8 on Fri 22 Jul 2011 12:22 PM (UTC) |
Message
| Thanks I wanted to intercept Null commands from the mud
itself so that help big time and also regular that regular
expression forum helped some.
Can I ask you if there is a way to configure mush client to not ignore aliases such as "heal *" when I only type "heal"
by itself. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #9 on Sat 23 Jul 2011 12:15 AM (UTC) |
Message
| Yes, the FAQ point 50 describes exactly that. |
- 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.
26,743 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top