Jump to content

Photo

Can I successfully have more than one working while loops


  • Please log in to reply
3 replies to this topic

#1 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 03 September 2018 - 05:50 AM

As long as Waitframe(); is properly placed, whether it be an item script or global script or ffc script?



^ Including while in another while loop?

#2 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 03 September 2018 - 09:19 AM

Not in an item script, as item scripts only run for one frame; if you call Waitframe(); in an item script, the script ends.

Edited by venrob, 03 September 2018 - 09:19 AM.


#3 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 03 September 2018 - 12:09 PM

That is correct. However, it is possible to call another script from an item script if you really need to.



#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 04 September 2018 - 03:35 AM

You can nest loops.

while(cond_a)
{
    while(cond_b)
    {
        //
    }
}

Clarification: You can use while/for/do loops in item scripts, but the entire loop must run during one frame. A call to Waitframe() will prematurely end the script.

 

 

You obviously cannot have concurrently-running loops in the same script, only nested, or consecutive.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users