SRL Archive - OSR Help

clicking inventory & walking


grats

2011-05-05 18:38:37

HI I was wondering how do I click a random spot in the inventory? I wasn't able to get anything working idk what I'm doing xD


also how would I walk to a spot? visible on the mini map with just 1 click

no reflection please


also is there something to open doors?

thanks

Yago

2011-05-05 18:40:38

From: grats
HI I was wondering how do I click a random spot in the inventory? I wasn't able to get anything working idk what I'm doing xD


Do you mean a specific item?


also how would I walk to a spot? visible on the mini map with just 1 click

no reflection please


Try SPS. http://villavu.com/forum/showthread.php?t=62286

also is there something to open doors?

thanks


you probably have to use color finders and stuff.

grats

2011-05-05 18:43:35

No just anywhere in the inventory because it is going to be a full inventory.. so if it can click any item in there

and yea I know SPS but I was wondering if there was a way to just add it myself since it's just 1 spot over? just like something that clicks on a spot on the map.. I could use webwalk or SPS but that would require people to get those :P if not I'll just use SPS

KingKong

2011-05-05 18:47:53

use mousebox for random clicking in inventory, and for the minimap, you could use tpa's/ dtms

HarryJames

2011-05-05 18:50:25

MouseItem(Random(28), True);
That'll left click a random inventory space.

If you wanted to click a random one which has a certain item, you'd have to search for all of the DTMs for the items required, and store each one in an array.

Then you just do the same as above, but instead of Random(28) just simply put;
MouseItem(TheArrayFromDTMsearching[Random(27)], True);

Blumblebee

2011-05-05 18:50:54

Inventory:


I := RandomRange(1, 28);
MouseItem(I, True);

Walking:

