Jump to content
Ranqers

How can I use a variable in a Function/Procedure

Recommended Posts

You can probably do this with arrays or something, but i'm using 7y constants and 4x constants to make a 7by5 rectangle (28 slots)

 

const

1y = 231;

2y = 266;

3y = 301;

4y = 336;

5y = 371;

6y = 406;

7y = 441;

1x = 587;

2x = 628;

3x = 667;

4x = 709;

 

I want to use these in a function/procedure, like this kinda:

procedure dropRow(i: Var);

begin

mmouse(1x,i,false);

wait(50);

mmouse(1x,i-45,true);

wait(100);

.... all the way to

mmouse(4x,i,false);

wait(50);

mmouse(1x,i-45,true);

wait(100);

end;

 

somehow I need var: i to equal 1-7y;

 

if theres an easier way please do say! thanks

Link to comment
Share on other sites

Hey ranqers, could you give me image examples at what you are trying to do? I am slightly confused.. Are you trying to simply go with the procedure from first slot to last slot or what? :P

 

If you are familiar with arrays, then you could use [TPA|TBA]Grid() from HERE (check out the uppit link - grid_stuff.zip, contains some examples how those functions can be used). ;) However, if you aren't familiar with arrays.. I HIGHLY recommend learning arrays. :)

I am pretty sure those functions would help you out.

Link to comment
Share on other sites

how could i do something like this

var droprow1 = [{x:45, y:64}, {x:56, y:98}, {x:23, y:44} {x:25, y:56}]; //not the actual x's and y's

var len = droprow1.length;

for(var i = 0; i < len; i++)

begin

MoveMouse(droprow1.x,droprow1.y);

Wait(150);

ClickMouse(droprow1.x,droprow1..y,True);

Wait(1000);

ClickMouse(droprow1.x,droprow1.+45.y,False); //i'd change this to a "drop" option dtm for better accuracy later.

end;

Link to comment
Share on other sites

Knowing what game / a pic would be so helpful. LordJashin is right: figuring out how to calc the x/y of a slot position would make things easier in the end.

 

If you insist on hard wiring in the coordinates I'd do something like this (coordinates are made up obviously):

 

[sCAR]program New;

 

var

ItemSlots: T2DPointArray;

 

procedure SetupSlots;

begin

ItemSlots := [

// Row 0, Col 0 Row 0, Col 1 Row 0, Col 2 Row 0, Col 3

TPointArray([Point(100, 100), Point(200, 100), Point(300, 100), Point(400, 100)]),

// Row 1, Col 0 Row 1, Col 1 Row 1, Col 2 Row 0, Col 3

TPointArray([Point(100, 200), Point(200, 200), Point(300, 200), Point(400, 200)])

];

end;

 

procedure DropRow(const Row: Integer);

var

Col: Integer;

begin

for Col := 0 to High(ItemSlots[Row]) do

begin

ClickMouse(ItemSlots[Row][Col].X, ItemSlots[Row][Col].Y, mbLeft);

Wait(50);

end;

end;

 

begin

SetupSlots;

 

// Drop 1st row (arrays count from 0)

DropRow(0);

end.[/sCAR]

 

This is not great code: no randomization etc. but you get the idea.

Edited by Bixby Sayz
Link to comment
Share on other sites

SOLVED.

ILOVEYOUBIXBY

 

THANKS for ALL the help guys.

 

- - - Updated - - -

 

Hey ranqers, could you give me image examples at what you are trying to do? I am slightly confused.. Are you trying to simply go with the procedure from first slot to last slot or what? :P

 

If you are familiar with arrays, then you could use [TPA|TBA]Grid() from HERE (check out the uppit link - grid_stuff.zip, contains some examples how those functions can be used). ;) However, if you aren't familiar with arrays.. I HIGHLY recommend learning arrays. :)

I am pretty sure those functions would help you out.

 

I wish I could say I understand how these functions work, thanks though!

Edited by Ranqers
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...