Log in

View Full Version : Simba just shuts down



Lordzsolt
05-04-2012, 05:26 PM
Trying to write my own combat script (first one), and I've followed YoHoJo's video tutorial (this one http://www.youtube.com/watch?v=qfumZWrm_DE&feature=youtu.be&hd=1), and for some reason, when I compile my script, Simba just shuts down.

Here's the script:


program DustDevils;
//{$i DEFINE SMART}
{$i srl/srl/misc/smart.simba}
{$i srl/srl.simba}
{$i srl/srl/misc/debug.simba}


const
Username = 'xxxxxx';
Password = 'xxxxxx';
TrainedSkill = 'Attack'; // Attack, Strength, Defence, Range
XPCounter = 2; // 1,2,3 (1st is usually total xp counter, so set trained level's counter to 2nd)
EatAt = 650;
Version = 1.0;

procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
with Players[0] do
begin
Name := UserName;
Pass := Password;
Active := True; //Blue Charms
end;
end;

procedure Attack;
var
cx,cy :Integer;
begin
//FindObjCustom(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol: Integer): Boolean;
If FindObjCustom(cx,cy,['Attack Dust' , 'Dust' , 'Devil', 't d'], ['5810887', '4818599', '4622238', '6006479'], 10) Then
WriteLn('Founda a Dust Devil!');
End;




begin
SetupSRL;
DeclarePlayers;
//Repeat
Attack;
//Until (false);
end.


It's a really basic script, just trying to test how well it can find certain objects (this case, dust devils).

Fletcher
05-04-2012, 05:50 PM
remove the two slashes, both places... you commented out the repeat statement so now it just goes through the script once and exits..

You use the slash to write comments in your script or to remove lines of code, anything after the two slashes will be skipped by the program. If you have large blocks of code you want to 'comment out' then use {these brackets around the code} ..


begin
SetupSRL;
DeclarePlayers;
//Repeat
Attack;
//Until (false);
end.

Home
05-04-2012, 06:10 PM
program DustDevils;
//{$i srl/srl/misc/smart.simba}
{$i srl/srl.simba}
{$i srl/srl/misc/debug.simba}


const
Username = 'xxxxxx';
Password = 'xxxxxx';
TrainedSkill = 'Attack'; // Attack, Strength, Defence, Range
XPCounter = 2; // 1,2,3 (1st is usually total xp counter, so set trained level's counter to 2nd)
EatAt = 650;
Version = 1.0;

procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
with Players[0] do
begin
Name := UserName;
Pass := Password;
Active := True; //Blue Charms
end;
end;

procedure Attack;
var
cx,cy :Integer;
begin
//FindObjCustom(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol: Integer): Boolean;
If FindObjCustom(cx,cy,['Attack Dust' , 'Dust' , 'Devil', 't d'], [5810887, 4818599, 4622238, 6006479], 10) Then
WriteLn('Founda a Dust Devil!');
End;




begin
SetupSRL;
DeclarePlayers;
//Repeat
Attack;
//Until (false);
end.


Problems:

I removed Define Smart, because you included already as a Include.
+ I commented out the Current Include SMART Line, so you can test this directly in browser.

Second thing is If FindObjCustom(cx,cy,['Attack Dust' , 'Dust' , 'Devil', 't d'], [5810887, 4818599, 4622238, 6006479], 10)

As you can see, now it is correctly, you were using Strings when it was asking Integers (Colors).

TStringArray = ['1', '2', '3', '4']
TIntegerArray = [1, 2, 3, 4]

Above are just an example how they should be declared.

Hit me up with questions, if any.

Keep it up mate! :)

~Home

Lordzsolt
05-04-2012, 06:50 PM
remove the two slashes, both places... you commented out the repeat statement so now it just goes through the script once and exits..

You use the slash to write comments in your script or to remove lines of code, anything after the two slashes will be skipped by the program. If you have large blocks of code you want to 'comment out' then use {these brackets around the code} ..


begin
SetupSRL;
DeclarePlayers;
//Repeat
Attack;
//Until (false);
end.


I intended to comment out the cycle, since I only wanted to test it once. And as of my experience with other compilers (mostly C++), the compiler itself doesn't close, only then Console



Hit me up with questions, if any.

Keep it up mate! :)

~Home

Thank you, nice to see that people here are nice and helpful to new ones :)