SRL Archive - OSR Help

Troublesome Error


gamesqaure3d

2007-04-08 08:30:22

Hi, I've been having an error while trying to insert a form into my script. Here is my script:

program Miner;
{.include SRL\SRL.scar}
{.include SRL\SRL\Skill\Mining.scar}

var

Loads : Integer;
Ox, Oy: Integer;
frmDesign : TForm;
Label1 : TLabel;
Label2 : TLabel;
Button1 : TButton;
Edit1 : TEdit;
Edit2 : TEdit;

const

Rock=2371663; //Put the color of the Rock here.
pick=False;//If you have your Pick equipped, true, if not, false.
LoadsM=44;//How many loads to mine?
RunDirection='N';//What direction would you like to run in case of a random?

Procedure DeclarePlayers;
Begin

HowManyPlayers := 4;
NumberOfPlayers(HowManyPlayers);

Players[0].Name := Edit1.Text;
Players[0].Pass := Edit2.Text;
Players[0].Nick := 'game';

Writeln(inttostr(HowManyPlayers) + ' Players');
End;

procedure mine;
begin
repeat
if (FindMSColor(x,y,Rock)) then
MMouse(x,y,0,0);
ClickMouse(x,y,true);
wait(2500+random(100));
until(InvFull);
if(FindChatText('Lol'))or
(FindChatText('Rofl'))or
(FindChatText('Lmao'))or
(FindChatText('Roflmao'))then
begin
typesend('lol')
end;
end;

Procedure FindTheGas;
begin
if (not(Findgas(Ox,Oy))) then
begin
wait(100+random(100));
if (FindGas(Ox,Oy)) then
begin
wait(100+random(100));
RunAwayDirection(Rundirection);
Wait(1000+random(1000));
RunBack;
end;
end;
end;


procedure converse;
begin
if(FindChatText('Ok'))or
(FindChatText('K'))or
(FindChatText('No'))or
(FindChatText('Yes'))then
typesend('Im So BORED!!!!!!!!!!')
end;

procedure drop;
begin
if(pick)=True then
begin
typesend('brb…')
RunAwayDirection(RunDirection);
GameTab(4);
DropTo(1,28);
Wait(10000);
RunBack;
typesend('back')
Loads := Loads + 1;
end;
begin
if(pick)=False then
begin
typesend('brb…')
RunAwayDirection(RunDirection);
GameTab(4);
DropTo(2,28);
Wait(10000);
RunBack;
typesend('back')
Loads := Loads + 1;
If loads=LoadsM then
begin;
logout;
end;
end;
end;
end;

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

procedure ShowFormModal; // Default Code
begin
frmDesign.ShowModal;
end;

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

procedure ClickButton(sender: TObject); // Adding Buttons and Interactivity
begin

Writeln('Button Clicked!');
frmDesign.Caption:= frmDesign.Caption + '.';
frmDesign.ModalResult:= mrOk;
end;

Procedure InitForm;
begin
///////////////// Generated from: daForm.dfm
frmDesign := CreateForm;
frmDesign.Left := 250;
frmDesign.Top := 114;
frmDesign.Width := 271;
frmDesign.Height := 196;
frmDesign.Caption := 'frmDesign';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.ShowHint := True;
frmDesign.Visible := True;
frmDesign.PixelsPerInch := 96;
Label1 := TLabel.Create(frmDesign);
Label1.Parent := frmDesign;
Label1.Left := 12;
Label1.Top := 15;
Label1.Width := 74;
Label1.Height := 20;
Label1.Caption := 'Username';
Label1.Font.Color := clWindowText;
Label1.Font.Height := -17;
Label1.Font.Name := 'MS Sans Serif';
Label1.Font.Style := [];
Label1.ParentFont := False;
Label2 := TLabel.Create(frmDesign);
Label2.Parent := frmDesign;
Label2.Left := 13;
Label2.Top := 57;
Label2.Width := 69;
Label2.Height := 20;
Label2.Caption := 'Password';
Label2.Font.Color := clWindowText;
Label2.Font.Height := -17;
Label2.Font.Name := 'MS Sans Serif';
Label2.Font.Style := [];
Label2.ParentFont := False;
Button1 := TButton.Create(frmDesign);
Button1.Parent := frmDesign;
Button1.Left := 96;
Button1.Top := 100;
Button1.Width := 75;
Button1.Height := 25;
Button1.Caption := 'Start';
Button1.TabOrder := 8;
Edit1 := TEdit.Create(frmDesign);
Edit1.Parent := frmDesign;
Edit1.Left := 98;
Edit1.Top := 15;
Edit1.Width := 121;
Edit1.Height := 21;
Edit1.TabOrder := 9;
Edit2 := TEdit.Create(frmDesign);
Edit2.Parent := frmDesign;
Edit2.Left := 98;
Edit2.Top := 58;
Edit2.Width := 121;
Edit2.Height := 21;
Edit2.TabOrder := 10;
Edit2.Text := 'Edit2';
Button1.Onclick := @ClickButton;
end;