Either use a simple TPA or (D)DTM. SPS is an option too (never used it but heard it's good)

For opening doors check the includes there was something in misc I'm pretty sure although again a simple TPA would not be that difficult either.

grats

2011-05-05 19:23:00

From: HarryJames
MouseItem(Random(28), True);
That'll left click a random inventory space.

If you wanted to click a random one which has a certain item, you'd have to search for all of the DTMs for the items required, and store each one in an array.

Then you just do the same as above, but instead of Random(28) just simply put;
MouseItem(TheArrayFromDTMsearching[Random(27)], True);


Alright thanks, I'll test that out when I get home, I didn't know how to use mouseitem correctly :P

From: Blumblebee
Inventory:


I := RandomRange(1, 28);
MouseItem(I, True);

Walking:

Either use a simple TPA or (D)DTM. SPS is an option too (never used it but heard it's good)

For opening doors check the includes there was something in misc I'm pretty sure although again a simple TPA would not be that difficult either.


The problem with the TPA was there are a lot of the same colors around there.. I was going to use one to walk to the bank but if I used it to walk to the other place it would be clicking lots of different places lol

I'll check out SPS if anything I can use webwalk which just goes to the point



thank you guys

Yago

2011-05-05 20:10:08

From: Iamadam
If the interacting index is < 32768, then its an npc.
If >, then you subtract 32768 to get the index of the player.
(To the best of my recollection that is :P)


Um wrong thread right? You meant the script idea thread?

Iamadam

2011-05-05 20:31:45

Haha yes, yes I did.
There's the problem with multiple tabs & lack of sleep.
/removes.

Now I feel I need to be useful in this post:

You can use minimap symbols to help with walking too - if there are any in the area you are working on.

NCDS

2011-05-05 21:29:56

From: grats

The problem with the TPA was there are a lot of the same colors around there.. I was going to use one to walk to the bank but if I used it to walk to the other place it would be clicking lots of different places lol


Sort your points! That's the fun part of using Color to complete your tasks. Check for min/max counts, split into an ATPA and check the size, have fun with it! :)

grats

2011-05-05 23:36:05

From: NCDS
Sort your points! That's the fun part of using Color to complete your tasks. Check for min/max counts, split into an ATPA and check the size, have fun with it! :)


You honestly completely lost me lol I don't know much

From: Iamadam
Haha yes, yes I did.
There's the problem with multiple tabs & lack of sleep.
/removes.

Now I feel I need to be useful in this post:

You can use minimap symbols to help with walking too - if there are any in the area you are working on.


Is there something that actually finds that symbol? because yea there are symbols

Yago

2011-05-05 23:52:45

From: grats

Is there something that actually finds that symbol? because yea there are symbols


Check out find symbol and functions like it.

Iamadam

2011-05-05 23:56:48

{*******************************************************************************
function FindSymbol(var rx, ry: Integer; Name: String): Boolean;
By: Stupid3ooo
Description: Finds a minimap Symbol and returns a Boolean if True.
Searches the whole Minimap
*******************************************************************************}
Returns symbol location in rx and ry

grats

2011-05-06 00:01:42

From: Iamadam
{*******************************************************************************
function FindSymbol(var rx, ry: Integer; Name: String): Boolean;
By: Stupid3ooo
Description: Finds a minimap Symbol and returns a Boolean if True.
Searches the whole Minimap
*******************************************************************************}
Returns symbol location in rx and ry


sweet thanks

will make getting to the bank real ez hopefully



is there something to click these?


I'm out for the night but thanks for the help, almost done with my first script that actually doesn't need someone doing some part of it manually xD

enoyhs

2011-05-06 00:40:57

From: grats

is there something to click these?


You can use hard-coded box of coordinates as the box wouldn't change position.
Also to be more sure you can use bitmap or DTM searching. Or even simple color search.

Also note there are constants in Globals.scar, that define chat box: MCX1, MCX2, MCY1, MCY2 or simply MCBox.

Yago

2011-05-06 15:32:59

Function FindTextWrap(var cx, cy: Integer; txt, font: string; xs, ys, xe, ye: Integer): Boolean;

begin
Result := FindText(cx, cy, txt, font, xs, ys, xe, ye);
end;

Function R_FindChatButton: Boolean;

var
A, B: Integer;
Param1, Param2: TVariantArray;

begin
RawDTM := DTMFromString(Players[CurrentPlayer].Strings[3]);
Param1 := [RawDTM, A, B, 230, 395, 290, 455];
Param2 := [A, B, 'Raw' + Players[CurrentPlayer].Strings[1], 'StatChars', 230, 395, 290, 455];
Result := WaitFuncEx('FindDTMWrap', Param1, RandomRange(30, 70), 2000) or WaitFuncEx('FindTextWrap', Param2, RandomRange(30, 70), 2000);
FreeDTM(RawDTM);
if not Result then
if ValidInterface(905) then
Result := (GetChildComponentID(905,14,56) = Players[CurrentPlayer].Integers[5]) or (lowercase(GetChildComponentText(905,14,57)) = lowercase('Raw ' + Players[CurrentPlayer].Strings[1]));
end;

Function R_ClickChatButton: Boolean;

var
Timer: Integer;

begin
Result := False;
R_Flag;
MarkTime(Timer);
AntiRandoms;
if R_FindChatButton then
begin
MouseBox(230,395,290,455, 1);
DebugIt('Clicked The Chat In An Attempt To Cook.');
AntiRandoms;
Result := True;
end
else
DebugIt('Cannot Find RawDTM. Will Try Again.');
end;

What I use in my cooker.


Edit: It uses DGBY714's waitfuncex function which is here:

{*******************************************************************************
function WaitFuncEx(Func: string; var Args: TVariantArray; WaitPerLoop, MaxWait: integer): boolean;
By: Dgby714
Description: Calls Func with arguments Args every WaitPerLoop milliseconds
for a max of MaxWait milliseconds.
Func can return any basic types (boolean, string, integer).
boolean: Returns it.
string: Returns true if string equals 'true'.
integer: Returns true unless it equals 0.
*******************************************************************************}
function WaitFuncEx(Func: string; var Args: TVariantArray; WaitPerLoop, MaxWait: integer): boolean;
var
T: integer;
Temp: variant;
begin
T := GetSystemTime + MaxWait;
while (GetSystemTime < T) do
begin
Temp := CallProc(Func, Args);
if (not (VarType(Temp) = varString)) then
Temp := ToStr(Temp);
Result := StrToBoolDef(Temp, False);
if (Result) then
Exit;
Wait(WaitPerLoop);
end;
end;

NCDS

2011-05-06 21:50:45

From: grats

is there something to click these?


I'm out for the night but thanks for the help, almost done with my first script that actually doesn't need someone doing some part of it manually xD


DTM's are the same for these as they are for inventory/bank items, so you can just use the same one, only search MCx1, MCy1, MCx2, MCy2.

That's what I did with MSI's cooker. :)