[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  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] Refresh page


Pages: 1  2 

Posted by AaronM86   (42 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] 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
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] 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!
[Go to top] 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.


43,635 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] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]