SRL Archive - Test corner

IComDung-alpha (dungeoneering script)


sjlou

2012-02-17 06:43:45

- i command dungeoneering -



a remote control script for dungeoneering.
it isnt finished yet i just want some feedback.
still working on:


change log:
[PHP]added gatestone maker and a reset command to start making gatestones again
added show_commands ( show the command on the screen )
added more responds [/PHP]

still need to add
[PHP]-a proper way to find the ladder at the end.
-walking a direction with out using the door on the mini map
-trading
-progress report
-some other stuffs[/PHP]

program I_Cum_Dung;
{$DEFINE SMART}
{$i SRL/SRL.simba}
{$i SRL/SRL/skill/magic.simba}
{$i SRL/SRL/Misc/debug.simba}
{$i srl/srl/misc/paintsmart.simba}
{========================================HOW TO USE IT======================================================

!!! = IMPORTANT = !!!

1.LOGIN AND CHOOSE THE SAME WORLD WITH THE MAIN PLAYER WHERE YOU WILL BE SENDING THE COMMANDS WITH.

2.!! DO NOT !! GO IN GAME BUT JOIN YOURE OWN FRIENDS CHAT.

3.WAIT UNTILL THE "BOT" IS LOGGED IN AND IS IN YOURE FRIENDS CHAT.

4.SEND THE COMMAND TO START THE LOGIN PROCEDURE AND THEN LOGIN INGAME
!!! MAKE SURE YOU BOTH/ALL ARE LOGGED IN, IF NOT LOGOUT WITH ALL THE PLAYERS AND GOTO 1.!!!

5.INVITE THE "BOT(S)" AND START THE DUNGEON, CHOOSE WHAT MAP(SMALL, MID, LARGE)
!!! AT Suggested Dungeon Size CHOOSE 1 !!! OR YOU WILL NOT BE ABLE TO COMPLATE MOST DUNGEONS.

**to command more then 1 "bot" open a new simba**
**run the script with complexity 5/6**
**grab all the items from the tables**
===========================================GLOBAL SETTINGS===================================================}
const
world = 10; // what world
startlogin = 'Start'; // command for start the login procedure
commanders_name = ''; // !!!case sensitive!!! nickname of the player sending the commands
gate_stoner = true; // gatestoner !!!must be able to make gatestones!!!
ColorDebug = True; // show debug colors
command_list = true; //shoq command list on screen
{============================================================================================================}

{=========================================DUNGEUN COMMANDS===================================================}
Reset_gatestone = 'Goood'; // command for reseting the gatestone counter
Home_Teleport = 'Nowhome'; // command for using home teleport
Use_Teleport_Gate = 'Comenow'; // command for using the teleport gate
Walk_To_Me = 'Do me'; // command for walking to the player sending the commands !!!! only works if commanding 1 player !!!!
Get_portal_poss = 'Set'; // command for finding the portal position

Walk_north = 'Wan' ; // command for walking north NOT FINISHED YET
Walk_East = 'Wae' ; // command for walking east NOT FINISHED YET
Walk_South = 'Was' ; // command for walking south NOT FINISHED YET
Walk_West = 'Waw' ; // command for walking west NOT FINISHED YET

Open_north = 'Opn' ; // command for open the north door
Open_East = 'Ope' ; // command for open the east door
Open_South = 'Ops' ; // command for open the south door
Open_West = 'Opw' ; // command for open the west door
{============================================================================================================}


