Register forum user name Search FAQ

Gammon Forum

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 ➜ General ➜ Please help, been trying to figure this out for a few hours now :(

Please help, been trying to figure this out for a few hours now :(

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by AaronM86   (42 posts)  Bio
Date Reply #15 on Tue 30 Mar 2010 12:40 AM (UTC)
Message
Another question popped into my mind lol, kind of pertains to this same subject. Is it possible to do 2 ifs in the same trigger? For instance:

if string.lower("%1") == "self" then
world.Send("say Not going to happen")
if string.lower("%1") == "terkal" then
world.Send("say Not going to happen")
else
world.Send("cast %2 %1")
end
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #16 on Tue 30 Mar 2010 12:48 AM (UTC)
Message
What language is this? Lua?

You can do it with elseif, eg.


if string.lower("%1") == "self" then
  Send ("say Not going to happen")
elseif string.lower("%1") == "terkal" then
  Send("say Not going to happen")
else
  Send("cast %2 %1")
end


If you have a lot of them, you could use a table, eg.


not_going_to = {
  self = true,
  terkal = true,
  nick = true,
  twisol = true,
-- add more here
  }

if not_going_to [string.lower ("%1")] then
  Send("say Not going to happen")
else
  Send("cast %2 %1")
end


That indexes into the table with the word converted to lower-case. If it matches you say "not going to happen". If not, you do it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by AaronM86   (42 posts)  Bio
Date Reply #17 on Tue 30 Mar 2010 12:57 AM (UTC)
Message
Yes, Lua. :) And thank you both once again lol. I'm going to also store all of these set ups in an notepad so I can try to assemble these as best I can on my own in the future. I feel bad pestering with miniscule things lol, I do try to figure it out on my own before I post, just to let you know :) Regardless, thanks!
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.


61,264 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.