SRL Archive - OSR Help

how would i change where a superheater clicks the ore?


Neros

2012-01-18 17:47:52

im just wondering, im really new to colour and SRL scripting, im pretty sure it's something to do with this segment of code i found a better inv setup and
i need it to click one space to the left

procedure DoSmelting(ItemNum,NumBars:integer);
var
sm: TInvenItem;
t,Tic:integer;
begin
ItemNum2:=ItemNum;
SupaHeatDTM := DTMFromString('mbQAAAHicY2VgYJjLxMAwE4inA/EiIF4MxOWMDAxlQFwHxDVAXAnEsoxMDHqMzAx2TMxgGoSxAUYsGAwAHzIGhQ==');
if not(LoggedIn) then Exit;
MouseSpeed:= (Mspeed+RandomRange(-2,+3));
GameTab(tab_magic);
t:=0;
MarkTime(Tic);
repeat
repeat
until (FindDTM(SupaHeatDTM,sx,sy,MIX1,MIY1,MIX2,MIY2) or(TimeFromMark(Tic) > 17000))
if(TimeFromMark(Tic) > 17000)then
begin
exit;
end;
Mouse(sx,sy,2,2,true);
wait(RandomRange(50,100));
repeat
wait(4);
inc(t);
until(GetCurrentTab = tab_inv )or (t > 8000)

YoHoJo

2012-01-18 19:19:33

Code is a bit sloppy/wierd.
You have a repeat and an until right after it that seems odd to me?
Also I see no clicking of ores or anything just an excessively long procedure to click the superheat spell, you say you want a different ore clicked, I don't see any ore clicking stuff here? Sorry to sound rude if I am, I'm not! :)

'Toxin

2012-01-18 19:30:11

From: YoHoJo
Code is a bit sloppy/wierd.
You have a repeat and an until right after it that seems odd to me?
Also I see no clicking of ores or anything just an excessively long procedure to click the superheat spell, you say you want a different ore clicked, I don't see any ore clicking stuff here? Sorry to sound rude if I am, I'm not! :)


Nah you're right… I think his intention here is to use this once and maybe loop through it ? Idk, but first off you may want to check to see that the DTM's your using are set up correctly, idk what it is for me but I wouldn't use DTM's for what you're trying to accomplish. Activated spells in the spellbook are brighter and easier to detect color wise so it would be easier to do that instead of depending on a DTM (which is prone to change more than the color itself).

Neros

2012-01-18 19:34:57

it's ok yoho, this isnt my script, im just trying to fix it up a tad because it clicks the 10th inv spot while smithing steel when i can setup my spell book for the superheat spell to be over the 9th inv spot and put nats in bottom right


the actual script is CRU1Z1N's (im not sure if im even allowed to edit someone's script? lol)

program SuperHeater;
{$I SRL/SRL/misc/smart.simba}
{$I SRL/SRL.simba}

const
BnkTab = 2;
Mspeed = 18;
ScriptVersion = '0.6a';
UseAutoChecker = true;

var
frmDesign: TForm;
Button1: TButton;
Label1: TLabel;
UseCoalBag,WhatBank,BarType: TComboBox;
Pinn,Pass,UsrName,Profit,HowManyBars: TEdit;
ItemNum2,iProfit,Tri,iHowManyBars,sx,sy,BarsMade, SupaHeatDTM, Bars: Integer;
Debug:string;

procedure AutoUpdateMe;
var Neifile:integer;
OnlineVersion, NewScript, NeiFeilNennen:string;
begin
if UseAutoChecker then
begin
writeln('Checking for script updates...');
OnlineVersion := GetPage('http://cru1z1nsscripts.googlecode.com/git/LatestVersion.txt');
writeln(OnlineVersion);
writeln(ScriptVersion)
if (trim(OnlineVersion) > ScriptVersion) then
begin
writeLn('Newer script version online!');
writeLn('Autoupdating to newer version.');
NewScript := GetPage('http://cru1z1nsscripts.googlecode.com/git/UltraSteelCoalBagHeater.simba');

NeiFeilNennen := ScriptPath+ 'UltraSteelCoalBagHeater V'+OnlineVersion+'By CRU1Z1N.simba';
Neifile := Rewritefile(NeiFeilNennen, true);
try
WriteFileString(Neifile, NewScript);
except
begin
writeLn('Fatal error writing to '+NeiFeilNennen+'!!');
terminatescript;
end;
end;
CloseFile(Neifile);
writeLn('New script downloaded to '+NeiFeilNennen+'!! Please use this one!!');
TerminateScript;
end else
writeLn('You have the latest version of the script!');
end else
WriteLn('!!!!! Not checking for latest version, you may be outdated!');
end;