{=============================================SET RESPONDS===================================================}
respond1 = 'hmmm'; respond16 = 'naaa';
respond2 = 'you sure ?'; respond17 = 'do you know where i am';
respond3 = 'oke'; respond18 = 'you the man';
respond4 = 'noo'; respond19 = 'damn';
respond5 = 'riiight'; respond20 = 'brt';
respond6 = 'sure why not'; respond21 = 'almost lvl up';
respond7 = 'dont command me'; respond22 = 'im low on food';
respond8 = 'be right there'; respond23 = 'need help ?';
respond9 = 'help me out'; respond24 = 'can you cook me some food';
respond10 = 'im not sure..'; respond25 = 'wait for me';
respond11 = 'im not done'; respond26 = 'cool down';
respond12 = 'yes sure'; respond27 = 'r u in a rush';
respond13 = 'hahahaha'; respond28 = 'got the key ?';
respond14 = 'lol'; respond29 = 'i found a key';
respond15 = 'im on my way'; respond30 = 'arggg';

{============================================================================================================}

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Active := True;
end;
end;

var
go,gt,br,i,x,y,xp,yp,wportal:integer;
ctext : String;
aFound: Extended;
UpText: TStringArray;
westbox,eastbox,northbox,southbox: TBox;

procedure RespondTo;
begin
case random(15)of
0: TypeSend(respond1); 15: TypeSend(respond16);
1: TypeSend(respond2); 16: TypeSend(respond17);
2: TypeSend(respond3); 17: TypeSend(respond18);
3: TypeSend(respond4); 18: TypeSend(respond19);
4: TypeSend(respond5); 19: TypeSend(respond20);
5: TypeSend(respond6); 20: TypeSend(respond21);
6: TypeSend(respond7); 21: TypeSend(respond22);
7: TypeSend(respond8); 22: TypeSend(respond23);
8: TypeSend(respond9); 23: TypeSend(respond24);
9: TypeSend(respond10); 24: TypeSend(respond25);
10: TypeSend(respond11); 25: TypeSend(respond26);
11: TypeSend(respond12); 26: TypeSend(respond27);
12: TypeSend(respond13); 27: TypeSend(respond28);
13: TypeSend(respond14); 28: TypeSend(respond29);
14: TypeSend(respond15); 29: TypeSend(respond30);
end;
wait(2000+random(2000));
end;

{=======================================================================}
{ using the doors on the MM to walk a direction }
{=======================================================================}
function walk(Where: String): Boolean;
var
TPA: tPointArray;
horizon,verti:integer;
ATPA : T2DPointArray;
begin
i:=0;
horizon := DTMFromString('mbQAAAHicY2VgYGhhwsT+QPEgIA4F4kgg9gHiz4wI/PfrVzCWA4qjY0YkzArFYAAAYzoNjA==');
verti := DTMFromString('mbQAAAHicY2VgYMhkYmBIBeIcIM4H4iQgtmTAxM8YmOH4xfuvYCwHFEfHjFgwGAAA9nYMJg==');

Case Where of
'west': begin
if ColorDebug = True then
SMART_DrawBoxEx(true, Westbox, clgreen);
FindDTMs(horizon, TPA, WestBox.X1, WestBox.Y1, WestBox.X2, WestBox.Y2);
end;

'east':begin
if ColorDebug = True then
SMART_DrawBoxEx(true,eastbox,clRed);
FindDTMs(horizon, TPA, eastBox.X1, eastBox.Y1, eastBox.X2, eastBox.Y2);
end;

'north':begin
if ColorDebug = True then
SMART_DrawBoxEx(true, northbox, clblue);
FindDTMs(verti, TPA, northBox.X1, northBox.Y1, northBox.X2, northBox.Y2);
end;

'south':begin
if ColorDebug = True then
SMART_DrawBoxEx(true,southbox,clyellow);
FindDTMs(verti, TPA, southBox.X1, southBox.Y1, southBox.X2, southBox.Y2);
end;
end;

ATPA := TPAToATPAEx(TPA, 10, 10);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
Mouse(x,y,5,5,true);
flag;
result:= true;
end;
freeDTM(horizon);
freeDTM(verti);
end;

{=======================================================================}
{using home teleport to teleport to the first room }
{=======================================================================}
procedure home;
begin
(Cast('lumbridge home teleport', false));
respondTo;
wait(1500+random(2000));
end;

