How to create a loop in js for counting

Need help with your JScripts? Got questions concerning the DFNs? Come forward, step inside :)
Post Reply
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

How to create a loop in js for counting

Post by dragon slayer »

    //count how many ids.
    var myArray = [0x13bb, 0x13be]
    for (var i = 0; i < myArray.length; i++)
    {
        pUser.SysMessage( '%d:', myArray[i] ); //says both of my ids
    }

    var index = i % 10;
    pUser.SysMessage( '%d:', index ); // number of ids = 2
This will count how many items are in my loop
Post Reply