Help with a script!

if (playertouchsme) { lay2 itemx OR itemy,x,y; }
how to write this? ^^

Like random drop? Make a random number and use modular division on it by 2. Raise that number for different odds.

I don’t understand why you cannot figure these out on your own.

[QUOTE=Raman;113980]

if (playertouchsme) { lay2 itemx OR itemy,x,y; }
how to write this? ^^
[/QUOTE]

if ( playertouchsme ){
  this.item = ( random(0,1) > 0.5 ) ? itemID1 : itemID2;
  lay2 this.item,x,y;
}

The ternary operation is nice in this case and basically acts as an if-else. Have fun!

http://gyazo.com/78065838ba712979c50d3602ae300d89

I was trying the same ^^ but look.

[QUOTE=Raman;113997]
http://gyazo.com/78065838ba712979c50d3602ae300d89

I was trying the same ^^ but look.
[/QUOTE]

[QUOTE=commands.rtf]

lay2 itemname,x,y; lays an item to the specified position

Itemname Item Index
greenrupee 0
bluerupee 1
redrupee 2
bombs 3
darts 4
heart 5
glove1 6
bow 7
bomb 8
shield 9
sword 10
fullheart 11
superbomb 12
battleaxe 13
goldensword 14
mirrorshield 15
glove2 16
lizardshield 17
lizardsword 18
goldrupee 19
fireball 20
fireblast 21
nukeshot 22
joltbomb 23
spinattack 24

[/QUOTE]

Whoops, I was under the impression lay2 used an index instead of an actual string. I’ll leave you to fix up the code, you’ll not be able to use the ternary operation with strings though…
Btw, do you even bother reading commands.rtf?

Yep but my english isnt so good :smiley:
anyways i have the script but i thought there is one which isnt so long

If (timeout) {
This.item = int(random(1,5)) 
} timeout =0.05;

If (this.item==1) { lay goldrupee }
If (this.item==2) { lay redrupee }

Etc… :slight_smile:

Stefan’s English wasn’t all that great when he typed it up.

[QUOTE=Spooon;114000]
Stefan’s English wasn’t all that great when he typed it up.
[/QUOTE]

Didn’t beholder or somebody come out with a revised edition that was easier to understand?

[QUOTE=Raman;113999]
Yep but my english isnt so good :smiley:
anyways i have the script but i thought there is one which isnt so long

If (timeout) {
This.item = int(random(1,5)) 
} timeout =0.05;

If (this.item==1) { lay goldrupee }
If (this.item==2) { lay redrupee }

Etc… :slight_smile:
[/QUOTE]

I’d advise again the use of conditionals outside of events as they’ll lead to unpredictable outcomes.
Your script should instead look like this

if (playerenters || timeout ){
  this.item = int(random(1,5));

  If (this.item==1) { lay goldrupee }
  If (this.item==2) { lay redrupee }

  timeout = 0.05;
}

Sorted better, and has some stuff added from the newfeature documents. Btw, if you’re new to GraalScript you should read those.

http://forums.opengraal.com/showthread.php?1166-GS1-Commands-%28w-new-commands-rtf%29

also I guess you’re talking about the NSB but I like the commands.rtf in the other thread better.