{=======================================================================}
{ using a dtm to get the portal position }
{ *u need to get all the items from the table first* }
{=======================================================================}
function get_portal_pos :boolean;
begin
wportal := DTMFromString('m1gAAAHic42JgYEhhYmCIheIYII5jgohlA3EkEJcC8VwgTmWA4HggDgbibCScC8RBQKwDxNWtXQy/GJnB+PubXyiYHST2nRlM/weqDcCDjaCYmQDmgNIIAADfYRyQ');
if FindDTMRotated(wportal, xp, yp, MMX1, MMY1, MMX2, MMY2, -Pi, Pi, Pi/2, aFound) then
begin
result:= true;
writeln('found portal');
TypeSend('yes');
freedtm(wportal);
end else
begin
result:= false;
writeln('no portal');
freedtm(wportal);
end;
wait(1500+random(2000));
end;

{=======================================================================}
{ if get_portal_pos is true, it wil use the cords to walk to the portal }
{ and calculate the posision of the mouse to face the portal }
{=======================================================================}
function walk_portal:boolean;
var
d,north,east,south,west:integer;
begin
d :=25;
north:= Distance(xp, yp, 645, 62);
east:= Distance(xp, yp, 648, 111);
south:= Distance(xp, yp, 602, 111);
west:= Distance(xp, yp, 602, 66);

if (xp<1)and (yp<1)then
begin
result:= false;
exit;
end;

begin
ClickNorth(SRL_ANGLE_low);
Mouse(xp,yp,5,5,true)
flag;
GetMousePos(xp,yp);
wait(500);

if (north< d) then
begin
MakeCompass('n');
writeln('nnnnnn')
end;

if (east< d) then
begin
MakeCompass('e');
writeln('eeeeee')
end;

if (south< d) then
begin
MakeCompass('s');
writeln('sssssss')
end;

if (west< d) then
begin
MakeCompass('w');
writeln('wwwwwww')
end;

result:= true;
end;
end;

{================================================================}
{ if walk_portal is true, it will look for the portal and use it,}
{ end else it wil 'twist' around and look for the portal }
{ }
{================================================================}
function use_portal:boolean;
var
pp,t,portal:integer;
begin
portal := DTMFromString('mbQAAAHicY2VgYGgHYnUgjgDiWiAuBeIoIPYG4iog1gZiMyDmS4pnmFWpwGBm586g+vcrQ3NbJ0MAUNwIDbMCMRcaBgMAviMLKQ=='); // light blue
//portal := DTMFromString('mWAAAAHicY2FgYFgNxFOh9EEg9gfieCA2BuIEIOZLiGUQLCuG4wCgGDLmQMMgAADrZQkL'); // dark blue
pp:=0
t:=0 inc(pp);
begin
if walk_portal then
begin
MarkTime(t);
repeat
if FindDTM(portal,x,y, MsX1, MsY1, MsX2, MsY2) then
begin
MoveMouse(x,y);
if WaitUptext('roup',500)then
begin
writeln('found portal');
Mouse(x,y,0,0,true);
result := WaitUptext('roup',500);//ChooseOption('nter');
flag;
freedtm(portal);
writeln('used portal')
respondto;
exit;
end else
inc(pp);
if (pp=15) then
begin
writeln('didnt used portal')
break;
end;
end;
inc(pp);
until result or (TimeFromMark(t) >= 20000);
if (TimeFromMark(t) >= 20000) then writeln('out of time');
end else
writeln('turning around');

MarkTime(t);
repeat
if FindDTM(portal,x,y, MsX1, MsY1, MsX2, MsY2) then
begin
MoveMouse(x,y);
if WaitUptext('roup',500)then
begin
writeln('found portal');
Mouse(x,y,0,0,true);
result := WaitUptext('roup',500);//ChooseOption('nter');
flag;
end;

if result then
begin
respondto;
freedtm(portal);
exit;
end;

