SRL Archive - Help and Support

Gimme a little feedback


Torrent of Flame

2011-04-13 10:55:33

So as anyone who was around 2 years ago would know, I haven't actually touched SIMBA or Pascal or anything of the sort since.. about.. 2 years ago.

So seeing as recently I broke up with my girlfriend of One and a half years (due to complications) I opened up SIMBA and ploughed into scripting to remove myself. I noticed a huge hole in the scripts, that is, no one's really done a soul wars one (unless my search has like.. massively failed me).

So, this is the start of my Soul Wars script. At the minute, tested,
  • it walks to the portals
  • enters the balance portal
  • checks if the zeal warning comes up
  • tells you what team you're on (and exits if you arent in a team (still need to put it to log out, though))
  • exits the starting gate when you enter SW

It still doesnt wait in the waiting room until you're in a game, but that wont take 10 minutes to run that proc.

Just want some feedback to see if I'm headed in the right direction, or anything glaring (other than maybe stick some colour failsafes in) that would make the script fail so far.

Thanks

program SoulWars;
{$DEFINE SMART}
{$i SRL/SRL.scar}
{$i Reflection/Reflection.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := ''; // your username
Players[0].Pass := ''; // your password
Players[0].Nick := ''; // 3-4 letters of your username
Players[0].Active := True; //Use this player or not?
end;

var
Team: integer;
{////////////////////////////////////////////////////////////////////////////////
Load Path
Path tiles for walking
////////////////////////////////////////////////////////////////////////////////}
function LoadPath(Path:Integer): TPointArray;
var
i, t: integer;
begin
if(Path = 0) then
begin
SetLength(Result, 1);
Result[0] := Point(1890, 3164);
end;
if (Path = 1) then
{BLUE RUN FROM INITIAL SPAWN}
begin
SetLength(Result, 2);
Result[0] := Point(1806, 3234);
Result[1] := Point(1806, 3247); //To Supplies
end;
if (Path = 2) then
begin
SetLength(Result, i);
for t := 0 to High(i) do
Result[t] := [Point(1967, 3231), Point(1967, 3216),
Point(1951, 3216), Point(1938, 3228),
Point(1923, 3235), Point(1922, 3239),
Point(1908, 3247){GETS TO NW OF OUTER GRAVEYARD SPAWN}]
end;
end;
{////////////////////////////////////////////////////////////////////////////////
Walk the Path
Walks to places..
////////////////////////////////////////////////////////////////////////////////}
function WalkThePath(PathNo: integer): boolean;
var
p: integer;
Path: TPointArray;
begin
if not LoggedIn then
Exit;
Path := LoadPath(PathNo);
for p := 0 to High(Path) do
begin
WalkToTile(Path[p], 1, 0);
FFlag(0);
Result := True;
end;
end;
{////////////////////////////////////////////////////////////////////////////////
Which Team
Determines what team we will be playing for
////////////////////////////////////////////////////////////////////////////////}
function WhichTeam: boolean;
var
rTile, bTile: TPoint;
begin
rTile := TileToMM(Tile(1930, 3173));
bTile := TileToMM(Tile(1872,3151));
if not rs_OnMiniMap(rTile.X, rTile.Y) then
if not rs_OnMiniMap(bTile.X, bTile.Y) then
begin
Writeln('Not in a portal, exiting..');
Exit;
Result := False;
end else
if rs_OnMiniMap(rTile.X, rTile.Y) then
begin
Team := 0;
end else
Team := 1;
if Team = 0 then
begin
Writeln('Playing for Red Team.');
end else
Writeln('Playing for Blue Team.');
end;
{////////////////////////////////////////////////////////////////////////////////
Check Chats
Enters Balance Portal if the warning about zeal comes up
////////////////////////////////////////////////////////////////////////////////}
function CheckChats: boolean;
begin
Wait(2000+Random(250));
begin
if FindNPCChatText('Warning', Nothing) then
begin
ClickContinue(True, False);
end ;
Wait(1500+Random(250));
if FindNPCChatText('Enter portal.', ClickLeft) then
Result := True;
end;
end;
{////////////////////////////////////////////////////////////////////////////////
Enter Portal
Enters Balance Portal using reflection.
////////////////////////////////////////////////////////////////////////////////}
function Enter_Portal: Boolean;
var
x, y, portalID: Integer;
MSPoint: TPoint;
begin
portalID := GetObjectAt(Point(1890, 3163),0).ID;
if (portalID = 42031) then
begin
MSPoint := TileToMS(Point(1890, 3163), 10);
MMouse(MSPoint.x, MSPoint.y, 10, 5);
wait(100 + Random(30));
getMousePos(x, y);
Mouse(x, y, 1, 1, True);
Result := True;
Writeln('Clicked Balance Portal');
end;
CheckChats;
Wait(2000+Random(250));
WhichTeam;
end;
{////////////////////////////////////////////////////////////////////////////////
Leave Spawn
Leaves red or blue initial spawn points
////////////////////////////////////////////////////////////////////////////////}
function LeaveSpawn: boolean;
var
MSPoint: TPoint;
x, y: integer;
ITile: TTile;
begin
if Team = 0 then
begin
ITile := Point(1958, 3239);
end else
ITile := Point(1958, 3239);
begin
WalkToTile(ITile, 1, 0);
MakeCompass('W');
MSPoint := TileToMS(ITile, 1);
MMouse(MSPoint.x, MSPoint.y, 2, y-RandomRange(45,55));
wait(100 + Random(30));
getMousePos(x, y);
Mouse(x, y, 1, 1, True);
Writeln('Left Spawn Point');
Result := True;
end;
end;
{////////////////////////////////////////////////////////////////////////////////
The main Soul Wars runtime loop
Enters Balance Portal using reflection.
////////////////////////////////////////////////////////////////////////////////}
function Play_SW: boolean;
begin
if Team = 0 then
begin
//Do this shit
end;
if Team = 1 then
begin
//Do this shit
end;
end;
{////////////////////////////////////////////////////////////////////////////////
Script Setup
Standard Script Setting up stuff.
////////////////////////////////////////////////////////////////////////////////}
procedure Script_Setup;
begin
Smart_Signed := True;
Smart_Server := 59;
Smart_SuperDetail := False;
SetupSRL;
SetupReflection;
DeclarePlayers;
LoginPlayer;
end;

begin
Script_Setup;
WalkThePath(0);
Enter_Portal;
// LeaveSpawn;
//WalkThePath(1);
end.

Echo_

2011-04-13 16:15:05

Looks good so far, a Soul Wars script has been requested several times by users.

Sorry about your girlfriend :(

Coh3n

2011-04-13 16:55:02

I didn't look too much in to it, but I would suggest using for..downto..do for path walking, so it can skip points if needed. Not really a huge deal, but can speed things up.

Harry

2011-04-13 16:58:33

Add some failsafes on the TileToMS, so if it returns -1 it won't try to move the mouse there. Except for failsafes, looks good so far, good luck.

Dervish

2011-04-14 07:15:23

From: Torrent of Flame
So as anyone who was around 2 years ago would know, I haven't actually touched SIMBA or Pascal or anything of the sort since.. about.. 2 years ago.

So seeing as recently I broke up with my girlfriend of One and a half years (due to complications) I opened up SIMBA and ploughed into scripting to remove myself. I noticed a huge hole in the scripts, that is, no one's really done a soul wars one (unless my search has like.. massively failed me).

So, this is the start of my Soul Wars script. At the minute, tested,
  • it walks to the portals
  • enters the balance portal
  • checks if the zeal warning comes up
  • tells you what team you're on (and exits if you arent in a team (still need to put it to log out, though))
  • exits the starting gate when you enter SW

It still doesnt wait in the waiting room until you're in a game, but that wont take 10 minutes to run that proc.

Just want some feedback to see if I'm headed in the right direction, or anything glaring (other than maybe stick some colour failsafes in) that would make the script fail so far.

Thanks

program SoulWars;
{$DEFINE SMART}
{$i SRL/SRL.scar}
{$i Reflection/Reflection.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := ''; // your username
Players[0].Pass := ''; // your password
Players[0].Nick := ''; // 3-4 letters of your username
Players[0].Active := True; //Use this player or not?
end;

var
Team: integer;
{////////////////////////////////////////////////////////////////////////////////
Load Path
Path tiles for walking
////////////////////////////////////////////////////////////////////////////////}
function LoadPath(Path:Integer): TPointArray;
var
i, t: integer;
begin
if(Path = 0) then
begin
SetLength(Result, 1);
Result[0] := Point(1890, 3164);
end;
if (Path = 1) then
{BLUE RUN FROM INITIAL SPAWN}
begin
SetLength(Result, 2);
Result[0] := Point(1806, 3234);
Result[1] := Point(1806, 3247); //To Supplies
end;
if (Path = 2) then
begin
SetLength(Result, i);
for t := 0 to High(i) do
Result[t] := [Point(1967, 3231), Point(1967, 3216),
Point(1951, 3216), Point(1938, 3228),
Point(1923, 3235), Point(1922, 3239),
Point(1908, 3247){GETS TO NW OF OUTER GRAVEYARD SPAWN}]
end;
end;
{////////////////////////////////////////////////////////////////////////////////
Walk the Path
Walks to places..
////////////////////////////////////////////////////////////////////////////////}
function WalkThePath(PathNo: integer): boolean;
var
p: integer;
Path: TPointArray;
begin
if not LoggedIn then
Exit;
Path := LoadPath(PathNo);
for p := 0 to High(Path) do
begin
WalkToTile(Path[p], 1, 0);
FFlag(0);
Result := True;
end;
end;
{////////////////////////////////////////////////////////////////////////////////
Which Team
Determines what team we will be playing for
////////////////////////////////////////////////////////////////////////////////}
function WhichTeam: boolean;
var
rTile, bTile: TPoint;
begin
rTile := TileToMM(Tile(1930, 3173));
bTile := TileToMM(Tile(1872,3151));
if not rs_OnMiniMap(rTile.X, rTile.Y) then
if not rs_OnMiniMap(bTile.X, bTile.Y) then
begin
Writeln('Not in a portal, exiting..');
Exit;
Result := False;
end else
if rs_OnMiniMap(rTile.X, rTile.Y) then
begin
Team := 0;
end else
Team := 1;
if Team = 0 then
begin
Writeln('Playing for Red Team.');
end else
Writeln('Playing for Blue Team.');
end;
{////////////////////////////////////////////////////////////////////////////////
Check Chats
Enters Balance Portal if the warning about zeal comes up
////////////////////////////////////////////////////////////////////////////////}
function CheckChats: boolean;
begin
Wait(2000+Random(250));
begin
if FindNPCChatText('Warning', Nothing) then
begin
ClickContinue(True, False);
end ;
Wait(1500+Random(250));
if FindNPCChatText('Enter portal.', ClickLeft) then
Result := True;
end;
end;
{////////////////////////////////////////////////////////////////////////////////
Enter Portal
Enters Balance Portal using reflection.
////////////////////////////////////////////////////////////////////////////////}
function Enter_Portal: Boolean;
var
x, y, portalID: Integer;
MSPoint: TPoint;
begin
portalID := GetObjectAt(Point(1890, 3163),0).ID;
if (portalID = 42031) then
begin
MSPoint := TileToMS(Point(1890, 3163), 10);
MMouse(MSPoint.x, MSPoint.y, 10, 5);
wait(100 + Random(30));
getMousePos(x, y);
Mouse(x, y, 1, 1, True);
Result := True;
Writeln('Clicked Balance Portal');
end;
CheckChats;
Wait(2000+Random(250));
WhichTeam;
end;
{////////////////////////////////////////////////////////////////////////////////
Leave Spawn
Leaves red or blue initial spawn points
////////////////////////////////////////////////////////////////////////////////}
function LeaveSpawn: boolean;
var
MSPoint: TPoint;
x, y: integer;
ITile: TTile;
begin
if Team = 0 then
begin
ITile := Point(1958, 3239);
end else
ITile := Point(1958, 3239);
begin
WalkToTile(ITile, 1, 0);
MakeCompass('W');
MSPoint := TileToMS(ITile, 1);
MMouse(MSPoint.x, MSPoint.y, 2, y-RandomRange(45,55));
wait(100 + Random(30));
getMousePos(x, y);
Mouse(x, y, 1, 1, True);
Writeln('Left Spawn Point');
Result := True;
end;
end;
{////////////////////////////////////////////////////////////////////////////////
The main Soul Wars runtime loop
Enters Balance Portal using reflection.
////////////////////////////////////////////////////////////////////////////////}
function Play_SW: boolean;
begin
if Team = 0 then
begin
//Do this shit
end;
if Team = 1 then
begin
//Do this shit
end;
end;
{////////////////////////////////////////////////////////////////////////////////
Script Setup
Standard Script Setting up stuff.
////////////////////////////////////////////////////////////////////////////////}
procedure Script_Setup;
begin
Smart_Signed := True;
Smart_Server := 59;
Smart_SuperDetail := False;
SetupSRL;
SetupReflection;
DeclarePlayers;
LoginPlayer;
end;

begin
Script_Setup;
WalkThePath(0);
Enter_Portal;
// LeaveSpawn;
//WalkThePath(1);
end.


I also recently broke up with my girlfriend. Well it was 3 months ago now but I know how you feel…

Cheer up Torrent ;), we love you.