procedure AntiRandoms;
begin
FindTalk;
FindNormalRandoms;
if (FindFight = true) then
begin
RunAwayDirection(RunDirection);
Wait(10000 + random(2000));
RunBack;
end;
end;

procedure ProgReport;
begin
Writeln('- - - - - - - - - - - - - - - - - - - - -');
Writeln('You have worked for : ' + ScriptTime2(2))
Writeln('You have Mined ' +IntToStr(Loads)+' loads,');
Writeln('You have gained Aprox ' +IntToStr(Loads*945)+(' XP! '));
Writeln('- - - - - - - - - - - - - - - - - - - - -');
Writeln('{Thank you for using Games Auto Miner!—}');
Writeln('Games Autos!———————————————- ');
Writeln(' _________ ');
Writeln(' / ________| __________ ');
Writeln('/ / | _______| ');
Writeln('| | ________ | \ / | | ______ ');
Writeln('| | / / \ \ | \ / | |_______ / /____| ');
Writeln('| | ____ / / \ \ | \ \_/ / | |_______| / /____ ');
Writeln('| | | | / /_______ \ | |\ _ /| | | |____ / ');
Writeln('\ \______| | / / \ \ | | | | |________ / / ');
Writeln(' \_________| / / \ \ | | | |__________| ___/ / ');
end;

begin
SetupSRL;
DeclarePlayers;
SafeInitForm;
SafeShowFormModal;
repeat
if(not (LoggedIn)) then
LoginPlayer;
until(false)
repeat
ActivateClient;
antirandoms;
mine;
converse;
drop;
ProgReport;
FindTheGas;
until(false)
end.


and here is the Error I get:

Successfully compiled
Line 174: [Hint] (182:43): Variable 'NEWLINE' never used in script C:\Program Files\SCAR 2.03\includes\srl\srl\core\Globals.scar
SRL Compiled in 234msec.
[Runtime Error] : Could not call proc in line 29 in script C:\Program Files\SCAR 2.03\Scripts\Games Auto Miner 0.3.scar

Any help is appreciated
Thanks,
Games

King Black Dragon

2007-04-08 08:55:44

Ok, heres the problems you had…:

1. You had DeclarePlayers; before the form…so the DeclarePlayers; doesnt know whats Edit1.Text and Edit2.Text…so heres the fixed version…:

program Miner;
{.include SRL\SRL.scar}
{.include SRL\SRL\Skill\Mining.scar}

var

Loads : Integer;
Ox, Oy: Integer;
frmDesign : TForm;
Label1 : TLabel;
Label2 : TLabel;
Button1 : TButton;
Edit1 : TEdit;
Edit2 : TEdit;

const

Rock=2371663; //Put the color of the Rock here.
pick=False;//If you have your Pick equipped, true, if not, false.
LoadsM=44;//How many loads to mine?
RunDirection='N';//What direction would you like to run in case of a random?

Procedure DeclarePlayers;
Begin

HowManyPlayers := 4;
NumberOfPlayers(HowManyPlayers);

Players[0].Name := Edit1.Text;
Players[0].Pass := Edit2.Text;
Players[0].Nick := 'game';

Writeln(inttostr(HowManyPlayers) + ' Players');
End;