Keydown(VK_Left);
wait(100+random(500));
KeyUp(VK_Left);
wait(100+random(500));
end;
until (TimeFromMark(t) >= 20000);
if (TimeFromMark(t) >= 20000) then
begin
writeln('im stuck what now');
end;
end;
end;

{================================================================}
{using GetMinimapDots('player')to walk to the player }
{must be in the same room }
{ }
{================================================================}
function walk_here:boolean;
Var
player: TPointArray;
Begin
Begin
player := GetMinimapDots('player');
If Length(player) > 0 Then
Begin
MouseFlag(player[0].X, player[0].y, 4, 4, 0);
result:= true;
Exit;
End;
End;
End;

{===================================================================}
{looks for the yellow marker on the MiniMap to attack the marked npc}
{===================================================================}
function AttMarker: Boolean;
var
MmArrow,MsArrow,MmArrow2,atk,X,Y:integer;
begin
MmArrow := DTMFromString('mbQAAAHicY2VgYMhkYmBIB+JsIE4D4lwgdgKKW0CxPRS/m83P8OGqABi/X8oPxlxAcXTMiAWDAQATNwwN');
MsArrow := DTMFromString('mlwAAAHicY2dgYDBkZGAwAWI9INYHYgsgtoGKbQHKNwFxLRAXAnEBENcAcRUQJ9Z1MfzbKs7w76I4w5RKOzBuzDBj+PdYnOE/UJ4LB2bEg6EAANyWEQs=');
MmArrow2 := DTMFromString('mQwAAAHicY2ZgYAhkYmAIAmI/IBYG8iWBWASIP5wUYHg3jR9Mi0DFQJgRCQMBAPzJBp8=');

repeat
if not FindDTM(MsArrow,x,y, MsX1, MsY1, MsX2, MsY2) then
if FindDTMRotated(MmArrow, x, y, MMX1, MMY1, MMX2, MMY2, -Pi, Pi, Pi/2, aFound)or FindDTMRotated(MmArrow2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi, Pi, Pi/2, aFound) then
Mouse(x,y,1,1,true);
flag;

if FindDTM(MsArrow,x,y, MsX1, MsY1, MsX2, MsY2) then
begin
Mouse(x,y,1,1,false);
result := ChooseOption('ttack');
wait(5000+random(5000));
end;
inc(atk);
until result or (atk = 5);
freeDTM(MmArrow2);
freeDTM(MmArrow);
freeDTM(MsArrow);
end;

{=======================================================================}
{ uses Walk to walk to the door }
{ and calculate the posision of the mouse to face the portal }
{=======================================================================}
function open_door(compas: String):boolean;
begin
Case compas of
'n':begin walk('north') MakeCompass('n')end;
'e':begin walk('east') MakeCompass('e')end;
's':begin walk('south') MakeCompass('s')end;
'w':begin walk('west') MakeCompass('w')end;
end;
i:=0;
SetAngle(SRL_ANGLE_low);
begin
MouseBox(240,90,283,120,2)
if WaitUpTextMulti(uptext,200) then
begin
ClickMouse2(true);
ClickNorth(SRL_ANGLE_low);
result:= true;
exit;
end;
end;

repeat
MoveMouse(10*(i*5),100);
if WaitUpTextMulti(uptext,200) then
begin
ClickMouse2(true);
ClickNorth(SRL_ANGLE_low);
result:= true;
exit;
end;
inc(i);
wait(20);
until i=12;
wait(1500+random(2000));
end;

{=======================================================================}
{ uses GetLastChatText to perform a command. }
{=======================================================================}
procedure whattext;
begin
GetLastChatText(ctext);
UpText := ['pen', 'oor','adder','uardian'];
if (GetColor(294, 473)=600342 ) and (GetColor(225, 462)=803618 )then
begin
writeln('found text');
MouseBox(226, 462,288, 473,1);
wait(3000+random(1000));
end;

