I get this error whenever I try to enter in my login details into a form I made. Here is the saveform info procedure (I surrended with try, except to stop simba from crashing):
thanks to brandon for the help!
I get this error whenever I try to enter in my login details into a form I made. Here is the saveform info procedure (I surrended with try, except to stop simba from crashing):
thanks to brandon for the help!
Yes.. Well. Not that I can see but I know for sure that if you don't call SetupSRL before your Form Loads, then accessing the Player array is going to give you either index out of bounds or crash your Simba. Aka undefined behaviour.
We're going to need more than just a single proc to tell what is wrong.
I am Ggzz..
Hackintosher
@Officer Barbrady;
Nothing you just posted compiles.. In fact, it won't compile because:
1. AntiBan is both a boolean and a procedure.
2. Too many missing variables.. I had to guess which is which and initialize constant arrays because you never set an initial size.
3. Missing functions.. I had to guess which is which and create filler/dummy procs.
4. Fixing all of the above and removing antiban and Smart, the same script compiles and runs just fine.. So something else is undefined behaviour for you.
5. Word of advice. Make sure you post the "WHOLE" thing or PM it next time so I don't spend 5-10 minutes tweaking and fixing trying to figure out what the problem is. No one else would look at it or reply if it doesn't compile/work.
Simba Code:{$I SRL/SRL.Simba}
var
default: String;
BankLoc: String;
Profit, LogDTM, TME, Bows: Integer;
Pressed, PaintProgress, Debug, LogsReady, ChooseToolExists, ChooseTypeExists, AntiBan, FletchDone: Boolean;
DsgnForm: TForm;
P: TPageControl;
Tab1, Tab2: TTabSheet;
Fields: Array[0..2] of TEdit;
CheckBoxs: Array[0..2] of TCheckBox;
Combos: Array[0..1] of TComboBox;
TitleLabel: Array[0..2] of TLabel;
Buttons: Array[0..2] of TButton;
Procedure Settings;
begin
end;
Procedure SetDTMs;
begin
end;
Procedure Proggy;
begin
end;
Procedure Close_Bank;
begin
end;
Procedure FindChest;
begin
end;
Procedure CLickDOne;
begin
end;
Procedure BankAll;
begin
end;
Procedure With_Draw;
begin
end;
Procedure CLickFletch;
begin
end;
Procedure Fletch_Button;
begin
end;
Procedure humanMMouse(X, Y, Rx, Ry: Integer);
begin
end;
procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Nick := '';
Players[0].Active := True;
end;
procedure Setup;
begin
if not LoggedIn then LoginPlayer;
ExitSquealOfFortune;
//SmartSetRefresh(90);
AddOnTerminate('FreeDTMs');
ClickNorth(SRL_ANGLE_HIGH);
Profit := 45;
end;
procedure UseDefualt(Sender: TObject);
begin
Writeln('using script setttings.');
Pressed := true;
DeclarePlayers;
Settings;
SetDTMs;
DsgnForm.CLOSE;
end;
procedure Quit(Sender: TObject);
begin
Pressed := False;
Writeln('Script stopped');
DsgnForm.CLOSE;
end;
procedure Antimsg(Sender: TObject);
begin
case (CheckBoxs[0].Checked) of
True: writeln('ANTI BAN ON');
False: writeln('ANTI BAN OFF');
end;
end;
procedure progressmsg(Sender: TObject);
begin
case (CheckBoxs[1].Checked) of
True: writeln('PAINT ON');
False: writeln('PAINT OFF');
end;
end;
procedure bankmsg(Sender: TObject);
begin
case (CheckBoxs[2].Checked) of
True: writeln('BANK HIGHLIGHTING ON');
False: writeln('BANK HIGHLIGHTING OFF');
end;
end;
procedure SaveFormInfo(Sender: TObject);
begin
Try
pressed := True;
Writeln('Saving GUI info');
if (Fields[0].text <> 'Username') then Players[0].Name := Fields[0].text;
Writeln('1');
if (Fields[1].text <> 'Password') then Players[0].Pass := Fields[1].text;
Writeln('2');
if (Fields[2].text <> 'Pin') then Players[0].Pin := (Fields[2].text);
Writeln('3');
if ((Fields[2].text = 'Pin') or (Fields[0].text = 'Username') or (Fields[1].text = 'Password')) then
begin
DeclarePlayers;
Writeln('4');
end;
if (CheckBoxs[0].Checked) then Antiban := true;
if (CheckBoxs[1].Checked) then PaintProgress := true;
if (CheckBoxs[2].Checked) then Debug := true;
case (Combos[0].ITEMINDEX) of
0: LogDTM := DTMFromString('mbQAAAHicY2VgYHBiYmBwBmIPIHYEYhsgFmNkYBAEYkkglgFiUSAOMOFmCLfggeNYG14GQaB+dMyIBYMBAF2gBTA=');
1: LogDTM := DTMFromString('mbQAAAHicY2VgYHBiYmBwBmIPIHYEYhsgFmNkYBAEYkkglgFiUSAOMOFmCLfggeNYG14GQaB+dMyIBYMBAF2gBTA=');
2: LogDTM := DTMFromString('mbQAAAHicY2VgYHBiYmBwBmIPIHYEYhsgFmNkYBAEYkkglgFiUSAOMOFmCLfggeNYG14GQaB+dMyIBYMBAF2gBTA=');
3: LogDTM := DTMFromString('mbQAAAHicY2VgYHBiYmBwBmIPIHYEYhsgFmNkYBAEYkkglgFiUSAOMOFmCLfggeNYG14GQaB+dMyIBYMBAF2gBTA=');
4: LogDTM := DTMFromString('mbQAAAHicY2VgYHBiYmBwBmIPIHYEYhsgFmNkYBAEYkkglgFiUSAOMOFmCLfggeNYG14GQaB+dMyIBYMBAF2gBTA=');
5: LogDTM := DTMFromString('mbQAAAHicY2VgYHBiYmBwBmIPIHYEYhsgFmNkYBAEYkkglgFiUSAOMOFmCLfggeNYG14GQaB+dMyIBYMBAF2gBTA=');
end;
case (Combos[1].ITEMINDEX) of
0: BankLoc := 'SW';
1: BankLoc := 'CW';
end;
DsgnForm.CLOSE;
except
Writeln('***********************************');
Writeln('ERROR SAVING FORM INFO');
Writeln('***********************************');
end;
end;
procedure InitForm;
var
i, c, k, s, a: Integer;
Strings: TStringArray;
Points: TPointArray;
Parents, Sizes: TIntegerArray;
begin
DsgnForm := TForm.Create(nil);
with DsgnForm do
begin
Caption := 'Fletcher';
Left := 377;
Top := 380;
Width := 450;
Height := 260;
Font.Name := default;
Font.Color := clDefault;
Font.Size := 0;
end;
begin
P := TPageControl.Create(DsgnForm);
P.Parent := DsgnForm;
P.SetBounds(0, 0, 450, 260);
Tab1 := TTabSheet.Create(P);
Tab1.Caption := 'General';
Tab1.Visible := true;
Tab1.PageControl := P;
Tab2 := TTabSheet.Create(P);
Tab2.Caption := 'Options';
Tab2.Visible := true;
Tab2.PageControl := P;
tab2.PageControl := P;
end;
Strings := ['General', 'Options', 'Leave blank if already inside of script'];
Points := [Point(187, 20), Point(190, 20), Point(120, 120)];
Sizes := [15, 15, 10];
Parents := [0, 1, 0];
for k := 0 to high(TitleLabel) do
begin
TitleLabel[k] := TLabel.Create(DsgnForm);
TitleLabel[k].Parent := P.Pages[(Parents[k])];
TitleLabel[k].Caption := Strings[k];
TitleLabel[k].Left := Points[k].x;
TitleLabel[k].Top := Points[k].y;
TitleLabel[k].Width := 43;
TitleLabel[k].Height := 14;
TitleLabel[k].Font.Name := default;
TitleLabel[k].Font.Color := clDefault;
TitleLabel[k].Font.Size := Sizes[k];
end;
Strings := ['Username', 'Password', 'Pin'];
Points := [Point(80, 80), Point(180, 80), Point(280, 80)];
for s := 0 to high(Fields) do
begin
Fields[s] := TEdit.Create(DsgnForm);
Fields[s].Parent := P.Pages[0];
Fields[s].Text := Strings[s];
Fields[s].Left := Points[s].x;
Fields[s].Top := Points[s].y;
Fields[s].Width := 80;
Fields[s].Height := 21;
Fields[s].Font.Name := default;
Fields[s].Font.Color := clDefault;
Fields[s].Font.Size := 10;
end;
Points := [Point(80, 150), Point(240, 150)];
for a := 0 to high(Combos) do
begin
Combos[a] := TComboBox.Create(DsgnForm);
Combos[a].Parent := P.Pages[1];
Combos[a].Left := Points[a].x;
Combos[a].Top := Points[a].y;
Combos[a].Width := 100;
Combos[a].Height := 15;
case a of
0:
begin
Combos[a].Items.Add('Normal');
Combos[a].Items.Add('Oak');
Combos[a].Items.Add('Willow');
Combos[a].Items.Add('Maple');
Combos[a].Items.Add('Yew');
Combos[a].Items.Add('Magic');
end;
1:
begin
Combos[a].Items.Add('Soulwars');
Combos[a].Items.Add('Castlewars');
end;
end;
case a of
0: Combos[a].Text := 'Log type';
1: Combos[a].Text := 'Location';
end;
Combos[a].Font.Name := default;
Combos[a].Font.Color := clDefault;
Combos[a].Font.Size := 12;
end;
Strings := ['Start', 'Quit', 'Use script settings'];
Points := [Point(70, 190), Point(170, 190), Point(270, 190)];
Sizes := [10, 10, 8];
for i := 0 to high(Buttons) do
begin
Buttons[i] := TButton.Create(DsgnForm);
Buttons[i].Parent := P.Pages[0];
Buttons[i].Caption := Strings[i];
Buttons[i].Left := Points[i].x;
Buttons[i].Top := Points[i].y;
Buttons[i].Width := 100;
Buttons[i].Height := 25;
Buttons[i].Font.Size := Sizes[i];
case (i) of
0: Buttons[i].OnClick := @ SaveFormInfo;
1: Buttons[i].OnClick := @ Quit;
2: Buttons[i].OnClick := @ UseDefualt;
end;
end;
Strings := ['AntiBan', 'PaintProgress', 'Highlight bank'];
Points := [Point(50, 80), Point(150, 80), Point(270, 80)];
for c := 0 to high(CheckBoxs) do
begin
CheckBoxs[c] := TCheckBox.Create(DsgnForm);
CheckBoxs[c].Parent := P.Pages[1];
CheckBoxs[c].Left := Points[c].x;
CheckBoxs[c].Top := Points[c].y;
CheckBoxs[c].Width := 97;
CheckBoxs[c].Caption := Strings[c];
case (c) of
0: CheckBoxs[c].OnClick := @ Antimsg;
1: CheckBoxs[c].OnClick := @ progressmsg;
2: CheckBoxs[c].OnClick := @ bankmsg;
end;
end;
Writeln('GUI start time: ' + ToStr(TimeFromMark(tme)) + ' ms');
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
SetLength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
DsgnForm.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
SetLength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
procedure Loop;
var
t:Integer;
begin
Proggy;
ExitSquealOfFortune;
begin
case (Loggedin) of
True:
case (PinScreen) of
True:
begin
InPin(Players[0].Pin);
Wait(RandomRange(1400, 2000));
end;
False:
case (BankScreen) of
True:
case (logsready) of
True: Close_Bank;
False:
begin
BankAll;
Wait(200 + Random(100));
With_Draw;
Wait(RandomRange(800, 1100));
end;
end;
False:
case (logsready) of
True:
begin
ClickFletch;
case (ChooseToolExists) of
True:
begin
humanMMouse(259, 232 - 50, 10, 10);
Wait(RandomRange(35, 100));
ClickMouse2(Mouse_Left);
Wait(RandomRange(400, 700));
case (ChooseTypeExists) of
True:
begin
MarkTime(t);
humanMMouse(369, 361 - 50, 6, 6);
Wait(RandomRange(35, 100));
ClickMouse2(Mouse_Left);
repeat
Wait(RandomRange(35, 200));
//AntiBan;
Until (fletchdone) or (TimeFromMark(t)>60000);
if (fletchdone) then
begin
bows := bows+28;
clickdone;
exit;
end;
end;
False: exit;
end;
end;
False:
begin
Fletch_Button;
MarkTime(t)
repeat
Wait(RandomRange(35, 200));
//AntiBan;
Until (fletchdone) or (TimeFromMark(t)>60000);
if (fletchdone) then
begin
bows := bows+28;
clickdone;
exit;
end;
end;
end;
end;
False:
begin
FindChest;
Wait(RandomRange(600, 1200));
end;
end;
end;
end;
False:
begin
LoginPlayer;
Wait(RandomRange(600, 1200));
ExitSquealOfFortune;
ClickNorth(SRL_ANGLE_HIGH);
end;
end;
end;
end;
begin
setupsrl;
ClearDebug;
Writeln('if you want to close out of the GUI and not start the script then press quit');
Marktime(tme);
SafeInitForm;
SafeShowFormModal;
if (pressed = False) then TerminateScript;
if (pressed = true) then
begin
Setup;
repeat
loop;
until (false);
end;
end.
Last edited by Brandon; 06-19-2013 at 06:11 PM.
I am Ggzz..
Hackintosher
removed script.
Uhh add this:
Simba Code:HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
to your SaveForm Procedure and change your DeclaredPlayers to this..
Thus:
Simba Code:procedure DeclarePlayers;
begin
//WHatever else here.. Just not the above.
Players[0].Nick := '';
Players[0].Active := True;
end;
procedure SaveFormInfo(Sender: TObject);
begin
Try
pressed := True;
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Writeln('Saving GUI info');
if (Fields[0].text <> 'Username') then Players[0].Name := Fields[0].text;
Writeln('1');
if (Fields[1].text <> 'Password') then Players[0].Pass := Fields[1].text;
Writeln('2');
if (Fields[2].text <> 'Pin') then Players[0].Pin := (Fields[2].text);
Writeln('3');
if ((Fields[2].text = 'Pin') or (Fields[0].text = 'Username') or (Fields[1].text = 'Password')) then
begin
DeclarePlayers;
Writeln('4');
end;
//...... Fill in whatever else here.. I didn't want to copy the whole procedure.
//......
//......
end;
Last edited by Brandon; 06-19-2013 at 06:27 PM.
I am Ggzz..
Hackintosher
I love you.
There are currently 1 users browsing this thread. (0 members and 1 guests)