Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

What exactly does Nested IF mean?


lonewolf_kai
 Share

Recommended Posts

I just read that the number of nested IF statements used in a script is limited to 10. What exactly does Nested IF mean? I think I might've messed up my scripts. Here's and example of how mine looks:

Begin Gamemod

     If (VariableA == 1)

          NPC1.enable

     Elseif (VariableA == 2)

          NPC2.enable

     Elseif (VariableA == 3)

          NPC3.enable

     Elseif (VariableA == 4)

          NPC4.enable


     ..... all the way through


     Elseif (VariableA == 30)

          NPC30.enable

     Endif


End

I basically have 1 If and 29 ElseIf. Would I have a problem here?

Edited by lonewolf_kai
Link to comment
Share on other sites

I basically have 1 If and 29 ElseIf. Would I have a problem here?

No, that's fine. A nested if is "an if within an if", e.g.

if (something)

   if (somethineelse)

      if (yetanotherthing)

         ...

      endif

   endif

endif

It's one of them. This example is three deep; you can imagine that 10 deep would be getting pretty unreadable! As far as I'm aware, there's no (practical) limit to elseifs.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...