Setarray

From Hercules Wiki
Revision as of 19:09, 23 June 2013 by Neqste (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Syntax

  • setarray <array name>[<first value>],<value>{,<value>...<value>};

Description

This command will allow you to quickly fill up an array in one go. Check the Kafra scripts in the distribution to see this used a lot.

First value is the index of the first element of the array to alter.

Examples

    [[setarray]] .@array[0],200,200,200;
    [[setarray]] .@array[1],300,150;
    // will produce:
    // .@array[0]=200
    // .@array[1]=300
    // .@array[2]=150


String Array

setarray @array$[0],"word1","word2","word3","word4";
// will produce:
// @array$[0] = word1
// @array$[1] = word2
// @array$[2] = word3
// @array$[3] = word4
// Example
 setarray .@maps$[0],"guild_vs1","guild_vs2";
 if(class < 10) {warp .@maps$[1],0,0; }
 if(class > 10) {warp .@maps$[2],0,0; }