case ctext of
Walk_north : begin walk('north') Respondto end;
Walk_East : begin walk('east') Respondto end;
Walk_South : begin walk('south') Respondto end;
Walk_West : begin walk('west') Respondto end;

Open_north : begin open_door('n') Respondto end;
Open_East : begin open_door('e') Respondto end;
Open_South : begin open_door('s') Respondto end;
Open_West : begin open_door('w') Respondto end;

Home_teleport :begin home; end;
Walk_To_Me :begin walk_here; end;
Use_Teleport_Gate :begin use_portal; end;
Get_portal_poss :begin Get_portal_pos; end;
Reset_gatestone :begin gt:= 0; br:= 0; Respondto end;
//STOP_NOW :
end;
end;


Procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour: integer);
var
mx, my, Pic, Pic2, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx, my);
Pic := BitmapFromString(mx, my, '');
Pic2 := BitmapFromString(219, 56, '');

TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1,8388736);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
DrawBitmap(Pic2, Canvas, 160,10);
FreeBitmap(Pic);
FreeBitmap(Pic2);
end;

procedure show_Commands;
begin
if (command_list = true) then
begin
PrintOnSmart([
'Use_Teleport_Gate'+' = '+Use_Teleport_Gate,
'Walk_To_Me'+' = '+Walk_To_Me,
'Get_portal_poss'+' = '+Get_portal_poss,
'',
'Walk_north'+' = '+Walk_north,
'Walk_East '+' = '+Walk_East,
'Walk_South '+' = '+Walk_South,
'Walk_West'+' = '+Walk_West,
'',
'Open_north'+' = '+Open_north,
'Open_East'+' = '+Open_East,
'Open_South'+' = '+Open_South,
'Open_West'+' = '+Open_West
],Point(15,75),16777215 );
end;
end;

procedure handleEnd;
begin
if (GetColor(221, 405)=13158600 ) and (GetColor(258, 407)=13158600 ) and (GetColor(298, 409)=13158600 ) then
begin
writeln('found 1');
MouseBox(204,400,308,412,1);
wait(3000+random(1000));
writeln('step1');
if (GetColor(464, 31)=2567731 ) then
begin
writeln('found 2');
MouseBox(462,30,492,39,1);
wait(3000+random(1000));
writeln('step2');
if (GetColor(449, 28)=46335 ) or (GetColor(430, 28)=46335 )then
begin
writeln('found 3');
mousebox(443, 31,450, 38,1);
wait(1500+random(1000));
writeln('step3');
end;
end;
end
end;

Function accept_invite: boolean;
var
t:integer;
txt: String;
begin
result:= false;
txt := GetChatBoxText(8, 12926);
if (ExecRegExpr(commanders_name+' has invited you to a dungeon party.', txt))then
begin
MarkTime(t);
MouseBox(11, 444,249, 455,1)
repeat
wait(1000+random(200));
until (GetColor(140, 262)=30720) and (GetColor(203, 293)=30720) and (GetColor(134, 292)=30720) or (TimeFromMark(t) >= 20000);
if (TimeFromMark(t) >= 20000) then
begin
typesend('invite me again');
result:= false;
exit;
end;
MouseBox(138, 268,201, 291,1)
inc(go);
result:= true;
end;
wait(3000+random(200));
end;


Function gatestone:boolean;
var
x,y:integer;
gsColors,CrColors: TIntegerArray;
TPA: TPointArray;
label Start;
begin
gsColors := [7304549,2171932,9741678];
CrColors := [8624919 ,14478164];
start:
if FTab(25)then
if FindColorTolerance(x,y,6976344, MIX1, MIY1, MIX2, MIY2, 10) then
//If(FindObjEx(x, y, ['ate', 'stone', 'one'], gsColors, 25, 50,MIX1, MIY1, MIX2, MIY2)) then
begin
// MiddleTPAEx(ATPA[i], x, y);
wait(1000+random(500));
Mouse(x,y,5,5,false);
ChooseOption('rop');