procedure mine;
begin
repeat
if (FindMSColor(x,y,Rock)) then
MMouse(x,y,0,0);
ClickMouse(x,y,true);
wait(2500+random(100));
until(InvFull);
if(FindChatText('Lol'))or
(FindChatText('Rofl'))or
(FindChatText('Lmao'))or
(FindChatText('Roflmao'))then
begin
typesend('lol')
end;
end;

Procedure FindTheGas;
begin
if (not(Findgas(Ox,Oy))) then
begin
wait(100+random(100));
if (FindGas(Ox,Oy)) then
begin
wait(100+random(100));
RunAwayDirection(Rundirection);
Wait(1000+random(1000));
RunBack;
end;
end;
end;


procedure converse;
begin
if(FindChatText('Ok'))or
(FindChatText('K'))or
(FindChatText('No'))or
(FindChatText('Yes'))then
typesend('Im So BORED!!!!!!!!!!')
end;

procedure drop;
begin
if(pick)=True then
begin
typesend('brb...')
RunAwayDirection(RunDirection);
GameTab(4);
DropTo(1,28);
Wait(10000);
RunBack;
typesend('back')
Loads := Loads + 1;
end;
begin
if(pick)=False then
begin
typesend('brb...')
RunAwayDirection(RunDirection);
GameTab(4);
DropTo(2,28);
Wait(10000);
RunBack;
typesend('back')
Loads := Loads + 1;
If loads=LoadsM then
begin;
logout;
end;
end;
end;
end;

procedure ClickButton(sender: TObject); // Adding Buttons and Interactivity
begin

Writeln('Button Clicked!');
frmDesign.Caption:= frmDesign.Caption + '.';
frmDesign.ModalResult:= mrOk;
end;

Procedure InitForm;
begin
///////////////// Generated from: daForm.dfm
frmDesign := CreateForm;
frmDesign.Left := 250;
frmDesign.Top := 114;
frmDesign.Width := 271;
frmDesign.Height := 196;
frmDesign.Caption := 'frmDesign';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.ShowHint := True;
frmDesign.Visible := False;
frmDesign.PixelsPerInch := 96;
Label1 := TLabel.Create(frmDesign);
Label1.Parent := frmDesign;
Label1.Left := 12;
Label1.Top := 15;
Label1.Width := 74;
Label1.Height := 20;
Label1.Caption := 'Username';
Label1.Font.Color := clWindowText;
Label1.Font.Height := -17;
Label1.Font.Name := 'MS Sans Serif';
Label1.Font.Style := [];
Label1.ParentFont := False;
Label2 := TLabel.Create(frmDesign);
Label2.Parent := frmDesign;
Label2.Left := 13;
Label2.Top := 57;
Label2.Width := 69;
Label2.Height := 20;
Label2.Caption := 'Password';
Label2.Font.Color := clWindowText;
Label2.Font.Height := -17;
Label2.Font.Name := 'MS Sans Serif';
Label2.Font.Style := [];
Label2.ParentFont := False;
Button1 := TButton.Create(frmDesign);
Button1.Parent := frmDesign;
Button1.Left := 96;
Button1.Top := 100;
Button1.Width := 75;
Button1.Height := 25;
Button1.Caption := 'Start';
Button1.TabOrder := 8;
Edit1 := TEdit.Create(frmDesign);
Edit1.Parent := frmDesign;
Edit1.Left := 98;
Edit1.Top := 15;
Edit1.Width := 121;
Edit1.Height := 21;
Edit1.TabOrder := 9;
Edit1.Text := 'Name';
Edit2 := TEdit.Create(frmDesign);
Edit2.Parent := frmDesign;
Edit2.Left := 98;
Edit2.Top := 58;
Edit2.Width := 121;
Edit2.Height := 21;
Edit2.TabOrder := 10;
Edit2.Text := 'Password';
Button1.Onclick := @ClickButton;
end;

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

procedure ShowFormModal; // Default Code
begin
frmDesign.ShowModal;
end;

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

