Ok. I have a TIntegerArray, is there any way I can have it in a For..To..Do loop from the first integer to the last in order? I did a quick look through the WizzyPlugin, nothing caught my eye...help?
Ok. I have a TIntegerArray, is there any way I can have it in a For..To..Do loop from the first integer to the last in order? I did a quick look through the WizzyPlugin, nothing caught my eye...help?
NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN
k ill explain what i'm trying to do.
im making a dropping procedure for my script.
i have a few TIntegerArrays:
Each integer representing an InvBox. I tryed this:SCAR Code:WayDrop1 := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28];
WayDrop2 := [1, 5, 9, 13, 17, 21, 25, 2, 6, 10, 14, 18, 22, 26, 3, 7, 11, 15,
19, 23, 27, 4, 8, 12, 16, 20, 24, 28];
WayDrop3 := [1, 5, 9, 13, 17, 21, 25, 26, 22, 18, 14, 10, 6, 2, 3, 7, 11, 15,
19, 23, 27, 28, 24, 20, 16, 12, 8, 4];
WayDrop4 := [4, 3, 8, 2, 7, 12, 1, 6, 11, 16, 5, 10, 15, 20, 9, 14, 19, 24, 13,
18, 23, 28, 17, 22, 27, 21, 26, 25];
WayDrop5 := [4, 2, 7, 12, 5, 10, 15, 20, 13, 18, 23, 28, 21, 26, 25, 17, 22,
27, 9, 14, 19, 24, 1, 6, 11, 16, 3, 8];
andSCAR Code:Case Random(5) Of
0: Begin
L := Low(WayDrop1);
H := High(WayDrop1);
End;
1: Begin
L := Low(WayDrop2);
H := High(WayDrop2);
End;
2: Begin
L := Low(WayDrop3);
H := High(WayDrop3);
End;
3: Begin
L := Low(WayDrop4);
H := High(WayDrop4);
End;
4: Begin
L := Low(WayDrop5);
H := High(WayDrop5);
End;
End;
but it does it in order from the first to the last (eg, if the array starts with 4 and ends with 8, it does 4, 5, 6, 7, 8 instead of 4, 2, 7, 12, 5, 10, 15, 20, 13, 18, 23, 28, 21, 26, 25, 17, 22, 27, 9, 14, 19, 24, 1, 6, 11, 16, 3, 8)SCAR Code:For I := L To H Do
(these have a distinct pattern when dropped on a side note)
Last edited by Bionicle; 01-30-2010 at 12:37 AM.
NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN
SCAR Code:case Random(5) of
0: WayDrop := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28];
1: WayDrop := [1, 5, 9, 13, 17, 21, 25, 2, 6, 10, 14, 18, 22, 26, 3, 7, 11, 15,
19, 23, 27, 4, 8, 12, 16, 20, 24, 28];
2: WayDrop := [1, 5, 9, 13, 17, 21, 25, 26, 22, 18, 14, 10, 6, 2, 3, 7, 11, 15,
19, 23, 27, 28, 24, 20, 16, 12, 8, 4];
3: WayDrop := [4, 3, 8, 2, 7, 12, 1, 6, 11, 16, 5, 10, 15, 20, 9, 14, 19, 24, 13,
18, 23, 28, 17, 22, 27, 21, 26, 25];
4: WayDrop := [4, 2, 7, 12, 5, 10, 15, 20, 13, 18, 23, 28, 21, 26, 25, 17, 22,
27, 9, 14, 19, 24, 1, 6, 11, 16, 3, 8];
end;
Much easier IMO, even better ways to do it than that even... this one is pretty suited for your use though. I think SRL has drop patterns though you could use... not entirely sure about that one...
Yes it does, but i ask you this. if everyone uses these drop patterns in their script, it would seem kind of suspicious, don't you think?
Anyway, thanks, I got it working(well compiled, testing it now)
I'd rep you, but it says i need to spread some around first :/
E: Yep, all five patterns work flawlessly, Thanks![]()
Last edited by Bionicle; 01-30-2010 at 01:03 AM.
NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN
True, in-case you feel like being OCD:
SCAR Code:var
WayDrop: array [0..4] of TIntegerArray;
Index, I: Byte;
begin
WayDrop[0] := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28];
WayDrop[1] := [1, 5, 9, 13, 17, 21, 25, 2, 6, 10, 14, 18, 22, 26, 3, 7, 11, 15,
19, 23, 27, 4, 8, 12, 16, 20, 24, 28];
WayDrop[2] := [1, 5, 9, 13, 17, 21, 25, 26, 22, 18, 14, 10, 6, 2, 3, 7, 11, 15,
19, 23, 27, 28, 24, 20, 16, 12, 8, 4];
WayDrop[3] := [4, 3, 8, 2, 7, 12, 1, 6, 11, 16, 5, 10, 15, 20, 9, 14, 19, 24, 13,
18, 23, 28, 17, 22, 27, 21, 26, 25];
WayDrop[4] := [4, 2, 7, 12, 5, 10, 15, 20, 13, 18, 23, 28, 21, 26, 25, 17, 22,
27, 9, 14, 19, 24, 1, 6, 11, 16, 3, 8];
Index := Random(5);
for I := 0 to High(WayDrop[Index]) do
WriteLn(WayDrop[Index][I]);
end.
Or just plain stupid like me:
SCAR Code:function IArr(IA: TIntegerArray): TIntegerArray;
begin
Result := IA;
end;
var
WayDrop: T2DIntegerArray;
Index, I: Byte;
begin
WayDrop := [IArr([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28]), IArr([1, 5, 9, 13, 17, 21, 25, 2,
6, 10, 14, 18, 22, 26, 3, 7, 11, 15, 19, 23, 27, 4, 8, 12, 16, 20, 24,
28]), IArr([1, 5, 9, 13, 17, 21, 25, 26, 22, 18, 14, 10, 6, 2, 3, 7, 11,
15, 19, 23, 27, 28, 24, 20, 16, 12, 8, 4]), IArr([4, 3, 8, 2, 7, 12, 1,
6, 11, 16, 5, 10, 15, 20, 9, 14, 19, 24, 13, 18, 23, 28, 17, 22, 27, 21,
26, 25]), IArr([4, 2, 7, 12, 5, 10, 15, 20, 13, 18, 23, 28, 21, 26, 25,
17, 22, 27, 9, 14, 19, 24, 1, 6, 11, 16, 3, 8])];
Index := Random(Length(WayDrop));
for I := 0 to High(WayDrop[Index]) do
WriteLn(WayDrop[Index][I]);
end.
Maybe some math rhythm?... but I'm too lazy :-P
Last edited by Wanted; 01-30-2010 at 01:11 AM.
Actually i simply did:
SCAR Code:Begin
If Not LoggedIn Then
Exit;
If Not GameTab(Tab_Inv) Then
GameTab(Tab_Inv);
Case Random(5) Of
0: WayDrop := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28];
1: WayDrop := [1, 5, 9, 13, 17, 21, 25, 2, 6, 10, 14, 18, 22, 26, 3, 7, 11, 15,
19, 23, 27, 4, 8, 12, 16, 20, 24, 28];
2: WayDrop := [1, 5, 9, 13, 17, 21, 25, 26, 22, 18, 14, 10, 6, 2, 3, 7, 11, 15,
19, 23, 27, 28, 24, 20, 16, 12, 8, 4];
3: WayDrop := [4, 3, 8, 2, 7, 12, 1, 6, 11, 16, 5, 10, 15, 20, 9, 14, 19, 24, 13,
18, 23, 28, 17, 22, 27, 21, 26, 25];
4: WayDrop := [4, 2, 7, 12, 5, 10, 15, 20, 13, 18, 23, 28, 21, 26, 25, 17, 22,
27, 9, 14, 19, 24, 1, 6, 11, 16, 3, 8];
End;
For I := 0 To 27 Do
Begin
LogInv := InvBox(WayDrop[I]);
If FindDTM(Log, X, Y, LogInv.X1, LogInv.Y1, LogInV.X2, LogInv.Y2) Then
Begin
//all the dropping stuff
The overall procedure works really well...in fact i think it is better then the SRL drop, as it detects whether it was dropped or not, and if that fails, drops any excess items after the rest have been dropped.
E: I accidentally had Case 4 Of instead of Case Random(5) Of, as I was testing the fourth dropping algorithm![]()
Last edited by Bionicle; 01-30-2010 at 01:48 AM.
NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN
You do not need the IArr function..you can just use:
SCAR Code:var
WayDrop: T2DIntegerArray;
Index, I: Byte;
begin
WayDrop := [TIntegerArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28]), TIntegerArray([1, 5, 9, 13, 17, 21, 25, 2,
6, 10, 14, 18, 22, 26, 3, 7, 11, 15, 19, 23, 27, 4, 8, 12, 16, 20, 24,
28]), TIntegerArray([1, 5, 9, 13, 17, 21, 25, 26, 22, 18, 14, 10, 6, 2, 3, 7, 11,
15, 19, 23, 27, 28, 24, 20, 16, 12, 8, 4]), TIntegerArray([4, 3, 8, 2, 7, 12, 1,
6, 11, 16, 5, 10, 15, 20, 9, 14, 19, 24, 13, 18, 23, 28, 17, 22, 27, 21,
26, 25]), TIntegerArray([4, 2, 7, 12, 5, 10, 15, 20, 13, 18, 23, 28, 21, 26, 25,
17, 22, 27, 9, 14, 19, 24, 1, 6, 11, 16, 3, 8])];
Index := Random(Length(WayDrop));
for I := 0 to High(WayDrop[Index]) do
WriteLn(WayDrop[Index][I]);
end.
Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
Originally Posted by #srl
"A programmer is just a tool which converts caffeine into code"
You may contact me with any concerns you have.
Are you a victim of harassment? Please notify me or any other staff member.
| SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |
There are currently 1 users browsing this thread. (0 members and 1 guests)