SRL Archive - OSR Help

Is there a random inventory slot function?


Nebula

2011-12-28 19:36:33

Basically, as an antiban I want my script to randomize which inventory slot to use for depositing. What I have now is a simple case procedure to randomize which slot it uses to deposit the items, but I feel like using hard coordinates has a safer alternative. Is there a function/procedure that can do this?

 Case (random(5)) of

0: Mouse(660, 229, 4, 4, false);
1: Mouse(576, 265, 4, 4, false);
2: Mouse(619, 265, 4, 4, false);
3: Mouse(576, 301, 4, 4, false);
4: Mouse(618, 301, 4, 4, false);


Thanks.

Kyle Undefined

2011-12-28 19:45:58

I would use:


MouseItem(Random(28), False);

YoHoJo

2011-12-28 19:46:13

Which slots would you like it to randomly go to?
Hard cores are fine as long as the rx,ry are large enough. 4,4 seems fine you can even make them like 7,7, and be good.

Nebula

2011-12-28 19:49:02

Thanks.
Can it do something like this to randomly click one slot from a set of integers?

MouseItem([3, 5, 6, 9, 10], False);


I want it to randomly choose a slot that is slot number 3, 5, 6, 9, or 10.

YoHoJo

2011-12-28 19:52:42

That will not work, but you can make an array called like RandomSlots, and choose from those.

Something like

Var RandomSlots: Array Of Integer;

SetArrayLegnth(RandomSlots, 5);
RandomSlots:=[3, 5, 6, 9, 10_;
MouseItem(RandomSlots[Random(5)], False);

^Ghetto fake example code.

Kyle Undefined

2011-12-28 19:53:51

Oh, didn't know you wanted that :p This could do it:


var
items : TIntegerArray;

items := [3, 5, 6, 9, 10];
MouseItem(items[Random(High(items))], False);

Nebula

2011-12-28 19:56:24

From: Kyle Undefined
Oh, didn't know you wanted that :p This could do it:


var
items : TIntegerArray;

items := [3, 5, 6, 9, 10];
MouseItem(items[Random(High(items))], False);


Hmm okay thanks I'll try that.