User Tag List

Results 1 to 10 of 10

Thread: Silver Arrow As Separate Item

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Octorok Lelouche Vi Britannia's Avatar
    Join Date
    Oct 2015
    Location
    Britannia - Area 11
    Posts
    173
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,113
    Level
    11
    vBActivity - Bars
    Lv. Percent
    46.73%
    I'll take a look when I'm off work. I'm actually quite proud if the one I wrote, it's my first successful for loop I've ever written, but I'm sure yours will work better.

    Edit

    Ok I glanced it while at work, it's a bit slow. I think I'll stick with my current, but this will come in handy when I get around to doing another quest I'm brainstorming.

    Is there a link to your shared scripts? I'd love to see more of your work since I've been teaching myself coding by looking at the library files and other scripts to see how things interact. Its how I figured out how For Loops work.
    Last edited by Lelouche Vi Britannia; 03-17-2018 at 06:21 PM. Reason: Added more stuff

  2. #2
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,765
    Level
    21
    vBActivity - Bars
    Lv. Percent
    69.86%
    For Loops

    A for loop is similar to a while loop, except that the variable on which it depends can be in the scope of the loop.

    The syntax is:
    for ( DECLARATION/ASSIGN; STATEMENT; EXPRESSION )

    Consider:

    Code:
    int x = 10;
    while ( x > 0)
    {
        --x;
        //do things
    }
    Using a for loop, you do not need a variable outside the loop (although you can still use a variable at a higher scope).

    Code:
    for (int x = 10; x > 0; --x )
    {
        //do things
    }
    That is functionally identical to the while loop.

    ZScript for loops are identical to C for loops, so, I suggest reading more on those.

    You can, as I mentioned, use an external variable, either with or without an assign in the for loop.

    Code:
    int x = 10;
    for ( x = 5; x > 0; --x) //Changes the value of 'x' to '5' as the loop begins.
    int y = 8;
    for ( ; y > 0; --y ) //Uses the existing value of y.
    That should help you get started.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social