I am trying to edit a script to customize it before actually trying to script myself. I can't figure out how to change a right click to a left click. Can anyone help me with this>
I am trying to edit a script to customize it before actually trying to script myself. I can't figure out how to change a right click to a left click. Can anyone help me with this>
I am editing TooMuchTabbage and it clicks the lectern then right clicks the varrock teleport tab but it will not do anything else. It is actually faster to just make them one by one and left click, but i don't know how to change the clicking.
Simba Code:program new;
{$i SRL/SRL.simba}
procedure Example;
begin
Mouse(770, 341, 0, 0, True); // Left clicks
Mouse(770, 341, 0, 0, False); // Right clicks
end;
begin
end.
Code:program TooMuchTabbage;//by PatDuffy {$DEFINE SRL5} {$DEFINE SMART} {$i SRL/srl.simba} //{$i SRL/srl.scar} {$i SPS/sps.simba} // {$include SRL/SRL/misc/smart.simba} {$i SRL/SRL/misc/paintsmart.simba} const World = 89;//89,47,83(my lowest ping worlds), 0 for random Members = true; Signed = true; CPrice = 444;//price of soft clay TPrice = 1336;//price of tab LPrice = 328;//price of law runes Version = '1_1'; SRLStats_Username ='Anonymous'; SRLStats_Password ='anon1337'; Style = 'fast'; Tab_Make = 'varrock'; Butler = 'demon';//demon or butler //valid tab types are: (house, varrock, falador, // lumb, cammy, ardy, watch //Note, only hybrid tested, others should work {hybrid = mix of fast making and few slow slow = Make-All option, lots of humans do it fast = Make 1-by-1, saves 26 seconds per inv} {==============================================] [ For 'Loc' Valid Locs are.... ] [ 'ready': standing next to the lectern ] [ with inventory full ] [ ] [ 'refill': standing next to the lectern ] [ without soft clay, but with noted ] [ soft clay and runes ] [==============================================} //the other Loc's I use you won't need to worry about var certs,TabNum:Integer; First,Long:Boolean; Loc,Ver: String; Procedure DeclarePlayers; begin HowManyPlayers := 1; NumberOfPlayers(HowManyPlayers); CurrentPlayer := 0; with Players[0] do begin Name := ''; Pass := ''; Pin := ''; Loc := 'ready'; BoxRewards := ['XP','xp','lamp']; LampSkill := 'Slayer'; Active := True; end; end; //By Benland100, modified to paint mouse movements procedure WindMouse2(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended); var veloX, veloY, windX, windY, veloMag, dist, randomDist, lastDist, step: extended; lastX, lastY: integer; sqrt2, sqrt3, sqrt5: extended; begin sqrt2:= sqrt(2); sqrt3:= sqrt(3); sqrt5:= sqrt(5); while hypot(xs - xe, ys - ye) > 1 do begin dist:= hypot(xs - xe, ys - ye); wind:= minE(wind, dist); if dist >= targetArea then begin windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5; windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5; end else begin windX:= windX / sqrt2; windY:= windY / sqrt2; if (maxStep < 3) then begin maxStep:= random(3) + 3.0; end else begin maxStep:= maxStep / sqrt5; end; end; veloX:= veloX + windX; veloY:= veloY + windY; veloX:= veloX + gravity * (xe - xs) / dist; veloY:= veloY + gravity * (ye - ys) / dist; if hypot(veloX, veloY) > maxStep then begin randomDist:= maxStep / 2.0 + random(round(maxStep) div 2); veloMag:= sqrt(veloX * veloX + veloY * veloY); veloX:= (veloX / veloMag) * randomDist; veloY:= (veloY / veloMag) * randomDist; end; lastX:= Round(xs); lastY:= Round(ys); xs:= xs + veloX; ys:= ys + veloY; if (lastX <> Round(xs)) or (lastY <> Round(ys)) then MoveMouse(Round(xs), Round(ys)); step:= hypot(xs - lastX, ys - lastY); wait(round((maxWait - minWait) * (step / maxStep) + minWait)); lastdist:= dist; SMART_DrawDotsEx(False, [Point(lastX, lastY)], 65280); end; if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then MoveMouse(Round(xe), Round(ye)); end; {******************************************************************************* Procedure HumanMMouse(eX, eY: Integer); By: Flight Description: Human-like miss-and-correct mouse movement *******************************************************************************} Procedure HumanMMouse(eX, eY, ranX, ranY: Integer); var randSpeed: extended; X,Y,X2,Y2,A,Dist,MP: integer; begin A := MouseSpeed; GetMousePos(X, Y); Dist := Distance(X, Y, eX, eY); MP := Round(Dist/150); if MP < 0 then MP := 1; randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0; X2 := RandomRange(eX-(A*MP), eX+(A*MP)); Y2 := RandomRange(eY-(A*MP), eY+(A*MP)); WindMouse2(X, Y, X2, Y2, 9.0, 3.0, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed); GetMousePos(X, Y); MMouse(eX, eY, ranX, ranY); MouseSpeed := A; end; {******************************************************************************* Procedure HumanRandomMouse; By: Flight Description: Random human-like mouse movement *******************************************************************************} Procedure HumanRandomMouse; var randSpeed: extended; x, y, firstSpeed: integer; begin case(Random(10)) of 2..8: begin firstSpeed := mouseSpeed; mouseSpeed := RandomRange(5,10); randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0; GetMousePos(x, y); WindMouse2(x, y, RandomRange(x - 75, x + 75), RandomRange(y - 75, y + 75), 30, 55, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed); mouseSpeed := firstSpeed; //ClearSmartCanvas; end; end; end; function CountNotes:Integer; var Box: TBox; begin Box := InvBox(25); Result:=GetAmountBox(Box); Writeln(IntToStr(Result)+' Noted clay found'); Exit; end; procedure SetUpPlayers; begin if not LoggedIn then Exit; If FindNormalRandoms then if not LoggedIn then Exit; MakeCompass('S'); SetAngle(SRL_ANGLE_HIGH); certs :=CountNotes; end; function FindThing(var X,Y:Integer; what:string; DeBug:Boolean):Boolean; var TPA,LPA,LPB: TPointArray; ATPA: T2DPointArray; I,H: Integer; Box:TBox; begin if Loc = 'clicked' then Result:=True; case what of 'lectern':begin Writeln('searching for lectern'); ColorToleranceSpeed(2); FindColorsSpiralTolerance(MSCX,MSCY,LPA,11383733,MSX1,MSY1,MSX2,MSY2,10); FindColorsSpiralTolerance(MSCX,MSCY,LPB,11515318,MSX1,MSY1,MSX2,MSY2,7); TPA:=CombineTPA(LPA,LPB); end; 'demon','first':begin Writeln('Searching for demon'); ColorToleranceSpeed(2); FindColorsSpiralTolerance(MSCX,MSCY,LPA,13948638,MSX1,MSY1,MSX2,MSY2,21); FindColorsSpiralTolerance(MSCX,MSCY,LPB,7829628,MSX1,MSY1,MSX2,MSY2,10); TPA:=CombineTPA(LPA,LPB); end; 'butler','reg':begin Writeln('Searching for butler'); ColorToleranceSpeed(2); FindColorsSpiralTolerance(MSCX,MSCY,LPA,1382727,MSX1,MSY1,MSX2,MSY2,12); FindColorsSpiralTolerance(MSCX,MSCY,LPB,1448265,MSX1,MSY1,MSX2,MSY2,12); TPA:=CombineTPA(LPA,LPB); end; end; ATPA := TPAtoATPA(TPA,25); if Length(ATPA) = 0 then Exit; SortATPAFrom(ATPA, Point(MSCX,MSCY)); H :=High(ATPA); SMART_DrawDotsMulti(True,ATPA); For I:=0 to H do begin Box := GetTPABounds(ATPA[I]); if DeBug then SMART_DrawBoxEx(False, IntToBox(Box.X1,Box.Y1,Box.X2,Box.Y2),65280); MiddleTPAEx(ATPA[I],X,Y); HumanMMouse(X,Y,5,5); Wait(500); case what of 'lectern':begin if IsUpTextMultiCustom(['tudy','ectern']) then begin Mouse(X,Y,0,0,true); Writeln('Found lectern'); Result:=True; Loc:='clicked'; Exit; end else Result:=False; end; 'demon','butler':begin Mouse(X,Y,1,1,false); if OptionsExist(['etch','rom'],false) then begin if ChooseOption('etch') then begin Wait(1500+Random(500)); Writeln('Found butler'); Result:=True; Exit; end; end else Result:=False; end; 'first','reg':begin if IsUpTextMultiCustom(['emon','utler']) then begin Mouse(X,Y,1,1,True); Wait(1500+Random(500)); Result:=True; Writeln('clicked butler'); Exit; end else Writeln('Failed to find butler'); Result:=False; end; end; end; end; function FindClay:Boolean; var ClayDTM,x,y:Integer; begin ClayDTM := DTMFromString('78DA636C67626058CDC8800CC2EC781834803' + '44C94710250CD7A54350C0C4C1039989AA940FE72026ADA80FCCD04D' + '4F410A1A601C8DF845F0D002FC70848'); if FindDTM(ClayDTM,x,y,MIX1,MIY1,MIX2,MIY2) or InvFull then begin Result:=True; FreeDTM(ClayDTM); Exit; end else begin Writeln('did not find soft clay'); FreeDTM(ClayDTM); Result:=False; Exit; end; end; procedure UpdateScript; var Script:String; begin Script:=GetPage('http://pastebin.com/raw.php?i=754W7J02'); if (CreateFile('C:\Simba\Script\TooMuchTabbageV'+Ver+'.simba')=-1) then begin ClearDebug; WriteLn('Sorry I was not able to auto update this script, you can update it manually') WriteLn('Opening the web page for you to update') OpenWebPage('http://villavu.com/forum/showthread.php?t=71103'); TerminateScript; end; CloseFile(0); If((FileExists('C:\Simba\Scripts\TooMuchTabbageV'+Ver+'.simba'))) then begin ClearDebug; WriteLn('Updated The Script, new version stored at "C:\Simba\Scripts\TooMuchTabbageV'+Ver+'.simba"') TerminateScript; end; end; procedure CheckVersion; begin Ver:=GetPage('http://pastebin.com/raw.php?i=zgXxN1QG'); if (Ver='') then begin WriteLn('There was an error connecting to the Update Server so I will assume that you have the most up to date Version') Exit; end; if (Version = Ver) then begin Writeln('You are using the most up to date version'); Exit; end else begin Writeln('You are not using the latest version'); Writeln('Updating now'); UpdateScript; end; end; procedure FindStage; begin if not LoggedIn then Players[CurrentPlayer].Loc:='end'; if FindNormalRandoms then If not LoggedIn then begin Players[CurrentPlayer].Loc:='end'; Exit; end; if FindClay then Players[CurrentPlayer].Loc:='ready'; Players[CurrentPlayer].Loc:='refill'; end; function PayDamThing:Boolean; var x,y,Derps:Integer; begin if ClickContinue(true,true) then begin Writeln('Demon must be payed'); Wait(1000); repeat Wait(Random(500)); if FindText(x,y,'servant',UpChars,69,364,478,480) then begin Writeln('payed demon'); mouse(x,y,1,1,true); Derps:=0; Result:=True; Exit; end else Inc(Derps); until (Derps >2); end else Writeln('demon did not require pay'); Derps:=0; Result:=False; end; procedure ChooseTab; begin case Tab_Make of 'varrock': MouseBox(229,242,264,272,0); end; end; function FindTab(Var Q,T:Integer; thing:string):Boolean; var cmount:Integer; begin if IsMoving then Wait(2000+Random(500)); Wait(600+Random(200)); case thing of 'fast':begin case Random(100) of 0..98:begin ChooseTab; Wait(500+Random(100)); Long:=True; Result:=True; Inc(TabNum); Writeln('Made Tab #'+IntToStr(TabNum)); Exit; end; 99..100:begin case Tab_Make of 'house': MouseBox(397,79,435,109,0); 'watch': MouseBox(312,77,342,110,0); 'ardy' : MouseBox(308,158,348,187,0); 'cammy': MouseBox(314,243,349,272,0); 'falador': MouseBox(232,154,263,189,0); 'varrock': MouseBox(229,242,264,272,0); 'lumb' : MouseBox(148,77,181,109,0); end; if OptionsExist(['ouse','use'],false) then if ChooseOption('ll') then begin cmount := InvCount-4; IncEx(TabNum,cmount); Wait(500+Random(50)); Writeln('Clicked Tab'); Long:=True; Writeln('making all'); Result:=True; Exit; end else Result:=False; end; end; end; 'fast':begin case Tab_Make of 'house': MouseBox(397,79,435,109,0); 'watch': MouseBox(312,77,342,110,0); 'ardy' : MouseBox(308,158,348,187,0); 'cammy': MouseBox(314,243,349,272,0); 'falador': MouseBox(232,154,263,189,0); 'varrock': MouseBox(229,242,264,272,0); 'lumb' : MouseBox(148,77,181,109,0); end; if OptionsExist(['ouse','use'],false) then if ChooseOption('ll') then begin cmount := InvCount-4; Wait(500+Random(50)); IncEx(TabNum,cmount); Writeln('Clicked Tab'); Result:=True; Exit; end else Result:=False; end; 'fast':begin ChooseTab; Wait(500+Random(100)); Long:=False; Inc(TabNum); Writeln('Made Tab#'+IntToStr(TabNum)); Result:=True; Exit; end; end; end; procedure Statty; var exp: Integer; begin exp:=24*30; Stats_IncVariable('Magic EXP (Gained)',exp); case Tab_Make of //'house':can't fill this in due to variables 'varrock': Stats_IncVariable('Varrock Tablets (Made)',22); //'falador': //'lumb': //'cammy': //'ardy': //'watch': end; Stats_Commit; end; procedure Proggy; var Mage, Profit: Integer; begin Mage:= 30*TabNum; Profit:=(TabNum*TPrice)-(TabNum*LPrice+TabNum*CPrice); ClearDebug; Writeln('=+=+=+=+=+=+=+==+=+=+=+=+=+=+==+=+=+=+=+=+=+='); Writeln('=+=+=+ TooMuchTabbage '+ Version+' by PatDuffy'); Writeln('=+=+=+=+=+=+=+==+=+=+=+=+=+=+==+=+=+=+=+=+=+='); Writeln(' Time Running: '+TimeRunning); Writeln(' Tablets Made: '+IntToStr(TabNum)); Writeln(' Magic Exp Gained: '+IntToStr(Mage)); Writeln(' Profit Made: '+IntToStr(Profit)); Writeln(' Profit/Hour: '+IntToStr((Profit*60/((GetTimeRunning/60000)+1)))); Writeln('=+=+=+=+=+=+=+==+=+=+=+=+=+=+==+=+=+=+=+=+=+='); end; function UseNotes:Boolean;//uses the notes on the butler during the first run-through var NoteDTM,x,y:Integer; begin NoteDTM :=DTMFromString('78DA638C676260F8C4C8800C426CB81934803' + '44C943112A8E637AA1A06062654352940357F09A8C906AAF94A404D0' + 'E50CD5B026AFC816A7EE0570300BEB009BA'); Statty; if FindDTM(NoteDTM,x,y,MIX1,MIY1,MIX2,MIY2) then begin HumanMMouse(x,y,5,5); Mouse(x,y,0,0,true); case Butler of 'demon':begin if FindThing(x,y,'first',true) then begin if PayDamThing then Exit; if FindText(x,y, 'cert', UpChars, 69, 364, 478, 480) then begin Mouse(x,y,0,0,true); Wait(1000+Random(100)); TypeSend('24'); Result:=True; Exit; end; end; end; 'butler':begin if FindThing(x,y,'reg',true) then begin if PayDamThing then Exit; if FindText(x,y, 'cert', UpChars, 69, 364, 478, 480) then begin Mouse(x,y,0,0,true); Wait(1000+Random(100)); TypeSend('24'); Result:=True; Exit; end; end; end; end; end else Result:=False; end; procedure WasteTime; var Tim:Integer; begin MarkTime(Tim); repeat Wait(10000+Random(10000)); case Random(100) of 0..20: HumanRandomMouse; 21..50: Wait(10000+Random(10000)); 51..76: BoredHuman; 77..85: RandomRClick; 86..93: PickUpMouse; 94..100: ExamineInv; end; until not FindClay or (TimeFromMark(Tim)> 180000); if not FindClay then Players[CurrentPlayer].Loc:='refill'; Exit; end; procedure BackBone; var x,y,Q,Z,Fails,Derps:Integer; begin if FindNormalRandoms then if not LoggedIn then exit; if not FindClay then begin Players[CurrentPlayer].Loc:='refill'; Exit; end; repeat if FindThing(x,y,'lectern',true) then begin Wait(1000); case Style of 'hybrid':begin Writeln('Looking for tabs'); Fails:=0; repeat if FindTab(Q,Z,'hybrid') then begin Loc:='not'; Derps:=0; if Long then begin WasteTime; Exit; end; Wait(500+Random(200)); Exit; end else Wait(1000); Inc(Derps); until(Derps>2); if not FindClay then Players[CurrentPlayer].Loc:='refill'; end; 'fast':begin Fails:=0; if FindTab(Q,Z,'fast') then // begin Wait(500); // end; if not FindClay then Players[CurrentPlayer].Loc:='refill'; end; 'slow':begin Fails:=0; if FindTab(Q,Z,'slow') then begin WasteTime; Exit; end; end; end; end else Inc(Fails); If (Fails>5) then begin Players[CurrentPlayer].Loc:='lost'; Exit; end; until not FindClay; end; procedure Interact; var x,y,Derps:Integer; begin If FindNormalRandoms then If not LoggedIn then Exit; Statty; if FindClay then begin Players[CurrentPlayer].Loc:='ready'; Exit; end; if First then begin // repeat if UseNotes then begin Writeln('sent the demon to get more clay'); case Butler of 'demon': Wait(7500+Random(1000)); 'regular': Wait(12000+Random(1000)); end; if FindClay then begin First:=False; Writeln('Ready for more tab-making'); Players[CurrentPlayer].Loc:='ready'; Derps:=0; Exit; end else Players[CurrentPlayer].Loc:='ready'; First:=False; Exit; end else Inc(Derps); //until (Derps>2); end; case Butler of 'demon':begin if FindThing(x,y,'demon',true) then begin Wait(500); if PayDamThing then begin Writeln('I hate that demon'); Exit; end; if FindText(x,y, 'cert', UpChars, 69, 364, 478, 480) then Mouse(x,y,1,1,true); Wait(7000+Random(2000)); if FindClay then begin Players[CurrentPlayer].Loc:='ready'; Exit; end; end else Players[CurrentPlayer].Loc:='lost'; end; 'butler':begin if FindThing(x,y,'demon',true) then begin Wait(500); if PayDamThing then begin Writeln('I hate that demon'); Exit; end; if FindText(x,y, 'cert', UpChars, 69, 364, 478, 480) then Mouse(x,y,1,1,true); Wait(12000+Random(2000)); if FindClay then begin Players[CurrentPlayer].Loc:='ready'; Exit; end; end else Players[CurrentPlayer].Loc:='lost'; end; end; end; procedure MainLoop; begin if not LoggedIn then Exit; repeat if FindNormalRandoms then If not LoggedIn then Exit; Proggy; case Players[CurrentPlayer].Loc of 'ready': BackBone; 'refill': Interact; 'lost': FindStage; 'end': NextPlayer(False); end; until AllPlayersInactive; end; begin ClearDebug; CheckVersion; Smart_Signed := Signed; Smart_Server := World Smart_SuperDetail := False; Smart_Members := Members; SetupSRLStats(454,SRLStats_Username,SRLStats_Password); SetupSRL; DeclarePlayers; First:=True; SetUpPlayers; AddOnTerminate('Proggy'); repeat MainLoop; until AllPlayersInactive; end.
Actually I believe in SRL5 we've switched over to "mouse_left" and "mouse_right".
ClickMouse2 will still use the same boolean; True for left-click, False for right click, but things like 'Mouse' (Mouse(770, 341, 0, 0, True)) should now by like, for example:
Simba Code:Mouse(770, 341, 0, 0, mouse_left); //Left click
Current projects:
[ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]
"I won't fall in your gravity. Open your eyes,
you're the Earth and I'm the sky..."
Awesome! Thanks guys i really appreciate it! I figured out how to get it to left click and it works flawlessly! One step closer to developing my first script!
There are currently 1 users browsing this thread. (0 members and 1 guests)