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
➜ If/Then/Else trigger troubles
If/Then/Else trigger troubles
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| RalenthNaelore
(3 posts) Bio
|
Date
| Tue 31 Jul 2018 06:10 PM (UTC) |
Message
| So I'm getting this error
"Compile error
World: The Lost Fates
Immediate execution
[string "Trigger: "]:1: '=' expected near 'A'"
From this:
If %1 == "a skeletal rat" Then send("skin corpse")
Elseif send("search corpse")
End
And I do have my send to set to be Script. I'm not sure what exactly I've done wrong here. I've made some progress I think, as it's now picking up the first word, rather than the last. However, I can't seem to figure out what I'm doing wrong despite reading extensively over the last couple of days on LUA and here in the forums. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Tue 31 Jul 2018 08:24 PM (UTC) |
Message
| Lua is case-sensitive. It is "if" not "If" and so on. Like this:
if "%1" == "a skeletal rat" then
Send("skin corpse")
else
Send("search corpse")
end
(Also it is "Send" not "send"). Check the documenatation for the capitalization.
Also see:
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| RalenthNaelore
(3 posts) Bio
|
Date
| Reply #2 on Wed 01 Aug 2018 01:03 PM (UTC) |
Message
| Ah, super! I don't know how I didn't run across those files before. That's the sort of thing that I was looking for and couldn't find! And thanks for correcting my trigger - I had originally had them lower case and then switched them because I remembered seeing that they were case sensitive but I didn't know which way was the correct one and I couldn't get them working. | Top |
|
Posted by
| RalenthNaelore
(3 posts) Bio
|
Date
| Reply #3 on Wed 01 Aug 2018 04:50 PM (UTC) |
Message
| So I've been refining this a little bit, and I've managed to tidy up all the problems with compiling, but now the trigger isn't firing at all, and I'm not exactly sure what I've done wrong.
DoAfter (3, "if '%2' == 'skeletal rat' then Send('skin corpse') else Send('search corpse') end")
Shouldn't this fire off my comparison after three seconds? (To allow for roundtime to expire if I hit the last blow) | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #4 on Wed 01 Aug 2018 08:54 PM (UTC) |
Message
| You want DoAfterSpecial (so you can send script commands). But would this be simpler?
if '%2' == 'skeletal rat' then
DoAfter (3, 'skin corpse')
else
DoAfter (3, 'search corpse')
end -- if
That moves the if tests to the trigger which makes it simpler, and lets you do a simple DoAfter (which sends direct to the MUD).
|
- 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.
15,291 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top