SRL Archive - General

MSI v2 TScriptRecord


Sir R. M8gic1an

2011-02-15 08:17:42

I'm calling it v2 cus a new TScriptRecord would infact break compatability.

This is not just so we call it v2, this is so we can better manage MSI :)

Records & Pointers are the main point behind the TScriptRecord.

and right now it is not finished, I am currently developing it as the ideas pop in my mind.


type
TBankType = record;
BankGenre: integer; //const power / bank / deposit box
BankLoc: integer; //location const
Tile: TTile; //or TPoint
BankBounds: TBox; // ---> check InBank by Dynamite, pretty much same idea except hybrid
end;

//const Option_All --> OptionMenu consts --> should be in SRL
//bank actions
TBankAction = record;
Withdraw: boolean; //false for deposit
Items: TIntegerArray;
Quantity: TIntegerArray;
end;

TScriptRecord = record;
ScriptID: integer //script const
ScriptName: String;
Location: integer;

BankAt: TBankType;
PreBank: TBankAction;
ActivityAt: integer; //location const
Activities: TPointerArray;
PostBank: TBankAction;
end;

//walking & Obstacles to be dealt with later,
//Activities being a TPointerArray allows for a whole load of flexibility

//WalkTo(ESSENCE_MINE, [OBS_DOOR, OBS_AUBURY]);
//WalkTo(BankAt.BankLoc, [OBS_PORTAL]);

PreBank being any withdrawing or depositing that needs doing before going to location. PostBank being the same when you return to bank with a full load.

StartScript
repeat
– PreBank
——- Do Load
– PostBank
until(false)

PostBank does NOT close the bank, so that PreBank can check again that we have all the required materials.

Sounding good so far?

And so you guys know, there's also an item/inv/bank manager / item recognizer coming up, based on Nielsie's blacklists. :)

And I'll leave my ideas here for now, so I don't talk too much without code to back it up :p

The point of this TScriptRecord is so we can do this:

MSIPlayers[0].Scripts := [S_GUILD_MINER, S_FALLY_SMELTER, S_VARROCK_SMITHER];
MSIPlayers[0].Scripts[0].Objects := [ORE_COAL, ORE_MITH]; //this would be set by default and CAN be changed by user
MSIPlayers[0].Scripts[1].Objects := [BAR_MITH]; //BAR_ALL, BAR_HIGHEST
MSIPlayers[0].Scripts[2].Objects := [MITH_PLATE];

~RM

Gu3st...

2011-02-15 10:40:06

I'm loving it RM :) Sounds really nice.
Just make sure there's support for scripts that doesn't include skills like gathering and questing scripts

Exactly why would you want to rename it "MSI v2" by the way?

Sir R. M8gic1an

2011-02-15 10:50:12

Just so we know what we're talking about. The TScriptRecord is one of the very core parts of MSI, and with this script record all compatability would break, meaning rewritting quite a bit of everything AND updating many of MSI's tutorials.

I don't really care about the name change, it does make it easier on us tho.. 'when is this to be implemented? - v2' ; 'This script is v2 compatible', etc

~RM

NCDS

2011-02-15 11:02:06

It all looks good to me, though I would rather have 'Items' in the Bank Record be a 2DArray so you could just do something like this:

Items := [TIntegerArray[ORE_COAL, 14], etc.];
Would be useful for when we add a SuperHeater and other things.

I don't really have an opinion on the 'v2', but things look good. :)

Sir R. M8gic1an

2011-02-15 11:15:06

From: NCDS
It all looks good to me, though I would rather have 'Items' in the Bank Record be a 2DArray so you could just do something like this:

Items := [TIntegerArray[ORE_COAL, 14], etc.];
Would be useful for when we add a SuperHeater and other things.

I don't really have an opinion on the 'v2', but things look good. :)


I had that on my mind too, just wasn't quite sure if and how it'd work anymore :p

Great! :D —> Although I'm not sure that's the best way to have it organized.. shall think

~RM

Coh3n

2011-02-15 15:19:00

From: Sir R. M8gic1an

The point of this TScriptRecord is so we can do this:

MSIPlayers[0].Scripts := [S_GUILD_MINER, S_FALLY_SMELTER, S_VARROCK_SMITHER];
MSIPlayers[0].Scripts[0].Objects := [ORE_COAL, ORE_MITH]; //this would be set by default and CAN be changed by user
MSIPlayers[0].Scripts[1].Objects := [BAR_MITH]; //BAR_ALL, BAR_HIGHEST
MSIPlayers[0].Scripts[2].Objects := [MITH_PLATE];

I prefer the way it is now:

with Scripts[0] do
begin
Objects := [ORE_COAL, ORE_MITH];
end;
Yes, it's longer, but it looks nicer IMO and I think would be easier for people to setup (I could be wrong on that though). And yes, every script will have to have it's defaults, just like they do now.