procedure SetupPlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
Players[0].Name := UsrName.Text;
Players[0].Pass := Pass.Text;
Players[0].Pin := Pinn.Text;
Players[0].Active := True;
end;

Procedure ButtonClick(Sender: TObject);
Begin
frmDesign.ModalResult:= mrOk;
iHowManyBars:= StrToInt(HowManyBars.Text);
iProfit:= StrToInt(Profit.Text);
End;

procedure InitForm;
begin
frmDesign := CreateForm;
frmDesign.Left := 100;
frmDesign.Top := 100;
frmDesign.Width := 660;
frmDesign.Height := 200;
frmDesign.Caption := 'CRU!Z!NS Ultra SuperHeater +CoalBag!';
frmDesign.Color := 1380316;
frmDesign.Font.Color := ClBlack;
frmDesign.Font.Name := 'Comic Sans MS';

Button1 := TButton.Create(FrmDesign);
Button1.Parent := FrmDesign;
Button1.Left := 260;
Button1.Top := 60;
Button1.Height := 100;
Button1.Width := 100;
Button1.Caption := 'Run Script';
Button1.OnClick := @ButtonClick;

Label1 := TLabel.Create(FrmDesign);
Label1.Parent := FrmDesign;
Label1.Top := 60;
Label1.Left := 370;
Label1.Caption := 'UserName?';

Label1 := TLabel.Create(FrmDesign);
Label1.Parent := FrmDesign;
Label1.Top := 90;
Label1.Left := 370;
Label1.Caption := 'Password?';

Label1 := TLabel.Create(FrmDesign);
Label1.Parent := FrmDesign;
Label1.Top := 120;
Label1.Left := 370;
Label1.Caption := 'Bank Pin?';

Label1 := TLabel.Create(FrmDesign);
Label1.Parent := FrmDesign;
Label1.Top := 60;
Label1.Left := 10;
Label1.Caption := 'Profit per bar?';

Label1 := TLabel.Create(FrmDesign);
Label1.Parent := FrmDesign;
Label1.Top := 90;
Label1.Left := 10;
Label1.Caption := 'How Many Bars?';

Label1 := TLabel.Create(FrmDesign);
Label1.Parent := FrmDesign;
Label1.Top := 120;
Label1.Left := 10;
Label1.Caption := 'Use CoalBag?';

Label1 := TLabel.Create(FrmDesign);
Label1.Parent := FrmDesign;
Label1.Top := 150;
Label1.Left := 10;
Label1.Caption := 'Where to bank?';


UsrName := TEdit.Create(FrmDesign);
UsrName.Parent := FrmDesign;
UsrName.Top := 60;
UsrName.Left := 460;
UsrName.Width := 100;
UsrName.Height := 20;

Pass := TEdit.Create(FrmDesign);
Pass.Parent := FrmDesign;
Pass.Top := 90;
Pass.Left := 460;
Pass.Width := 100;
Pass.Height := 20;

Pinn := TEdit.Create(FrmDesign);
Pinn.Parent := FrmDesign;
Pinn.Top := 120;
Pinn.Left := 460;
Pinn.Width := 100;
Pinn.Height := 20;

Profit := TEdit.Create(FrmDesign);
Profit.Parent := FrmDesign;
Profit.Top := 60;
Profit.Left := 135;
Profit.Caption := '100';
Profit.Width := 60;
Profit.Height := 20;

HowManyBars := TEdit.Create(FrmDesign);
HowManyBars.Parent := FrmDesign;
HowManyBars.Top := 90;
HowManyBars.Left := 135;
HowManyBars.Caption := '1000';
HowManyBars.Width := 60;
HowManyBars.Height := 10;

BarType := TComboBox.Create(FrmDesign);
BarType.Parent := FrmDesign;
BarType.Top := 10;
BarType.Left := 10;
BarType.Width := 350;
BarType.Height := 20;
BarType.Caption := 'BarType';
BarType.Items.Add('iron');
BarType.Items.Add('steel');
BarType.Items.Add('mith');
BarType.Items.Add('addy');
BarType.Items.Add('rune-Comingsoon');

UseCoalBag := TComboBox.Create(FrmDesign);
UseCoalBag.Parent := FrmDesign;
UseCoalBag.Top := 120;
UseCoalBag.Left := 135;
UseCoalBag.Width := 100;
UseCoalBag.Height := 20;
UseCoalBag.Caption := 'no';
UseCoalBag.Items.Add('yes');
UseCoalBag.Items.Add('no');

