Nested IFs, yo.

How do I make nested IFs work in MUSHCLIENT? I will be your best friend forever (but only ooc unless you're a magnagoran) if you can debug this for me.

if mask == "fain" then
SetVariable("mask","none")
mask = "none"
Send("remove mask")
Send("put mask in pack")

if greatrobe == "true" then
Send("describe self blah blah blah")
else
Send("describe self blah blah blah")
end--if

elseif mask == "pariah" then
SetVariable("mask","fain")
mask = "fain"
Send("remove mask")
Send("put mask in pack")
Send("get 87842 from pack")
Send("wear mask")

if greatrobe == "true" then
Send("describe self blah blah blah")
else
Send("describe self blah blah blah")
end--if

else
SetVariable("mask","fain")
Send("get 87842 from pack")
Send("wear mask")

if greatrobe == "true" then
Send("describe self blah blah blah")
else
Send("describe self blah blah blah")
end--if

end--if
The drone, the whistle, the thundrous sound;
It seared their eyes, it shook the ground.
One hundred thousand voices lift,
While ashes like dirty snowfall drift.

The clouds of purple glowing gas,
The tiny sun is rising fast.
Your star...
Is on the rise.

Comments

  • if mask == "fain" then
      -- first thing
    elseif mask == "pariah" then
      -- second thing
    else
      -- third thing
    end

    if greatrobe == "true" then
      -- first desc
    else
      -- second desc
    end


    If this isn't what you meant, you should ask your question another way (be more specific). Also, try putting your descriptions into a table and pulling them from there, especially if you want six of them (three masks x two outfits).

  • I was trying to nest the if function for the great robe inside the one for the mask. so something like:

    if mask == "fain" then
     -- if greatrobe == "true" then
     -----first thing
     --else
     -----second thing
     --end
    elseif mask == "pariah" then
     -- if greatrobe == "true" then
     -----third thing
     --else
     -----fourth thing
     --end
    else
     --if greatrobe = "true" then
     -----fifth thing
     --else
     -----sixth thing
     --end
    end
    The drone, the whistle, the thundrous sound;
    It seared their eyes, it shook the ground.
    One hundred thousand voices lift,
    While ashes like dirty snowfall drift.

    The clouds of purple glowing gas,
    The tiny sun is rising fast.
    Your star...
    Is on the rise.
  • descs = {
      ["fain"] = {
        ["true"] = "first thing",
        ["false"] = "second thing"
      },
      ["pariah"] = {
        ["true"] = "third thing",
        ["false"] = "fourth thing"
      },
      ["default"] = {
        ["true"] = "fifth thing",
        ["false"] = "sixth thing",
      }
    }

    Send("describe self " .. descs[mask or "default"][greatrobe or "false"])

Sign In or Register to comment.