From: Sir R. M8gic1an
Great! :D —> Although I'm not sure that's the best way to have it organized.. shall think

~RM

I don't mind it actually. It's easy to understand. :)

I do think this change is a big enough one to call it MSI v2.0. I'm sure you know this, but this is an absolutely MASSIVE change. I mean, it's basically changing the entire structure of MSI (right now, everything's based around the TScript record).

Of course, I'm sure there will be a thousand bugs when this is done, so here's what I propose. We create a second branch in the MSI repository, call it MSI v2.0. So all these changes will be committed there rather than the stable branch. v2.0 will merge with v1.0 whenever 1.0 is updated (so v2.0 doesn't fall behind on other updates).

This way we can have anyone who wants test v2.0. Make sense?

E: I never actually said it - I love everything so far. I hope it will make parts of MSI much, much simpler. I feel like there's a lot of code in MSI that doesn't need to be so complicated, but I could be wrong. After all, we do deal with a lot of multi-dimensional array.

E2: In your example, what's the point of the Location attribute when you have the ActivityAt one? And… any thoughts about how to handle different skills? I like the idea of having Trees, Rocks, etc. rather than Objects; however, that means there's more cases, which frankly, is a pain (yes, I know that's how it is now). We can probably combine ideas from here to make skills work efficiently.

Gu3st...

2011-02-15 15:24:08

I disagree to this being a big enough change to call it v2…

Let me just link you to some threads here:
http://villavu.com/forum/showthread.php?t=57466
http://villavu.com/forum/showthread.php?p=719674

We didn't call it anything like v2 when we did changes like that, and that is imo a bigger change than this is…

Coh3n

2011-02-15 15:28:49

From: Zyt3x
We didn't call it anything like v2 when we did changes like that, and that is imo a bigger change than this is…

I wouldn't say they were bigger, but close. They both basically deal with the same thing.

And I don't think it occurred to anyone to call it a version 2. But again, we don't have to give it a version at all. We can just say it's a major structure update. It may be better to just leave it at MSI Phoenix. Then if for whatever reason it ever died, the people that revived it in 10 years could call it MSI Phoenix v2.0. :p

Gu3st...

2011-02-15 15:37:44

From: Coh3n
It may be better to just leave it at MSI Phoenix. Then if for whatever reason it ever died, the people that revived it in 10 years could call it MSI Phoenix v2.0. :p
That's exactly what I want :) ;)

Sir R. M8gic1an

2011-04-19 14:02:28

From: Coh3n

E: I never actually said it - I love everything so far. I hope it will make parts of MSI much, much simpler. I feel like there's a lot of code in MSI that doesn't need to be so complicated, but I could be wrong. After all, we do deal with a lot of multi-dimensional array.

E2: In your example, what's the point of the Location attribute when you have the ActivityAt one? And… any thoughts about how to handle different skills? I like the idea of having Trees, Rocks, etc. rather than Objects; however, that means there's more cases, which frankly, is a pain (yes, I know that's how it is now). We can probably combine ideas from here to make skills work efficiently.


Cheers;
Location would be (eg) Varrock or Varrock_West
Activity at then is (eg) Varrock_West_Mine or Varrock_West_Yews or Varrock_GE_Yews

This allows you to know you're in the general area of varrock, either in bank or at ActivityAt

And so if you wish to change skill,
you'll just…


Function ChooseNextScript(Skill: Integer; SameCity: Boolean): integer;
Notice: this makes for automated choosing of scripts rather than user selected scripts…
This would come in the AI branch of MSI, the one you just press play and watch things go ;)


Another view to this would be that it makes for less hassle for new users. They could just choose the skills, and MSI would take care of the rest.


//Do next skill in same city
x := ChooseNextScript(Player.Skills[i], true);

//do next skill in new city
if (x < 0)or(ChangeCity) then
x := ChooseNextScript(Players.Skills[i], false);


~RM

Coh3n

2011-04-19 14:29:40

Oh yeah absolutely. :) Love it. It would be really neat to eventually have the user enter username/password/skill, then it would walk to varrock east, chop normal trees, then oak trees, then yew trees, all in varrock.

This is long term though, but still great goals.

IPwnz

2011-04-19 21:42:11

From: Coh3n
Oh yeah absolutely. :) Love it. It would be really neat to eventually have the user enter username/password/skill, then it would walk to varrock east, chop normal trees, then oak trees, then yew trees, all in varrock.

This is long term though, but still great goals.


There's also the dream of being able to create a new character, then turn MSI on and let it level him up in Lumbridge with whatever skills the user wanted.

Coh3n

2011-04-19 23:10:19

From: IPwnz
There's also the dream of being able to create a new character, then turn MSI on and let it level him up in Lumbridge with whatever skills the user wanted.

Yeah. :p

We really need to get the community more involved before that happens.