SRL Archive - General

Picking up the pieces


Sir R. M8gic1an

2009-10-13 17:31:31

Ok guys, I'm picking up the pieces at the moment :)

NCDS is still up and about, so we now have the same number of (active) team members as when we first started.

As a quick introduction, here is the link to the include:
http://srl-msi.googlecode.com/svn/trunk/

and the include structure:

//SRL Includes
//{.include srl/srl/misc/smart.scar} --> disabled for now, not to be a pain in the ass while deving
{.include srl/srl.scar}
{.include srl/srl/reflection/reflection.scar}
{.include srl/srl/misc/Reports.scar}

//MSI Script
{.include srl/srl/MSI/Globals.scar}
{.include srl/srl/MSI/Debug.scar}
{.include srl/srl/MSI/ItemInfo.scar
{.include srl/srl/MSI/Objects.scar}
{.include srl/srl/MSI/Banking.scar}
{.include srl/srl/MSI/Walking.scar}

//MSI Skill Files
//{.include srl/srl/MSI/Skills/

//MSI Skill Loops, AI and Mainloop
{.include srl/srl/MSI/Skills.scar}
{.include srl/srl/MSI/MainLoop.scar}

Now, everything we have done so far is in the svn, or at least that is the assumption we will work under, so be sure to read through it.

There are a few nice pieces of code lying around however, and we should consider those. Finally, the project managers have come up with a listof constants that we'll also need to implement, basically item constants.

~RM

Sir R. M8gic1an

2009-10-13 17:32:04

This is a suggestion by blumblebee, to make the mainloop easier for us later on:
From: Blumblebee
We should keep the FindRock & FindTree Functions to the same parameters, thus allowing to do function pointers (I think thats what they're called) To allow easy organization and simple linkage.

ex:

Type
TSkill = Record
FindObj: Function(TP:TPoint; Index: Integer): Boolean;
FindEquipt: Function: Boolean;
end;

var Skill: TSkill;

Function FindRock(TP: Tpoint; Index: Integer): Boolean;
begin
end;

Function FindTree(TP: TPoint; Index: Integer): Boolean;
begin
end;


begin
case SetUp of
'Mining':
begin
FindObj := @FindRock;
FindEquipt := @FindPickaxe;
end;
'Woodcutting':
begin
FindObj := @FindTree;
FindEquipt := @FindHatchet;
end;
end;
end.


From: Rasta Magician
I do like the idea, but i'd say TSkill either works for all skills or we don't use it. There'll be a lot of thinking needed to make it work for all skills as some are completly different. But it might work…


Mining:
-- Setup -> SetupMining
-- Walk -> WalkToMine
-- FindIt -> FindRock
-- Track -> FollowRock
-- WaitWhile -> WaitUntilMined
-- WalkBack -> MineToBank

Fighting:
-- Setup -> GetEquip&Food
-- Walk -> WalkToMonster
-- FindIt -> FindMonster
-- Track -> GetInFight
-- WaitWhile -> WhileFighting (Eating, prayer, etc)
-- WalkBack -> WalkToBank (More food / inv full of drops)

RuneCrafting:
-- Setup -> Tiara / ammy, Ess
-- Walk -> WalkToAltar
-- FindIt -> [ FindTheAltar (while outside) GetToAltar (inside) Craft (inside) GetOutofAltar ]
-- Track -> @Empty
-- WaitWhile -> @Empty
-- WalkBack -> WalkToBank

Fletching:
-- Setup -> Get Knife & Logs
-- Walk -> @Empty
-- FindIt -> Click Knife, Logs, And make all
-- Track -> @Empty
-- WaitWhile -> Waits until all logs fletched. If level up(stops fletching) goes back to Find it
-- WalkBak -> @Empty

We could do it. We probably should shove in a banking function between Setup and Walk, and all banking needs would be dealt by that function.

Which would mean that we should also add Banking.scar to our list :)

~RM




~RM

Sir R. M8gic1an

2009-10-13 17:34:13

And this is a draft of the walking system, cazax has also already added abou a million constants for this in the svn, although some might need a lil renaming.


type
TheWalk = record;
City: integer;
Loc: integer;
Path: TPointArray;
end;

var
MyWalk: TheWalk;

const
City_Varrock = 0;
Loc_VEBank = 0;
Loc_VWBank = 1;
Loc_GEBank = 2;
Loc_VEM = 3;
Loc_NETree = 4;
Loc_ChurchYew = 5;
Loc_SWTree = 6;
Loc_GEYew = 7;
City_Falador = 1;
Loc_Bank = 0;
Loc_MGuild = 1;
Loc_Furnace = 2;

Function SetUpWalk(City, WhereTo: integer): TheWalk;
begin
case City of
City_Varrock:
begin
case WhereTo of

Loc_VEM:
begin
with Result do
begin
City := City_Varrock;
Loc := Loc_VEM;
Path := [
Point(3011, 3355), Point(3008, 3345), Point(3008, 3335), Point(3008, 3325),
Point(3017, 3321), Point(3026, 3316), Point(3033, 3314)
];
end;
end; //of Loc_VEM case

Loc_NETree:
begin
with Result do
begin
City := City_Varrock;
Loc := Loc_NETree;
Path := [
Point(3011, 3355), Point(3008, 3345), Point(3008, 3335), Point(3008, 3325),
Point(3017, 3321), Point(3026, 3316), Point(3033, 3314)
];
end;
end; // of Loc_NETree

end; // of WhereTo case

end; //of City_Varrock case

end; //end of City case
end;

Function WalkPath(Path: TPointArray): boolean;
begin
if not (Players[CurrentPlayer].Integers[P_Loc] = Loc_Bank) then
InvertTPA(Path);

//...
end;

Function LocationPoint(City, Loc: integer):TPoint;
begin
case City of
City_Varrock:
case Loc of
Loc_VEB: Result := Point(123, 345);
Loc_VWB: Result := Point(234, 456);
//...
end;

City_Falador:
case Loc of
Loc_FEB: Result := Point(123, 345);
Loc_FWB: Result := Point(234, 456);
end;

end;
end;

Function WhereAmI: TheWalk;
var
i, j, Dis, Closest_Dis: integer;
TP, Pos, Closest_TP, Closest_Info: TPoint;
begin
Pos := GetMyPos;
Dis_Closest := 1000;
for i:= 0 to HowManyCities do
for j:= HowManyLocs(i) do
begin
TP := LocationPoint(i, j);
Dis := (sqr(abs(Pos.X - TP.X)) + sqr(abs(Pos.Y - TP.Y)));

if (Dis < 7) then
begin
Result := SetUpWalk(i, j);
exit;
end;

if Dis < Closest_Dis then
begin
Closest_Dis := Dis;
Closest_Info := Point(i, j)
Closest_TP := TP;
end;
end;

//if we are here, it means we are too far from any point
//therefore, we will walk to the closest

Result := SetUpWalk(Closest_Info.x, Closest_Info.y);
WalkToInvisiblePoint(Closest_TP);
//WalkToInvisiblePoint = a function that'll generate it's own path and walk there.
end;

Procedure PlayerStringsToConstants;
begin
with Players[CurrentPlayer] do
begin
case lowercase(Loc) of
'varrock':
begin
Integers[P_City] := City_Varrock;
case lowercase(Strings[P_Loc]) do
begin
'netree' : Integers[P_Loc] := Loc_NETree;
'vem' : Integers[P_Loc] := Loc_VEM;
'churchyew' : Integers[P_Loc] := Loc_ChurchYew;
end;
end;

'falador':
begin
Integers[P_City] := City_Falador;
//...
end;
end;
end;
end;

//....
begin
PlayerStringsToConstants;
MyWalk := SetUpWalk(Players[CurrentPlayer].Integers[P_City], Players[CurrentPlayer].Integers[P_Loc]);
WalkPath(MyWalk.Path);
end.

Sir R. M8gic1an

2009-10-13 17:37:33

Finally, we'll also need to check who wants to do what, and I'd suggest using the types already in the svn with any necessary modifications for whatever you end up doing.

I'll be updating and revamping that thread tomorrow :) this should be enough for you guys to catch up on what's going on, and go ahead and read this thread, see what you are interested in. NCDS already said he is interested in doing objects.scar from now on.

Also, i find it likely that Globals.scar will be split into two files, Types.scar and Constants.scar

Lastly, do not forget to get your writting access ;)

~RM

marpis

2009-10-13 17:41:38

I can start with designing loops and all logical things, like ChangeLocation:Boolean etc, if no-one else is willing.

I can also do pretty good autocolors if needed.

E: Wrong thread I guess ^^