SRL Archive - Outdated Tutorials

[#36] DropPattern


Sir R. M8gic1an

2009-07-19 16:59:33


// * Procedure DropPattern(which: integer); // * by Rasta Magician


DropAll now calls DropPattern(0);

DropPattern:
  • 0: Randomly chooses Pattern 1 or 2
  • 1: Uses Pattern 1
  • 2: Uses Pattern 2
  • 3: Uses DropArray, meaning completly Random
  • All pattern have a 50% chance of being Reversed

I have added this as it seems much more human like to drop according to a pattern rather than complete randomness. If someone wishes to use complete randomness they can always call DropPattern(3);

Lots o' Love
SRL Dev Team

Richard

2009-07-19 17:03:02

When posting these new SRL functions, can you post the source as well? So we don't have to look through the SVN.

Good job btw :)

Sir R. M8gic1an

2009-07-19 17:07:38

Nice Idea, Source shall be posted on 2nd post from now on :)


{*******************************************************************************
Procedure DropPattern(which: integer);
By: Rasta Magician
Description: Drops all items in inventory according to pattern which.
*******************************************************************************}
Procedure DropPattern(which: integer);
var
Col, a, i: integer;
Arr: TIntegerArray;
Turn: boolean;
begin
SetLength(Arr, 28);
a := 0;
if which = 0 then
which := Random(2)+1; //ignores complete randomness, unless scripter chooses to use it

writeln('Dropping by pattern: '+IntToStr(which));
case which of
1:
//up to down
for Col := 1 to 4 do
if InIntArray([2, 4], Col) then
begin
for i := 6 Downto 0 do
begin
Arr[a] := Col + i*4;
Inc(a);
end;
end else
for i := 0 to 6 do
begin
Arr[a] := Col + i*4;
Inc(a);
end;
2:
//snake
repeat
if not Turn then
begin
for i:= 1 to 4 do
Arr[a+i-1] := a + i;
IncEx(a, 4);
Turn := true;
end else begin
for i:= 4 Downto 1 do
Arr[a-i+4] := a + i;
IncEx(a, 4);
Turn := false;
end;
until(a >= 28);
3: begin
DropArray([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]);
exit;
end;
end;

if Random(2) = 1 then
InvertTIA(Arr);

Gametab(tab_inv);
for i:= 0 to 27 do //27 = High(Arr)
DropItem(Arr[i]);
end;

~RM

ZephyrsFury

2009-07-19 18:02:12

What about having then move downward in each column. Its faster because you don't have to move the mouse very far with each drop. Also left to right like how DropAll does it atm.

EvilChicken!

2009-07-19 18:03:36

I thought about this a long time ago; I agree – this actually does seem more humanlike.

GJ, RM.
Rep+.

noidea

2009-07-19 20:13:28

Great idea :D
Nice job

mormonman

2009-07-19 21:20:58

Which way does the snake go? like this?

------>
<-----

Shuttleu

2009-07-19 21:57:16

add this one
for a:=0 to 27 do
Arr[a]:= a;
its the way i have always done it

~shut

Floor66

2009-07-19 23:23:26

What about the player has an option to fill in a TIntegerArray in order of which they want to drop?
So DropPattern([1, 5, 9, etc]);

ZaSz

2009-07-19 23:43:50

Ima edit for clickpattern(option). If option = '' then just left clicks.

marpis

2009-07-19 23:49:13

From: Floor66
What about the player has an option to fill in a TIntegerArray in order of which they want to drop?
So DropPattern([1, 5, 9, etc]);


so if you wanna go snake style, you'd have to do

DropPattern([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]);

??

Floor66

2009-07-19 23:50:30

Well.. yeah. I mean we could make a few preset TIntegerArrays, but the point is that you could customize stuff.

Richard

2009-07-20 00:05:59

From: marpis
so if you wanna go snake style, you'd have to do

DropPattern([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]);

??


DropPattern([1..28]) may save some typing.

Boreas

2009-07-20 00:34:05

From: ZephyrsFury
What about having then move downward in each column. Its faster because you don't have to move the mouse very far with each drop.


+1 That's how I did it. This reminds me of a thread from a couple years ago, maybe I'll find it.