Full Version : Random amount of reagents
xmlspawner >>Q&A >>Random amount of reagents


<< Prev | Next >>

Allmight- 08-27-2006
I am trying to spawn some random amount of regs in a chest using SETONNEARBY, but can't figure out how to use the RND command. What i have is...

SETONNEARBY,5,,lockablecontainer/ADD,0.3/<ginseng/Amount/RND{3,10}>

But i get an error. What am i doing wrong here?


ArteGordon- 08-27-2006
the string substitution brackets {} are used during the substitution pass which occurs before the entry actually gets parsed.
It evaluates whatever it finds between the brackets, and substitutes the results directly into the string.
Then, the resulting string is parsed as normal.

So this

SETONNEARBY,5,,lockablecontainer/ADD,0.3/<ginseng/Amount/{RND,3,10}>

after substitution, would end up like

SETONNEARBY,5,,lockablecontainer/ADD,0.3/<ginseng/Amount/7>

where '7' is just the random number that resulted from evaluation of RND,3,10

You could also call the ginseng constructor with an amount arg using substitution to do the same thing

SETONNEARBY,5,,lockablecontainer/ADD,0.3/ginseng,{RND,3,10}

which would give the string

SETONNEARBY,5,,lockablecontainer/ADD,0.3/ginseng,7

which would then be parsed.

Allmight- 08-27-2006
Aha, so in this case in i put the whole random function in the {}'s, i see. Thanks for your fast relply.