procedure AntiRandoms;
begin
FindTalk;
FindNormalRandoms;
if (FindFight = true) then
begin
RunAwayDirection(RunDirection);
Wait(10000 + random(2000));
RunBack;
end;
end;

procedure ShowFormModal; // Default Code
begin
frmDesign.ShowModal;
end;

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

procedure AntiRandoms;
begin
FindTalk;
FindNormalRandoms;
if (FindFight = true) then
begin
RunAwayDirection(RunDirection);
Wait(10000 + random(2000));
RunBack;
end;
end;

procedure ProgReport;
begin
Writeln('- - - - - - - - - - - - - - - - - - - - -');
Writeln('You have worked for : ' + ScriptTime2(2))
Writeln('You have Mined ' +IntToStr(Loads)+' loads,');
Writeln('You have gained Aprox ' +IntToStr(Loads*945)+(' XP! '));
Writeln('- - - - - - - - - - - - - - - - - - - - -');
Writeln('{Thank you for using Games Auto Miner!---}');
Writeln('Games Autos!---------------------------------------------- ');
Writeln(' _________ ');
Writeln(' / ________| __________ ');
Writeln('/ / | _______| ');
Writeln('| | ________ | \ / | | ______ ');
Writeln('| | / / \ \ | \ / | |_______ / /____| ');
Writeln('| | ____ / / \ \ | \ \_/ / | |_______| / /____ ');
Writeln('| | | | / /_______ \ | |\ _ /| | | |____ / ');
Writeln('\ \______| | / / \ \ | | | | |________ / / ');
Writeln(' \_________| / / \ \ | | | |__________| ___/ / ');
end;

begin
SetupSRL;
SafeInitForm;
SafeShowFormModal;
DeclarePlayers;
repeat
if(not (LoggedIn)) then
LoginPlayer;
until(false)
repeat
ActivateClient;
antirandoms;
mine;
converse;
drop;
ProgReport;
FindTheGas;
until(false)
end.

gamesqaure3d

2007-04-08 09:08:26

Thanks Much

King Black Dragon

2007-04-08 13:32:53

From: gamesqaure3d
Thanks Much


np

rkroxpunk

2007-04-10 23:58:53

wtf how do all these 2 posters know so much….now i really feel utterly hopeless and stupid at scripting :(

legendaryhero90

2007-04-11 00:12:56

well it comes to show they are learning…

and ive seen SRL members with 10-50 post count so no worries

Rune Hacker

2007-04-11 00:31:10

Yea, some people learn quickly and others dont. Some can become members fast while others like legendaryhero90 are 100% active with 500+ posts and are still not members :) . Im about to go for members in a week.

Smartzkid

2007-04-11 01:09:35

:D I hold the current record for longest time waited till memberified

1k posts exactly


Back ontopic (not really)

KBD, nice…it seems that you know a bit about scripting…might you have been one of the scripters from long ago? Or, maybe, did you script at a different community?

Anyways, you show promise, keep up the good work

@Game:

In your 'Mine' procedure, I see you have something of a primitive autoresponder. You might want to make it a little more advanced by doing this:

if(FindChatText('Lol'))or
(FindChatText('Rofl'))or
(FindChatText('Lmao'))or
(FindChatText('Roflmao'))then
begin
case random(5) of
0:TypeSend('haha');
1:TypeSend('lol');
2:TypeSend('lool');
3:TypeSend('rofl');
4:TypeSend('lmao');
end;
end;

rkroxpunk

2007-04-11 02:35:52

[/Offtopic]Hey smartz are you jason and me still gonna go ahead with that mind crafter cos if ur not i guess jason isn't which means i will on my own lol[offtopic]

Smartzkid

2007-04-11 03:55:30

[offtopic] You still wanna? The other day I was gonna do some, but jason didn't feel like it…before that, I didn't feel like it… Now that I got accepted into members, I don't need to spend as much time on my application script, so I've got some extra time (still working on a newt eyer, and some other priv scripts) [/offtopic]

@Game: I assume this is a powerminer?

eddie

2007-04-15 15:14:03

From: legendaryhero90
well it comes to show they are learning…

and ive seen SRL members with 10-50 post count so no worries


*Looks Away*