WhatBank := TComboBox.Create(FrmDesign);
WhatBank.Parent := FrmDesign;
WhatBank.Top := 150;
WhatBank.Left := 135;
WhatBank.Width := 100;
WhatBank.Height := 20;
WhatBank.Caption := 'WhatBank';
WhatBank.Items.Add('vwb');
WhatBank.Items.Add('veb');
WhatBank.Items.Add('fwb');
WhatBank.Items.Add('feb');
WhatBank.Items.Add('db');
WhatBank.Items.Add('sw');
end;

procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;

procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;

procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;

procedure GetCoal;
begin
repeat
MouseBox(85, 95, 108, 113, Mouse_Right);
until(WaitOptionMulti(['ithdraw-All', 'w-A'], RandomRange(250,500)))
end;

procedure Bnk;
begin
case BarType.ItemIndex of
0: Withdraw(0,0,28);//iron bar
1:
begin //steel bar
if (UseCoalBag.Text='yes') then
begin
Withdraw(0,0,17);
GetCoal;
end;
if (UseCoalBag.Text='no') then
begin
Withdraw(0,0,9);
GetCoal;
end;
end;
2:begin //mith bar
if (UseCoalBag.Text='yes') then
begin
Withdraw(0,0,10);
GetCoal;
end;
if (UseCoalBag.Text='no') then
begin
Withdraw(0,0,5);
GetCoal;
end;
end;
3:begin //addy bar
if (UseCoalBag.Text='yes') then
begin
Withdraw(0,0,7);
GetCoal;
end;
if (UseCoalBag.Text='no') then
begin
Withdraw(0,0,4);
GetCoal;
end;
end;
end;
end;

Procedure OpenSwBank;
var bnkT,x,y:integer;
begin
bnkT:=0;
MarkTime(bnkT);
repeat
wait(0);
until (TimeFromMark(bnkT) > 35000) or (FindObjCustom(x,y,['Bank','nk ch','k che','est'], [2963780,10790316,10000542,5921374],3))
if(TimeFromMark(bnkT) > 35000)then
begin
Writeln('failed Banking sorry.......');
exit;
end;
Mouse(x,y,1,1,true);
end;

procedure DoBanking;
var
Tic:integer;
sm:TInvenItem;
begin
Tic:=0;
Tri:=0;
MarkTime(Tic);
if not(LoggedIn) then
begin
Exit;
end;
if(WhatBank.Text = 'sw')then
begin
OpenSwBank;
end else
// if OpenBankNPC then
if (OpenBank(WhatBank.Text, False, False))then
//ChooseOption('e-q');
// if (not (OpenBank(WhatBank.Text, False, False)))then exit;
Tic:=0;
MarkTime(Tic);
repeat
until(BankScreen) or(TimeFromMark(Tic) > 35000) or (PinScreen)
if(TimeFromMark(Tic) > 35000)then
begin
if (Tri < 2) then
begin
DoBanking;
Inc(Tri);
end else
Writeln('failed Banking sorry.......');
exit;
end;
If Pinscreen then
begin
InPin(Pinn.Text);
end;
Deposit(3,26,true);
MouseSpeed:= (Mspeed + RandomRange(-1, 3));
if not CurrentBankTab = 2 then
begin
BankTab(BnkTab);
end;
if (UseCoalBag.Text='yes') then //for coal bag
begin
MouseBox(85, 95, 108, 113, Mouse_Right);
WaitOptionMulti(['ithdraw-All', 'w-A'], RandomRange(250,500));
Tic:=0;
MarkTime(Tic);
repeat
sm := GetInven(2);
MouseBox(sm.ItemBox.X1,sm.ItemBox.Y1,sm.ItemBox.X2,sm.ItemBox.Y2,Mouse_Right);
until(ChooseOption('ll')or (TimeFromMark(Tic) >= 25000))
{for i := 6 to 8 do
if FindChatBoxText('y co',8,0)then
begin
Deposit(3,27,true);
end; }
if(TimeFromMark(Tic) >= 25000)then
begin
Writeln('failed Fill sorry.......');
exit;
end;
end;
Bnk;
while CloseBank do
begin
MouseSpeed := (Mspeed + RandomRange(-1, +3));
end;
end;