goto Start;
end else
if FTab(28)then
// if FindColorTolerance(x,y,14478164, MIX1, MIY1, MIX2, MIY2, 35) then
If(FindObjEx(x, y, ['reate', 'ate', 'one'], CrColors, 25, 50,MIX1, MIY1, MIX2, MIY2)) then
begin
Mouse(x,y,5,5,false);
result:= ChooseOption('uick');
wait(1000+random(200));
inc(gt);
end
end;


Function prepare_login: boolean;
begin
LoginPlayerToLob;
if SelectWorld(world) then
wait(500+random(200));
if LobbyTab(4)then
begin
MouseBox(230, 256,533,279,1);
wait(1000);
typesend(commanders_name);
repeat
if not(GetTextAtExWrap(145, 367, 235, 381, 0, 3, 10, 5657343, 10, StatChars) = (startlogin)) then
writeln('000000')
else
begin
writeln('xxxxxx');
loginplayer;
result:= true;
exit;
end;
until false;
end;
end;

begin

Smart_Server := 10;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;

DeclarePlayers;
show_Commands;
prepare_login;

WestBox.X1 := Mmcx-65;
WestBox.Y1 := MmCY-35;
WestBox.X2 := MmCX-1;
WestBox.Y2 := MmCY+35;

eastBox.X1 := Mmcx+65;
eastBox.Y1 := MmCY-35;
eastBox.X2 := MmCX+1;
eastBox.Y2 := MmCY+35;

northBox.X1 := Mmcx+35;
northBox.Y1 := MmCY-67;
northBox.X2 := MmCX-35;
northBox.Y2 := MmCY-2;

southBox.X1 := Mmcx+35;
southBox.Y1 := MmCY+67;
southBox.X2 := MmCX-35;
southBox.Y2 := MmCY+2;
repeat
accept_invite;
until (go = 1);
writeln('gogogogogogo');
repeat
if (gate_stoner = true) then
if FTab(25) then
while not FindColorTolerance(x,y,2019538 , MIX1, MIY1, MIX2, MIY2, 20)do
wait(500+random(300));
repeat
if (br >1) then break;
gatestone;
writeln('gatestones'+IntToStr(gt));
until (gt >40);
inc(br);
writeln('whattext');
whattext;
writeln('attack');
attmarker;
writeln('handle');
handleEnd;
writeln(br);
until false
end.

Sin

2012-02-17 06:45:19

HOLY FK.
Does it ACTUALLY work?

sjlou

2012-02-17 06:49:58

it does the basic stuff
like open doors that has been opened already and attack marked npc
..look through the script :P

Mat

2012-02-17 07:41:29

:o me test Now on second accounts :P if my laptop will take it :D

'Toxin

2012-02-17 08:42:51

Oh wow… this is impressive. I'm really loving the development going on here in SRL. Great work sjlou! Will try it out !

Kyle Undefined

2012-02-17 09:01:21

Nice work! :D

sjlou

2012-02-19 06:25:13

where are my feedbacks ?

Mat

2012-02-19 14:43:56

I can't run two Rs's on my script, and don't have another pc to use :(
Mat

jakeyboy29

2012-02-19 15:11:37

if youre going to have to direct the bot, and tell it what to do, why wouldnt you just do it yourself legit?

sjlou

2012-02-23 03:27:51

lets say..you have a high lvl account and want to train dungeoneering with 1..3 low lvl accounts, I don't want to play with 2..4 accounts at the same time, that's why I made this script.

and a bigger party is more exp ?

DemiseScythe

2012-02-23 05:50:14

Very nice project, I told RISK about wanting to do some kind of remove control dung drone although mine was more of waiting ingame, doing puzzles that required it, and exiting the floor. Mostly just the puzzle part of it.

Still good luck.

EDIT:

Keep up the good work ^.^~

Wetish

2012-03-08 21:09:11

Should be good for leaching. I might have to give it a try. :)