procedure proggy;
begin
cleardebug;
writeln(PadR('[--------------- Cru!z!ns Ultra SuperHeater Smelter --------------', 50) + ']');
writeln(PadR('[ Ran for '+TimeRunning+'', 50) + ']');
WriteLn(PadR('[Magic xp : ' + IntToStr(BarsMade*53), 50) + ']');
WriteLn(PadR('[Magic : ' + FloatToStr(Round((BarsMade*53 * 3600) / (GetTimeRunning / 1000))) + ' Mage XP/Hr', 50) + ']');
WriteLn(PadR('[Smith : ' + FloatToStr(Round((BarsMade*17 * 3600) / (GetTimeRunning / 1000))) + ' Smith XP/Hr', 50) + ']');
WriteLn(PadR('[Profit : ' + FloatToStr(Round((BarsMade*iProfit * 3600) / (GetTimeRunning / 1000))) + ' Gp/Hr', 50) + ']');
WriteLn(PadR('[Profit Made : ' +IntToStr(BarsMade*iProfit), 50) + ']');
writeln(PadR('[Bars made : '+IntToStr(BarsMade)+'', 50) + ']');
WriteLn(PadR('[Making : ' + FloatToStr(Round((BarsMade * 3600) / (GetTimeRunning / 1000))) + ' Bars/ph', 50) + ']');
writeln(PadR('[Debug '+Debug+'', 50) + ']');

end;

procedure DoSmelting(ItemNum,NumBars:integer);
var
sm: TInvenItem;
t,Tic:integer;
begin
ItemNum2:=ItemNum;
SupaHeatDTM := DTMFromString('mbQAAAHicY2VgYJjLxMAwE4inA/EiIF4MxOWMDAxlQFwHxDVAXAnEsoxMDHqMzAx2TMxgGoSxAUYsGAwAHzIGhQ==');
if not(LoggedIn) then Exit;
MouseSpeed:= (Mspeed+RandomRange(-2,+3));
GameTab(tab_magic);
t:=0;
MarkTime(Tic);
repeat
repeat
until (FindDTM(SupaHeatDTM,sx,sy,MIX1,MIY1,MIX2,MIY2) or(TimeFromMark(Tic) > 17000))
if(TimeFromMark(Tic) > 17000)then
begin
exit;
end;
Mouse(sx,sy,2,2,true);
wait(RandomRange(50,100));
repeat
wait(4);
inc(t);
until(GetCurrentTab = tab_inv )or (t > 8000)
if LevelUp then
begin
ClickToContinue;
end;
FindNormalRandoms;
sm := GetInven(ItemNum2);
MouseBox(sm.ItemBox.X1,sm.ItemBox.Y1,sm.ItemBox.X2,sm.ItemBox.Y2,Mouse_Left);
t:=0;
MarkTime(Tic);
repeat
if LevelUp then
begin
ClickToContinue;
end;
until((TimeFromMark(Tic) > 15000))or(GetCurrentTab = tab_magic)
if(TimeFromMark(Tic) > 15000)and not(GetCurrentTab = (tab_magic))then
begin
GameTab(tab_magic);
end;
inc(Bars);
inc(BarsMade);
proggy;
Until(Bars>=NumBars);
MouseSpeed:= (Mspeed+RandomRange(-1,3));
FindNormalRandoms;
FreeDTM(SupaHeatDTM);
end;

Procedure Main;
begin
MakeCompass('n');
repeat
MouseSpeed := (Mspeed + RandomRange(-1,3));
DoBanking;
Bars:=0;
Tri:=0;
FindNormalRandoms;
case BarType.ItemIndex of
0:DoSmelting(28,26);// iron
1:begin //steel
if (UseCoalBag.Text='yes') then
begin
DoSmelting(19,17);
end else
DoSmelting(10,9);
end;
2:begin //mith
if (UseCoalBag.Text='yes') then
begin
DoSmelting(12,10);
end else
DoSmelting(6,5);
end;
3:begin //addy
if (UseCoalBag.Text='yes') then
begin
DoSmelting(9,7);
end else
DoSmelting(5,4);
end;
end;
until (BarsMade>=iHowManyBars);
end;

begin
AutoUpdateMe;
SafeInitForm;
SafeShowFormModal;
ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
SetupPlayers;
ActivateClient;
Debug:='none';
if not LoggedIn then LogInPlayer;
SetAngle(SRL_ANGLE_HIGH);
ClearDebug;
wait(1000);
Main;
Freeform(frmDesign);
end.

Bixby Sayz

2012-01-18 22:41:13

Not sure if it would be any help to you or not, but you could look at my SuperHeater script (100% working as far as I know).

The only catch is it's written for SCAR and not Simba. Still you could read the code and see if you can glean something from it. I've learned a lot from reading scripts, even really old scripts that no longer work.

http://forums.scar-divi.com/showthread.php?747-bsSuperHeater