SRL Archive - MSI Suggestions

Switching to Script Based - Progress


Coh3n

2010-06-24 18:58:58

[INDENT]Alright, so I've started to work on this, and I'm going to continually update this thread as it goes for any input you guys may have. If you haven't already, please read Switching to "Script Based". As the idea expanded, I've decided to rewrite it so there is very little required to add a new script. What I'm hoping to do is have it so literally all you need to add is a script record, object records, and item records. That being said, how often does something go exactly as planned? :rolleyes:

The TScript Record
[PHP]
{ type TScript
Description: Stores information for MSI's supported scripts }
type
TScript = record
scriptName : string; //used for the progress report
scriptRuntime : integer; //used for the progress report
scriptTools : TIntegerArray; //the required tools for the script
skillName : string; //used for the progress report
skillConstant : integer; //the skill constants are in Players.scar (SRL)
objectConstants : TVariantArray; //the default objects to be autoed; // -> these are variant arrays
objectExperiences: TVariantArray; //the default experienced gained from each object // to avoid type mismatch // errors with the Player
itemNames : TVariantArray; //used for the progress report // global variables
itemConstants : TVariantArray; //used for setup and throughout MSI //
doesBank : boolean;
pathRefTo : TPointArray; //not TTile array because we want it to compile without reflection
pathRefFrom : TPointArray;
pathColorTo : TIntegerArray;
pathColorFrom : TIntegerArray;
playerSkillLevel : integer;
playerGainedExp : integer;
playerLoads : integer;
playerItemAmounts: TIntegerArray;
end;
[/PHP]

Other Changes
  • There's now a relocation feature that will relocate the player if an object isn't found. Right now, it only relocates if it can't find a bank as I need to talk to marpis more about is object finding functions to figure out exactly where to put the relocating.
  • Each script record includes a default objects list for that script. For example, the powerchopper will cut all the supported trees if they're found (NCDS, I haven't added your idea yet, but I haven't forgotten, don't worry ;)). However, there is still a PlayerObjects array in DeclarePlayers so the user can choose whatever objects they want. By default, the script will auto the default objects. If the user fills in the PlayerObjects array, it will overwrite the default objects. :)
  • There is no longer a bitmap element to TItem as we felt it was unnecessary and that DTMs and colour finding would suffice.
  • There are 100s of other small things that have been changed, so if you're really curious, check out the .diff file I have attached.

I have attached an updated .diff file for everything I've changed. I have tested a little bit with both banking and powerchopping and everything seems to be working perfectly. I will be updating all the MSI guides accordingly, plus expanding on most of them. :) Any testing is greatly appreciated.

I have committed my changes, if for some reason there is a major bug, you can always revert back a revision. :)

Cheers,
Coh3n[/INDENT]

NCDS

2010-06-24 23:04:44

Excellent job setting this up. Seeing this really helped me picture what you were describing.

And I really like this idea:

For example, a powerchopper would, by default, chop every type of tree that MSI supports. If the user doesn't like that, they can set it to only chop Willow trees, or Willow and Oak trees.

Coh3n

2010-06-24 23:05:50

Thanks :) I just thought of that as I was writing the thread. I'm actually working on that part right now.

NCDS

2010-06-24 23:17:35

From: Coh3n
Thanks :) I just thought of that as I was writing the thread. I'm actually working on that part right now.


Instead of making it chop just any tree that MSI supports, we should figure out what trees the character is capable of chopping. Then go for those ones. Just in case you weren't already planning that ;)

Coh3n

2010-06-24 23:19:13

From: NCDS
Instead of making it chop just any tree that MSI supports, we should figure out what trees the character is capable of chopping. Then go for those ones. Just in case you weren't already planning that ;)

Oo yeah good idea. I'm not sure how I'll do that, but I like it. :)

NCDS

2010-06-24 23:22:48

From: Coh3n
Oo yeah good idea. I'm not sure how I'll do that, but I like it. :)


Just add a 'Minimum Level' to the Tree records, get the characters level and do it that way. My thought's on it anyways.

Coh3n

2010-06-24 23:23:58

From: NCDS
Just add a 'Minimum Level' to the Tree records, get the characters level and do it that way. My thought's on it anyways.

Yeah, that's what I was thinking. I would check for this in the player setup procedure and edit the PlayerObjects array accordingly.

Nava2

2010-06-24 23:51:57

This would be freaking awesome if we had true OOP rather than pseudo. Inheritance anyone? :)

Great job, btw. Looks nice

Coh3n

2010-06-24 23:54:38

From: Nava2
This would be freaking awesome if we had true OOP rather than pseudo. Inheritance anyone? :)

Great job, btw. Looks nice

Thanks, and yeah I was thinking about that today. OOP would just be better in general…

Nava2

2010-06-24 23:59:20

From: Coh3n
Thanks, and yeah I was thinking about that today. OOP would just be better in general…


New language? :blink:

Coh3n

2010-06-25 00:03:38

Yeah, eventually.

Coh3n

2010-06-26 01:53:03

Added a Diff file of what I've done so far.

E: Updated first post again. :) It now compiles and can be tested. You have to apply a patch as I haven't committed anything yet.

3Garrett3

2010-06-26 11:27:46

So now someone just has to go on msn and roughly explain what is even going on. There were too many long posts in that thread, and my head hurts now, so yeah..

Coh3n

2010-06-26 12:01:35

From: 3Garrett3
So now someone just has to go on msn and roughly explain what is even going on. There were too many long posts in that thread, and my head hurts now, so yeah..

I'm on. If you just read this and the first thread, you should know what's going one. :p But I'll be happy to answer any questions.

3Garrett3

2010-06-26 12:03:34

There's like 50+ posts with like 10000+ words in them, I can't read all of that.

Coh3n

2010-06-26 12:04:48

From: 3Garrett3
There's like 50+ posts with like 10000+ words in them, I can't read all of that.

I meant just the first post of each thread. ;)

Coh3n

2010-06-26 16:41:27

I have committed this and updated the first post. :)

3Garrett3

2010-06-26 16:57:28


By default, the script will auto the default objects.


We aren't that dumb ;)

As discussed on msn, I largely understand now, and I'm sooo excited to try this stuff out after graduation. Most likely wednesday, when I'm not hungover from grad party.

Coh3n

2010-06-26 17:00:49

From: 3Garrett3
We aren't that dumb ;)

As discussed on msn, I largely understand now, and I'm sooo excited to try this stuff out after graduation. Most likely wednesday, when I'm not hungover from grad party.

Lol you never know. :p

Things should get rolling pretty quick now. We'll be making the switch to git in the next couple days also.

NCDS

2010-06-26 17:36:52

From: Coh3n
Lol you never know. :p

Things should get rolling pretty quick now. We'll be making the switch to git in the next couple days also.


Glad to see you've got this mostly finished. Good job!

If you haven't added the minimum level thing by tomorrow evening I can help you with it, or just do it or whatever. Anyway, we'll talk later ;)

Coh3n

2010-06-26 18:50:28

From: NCDS
Glad to see you've got this mostly finished. Good job!

If you haven't added the minimum level thing by tomorrow evening I can help you with it, or just do it or whatever. Anyway, we'll talk later ;)

Go for it. I won't have time to do anything else this weekend, and then I start work all over again. :p

marpis

2010-06-27 07:33:32

How are you going to do script that mines mithril when it's around and coal when not?
SCRIPT_MGUILD_COAL, SCRIPT_MGUILD_MITHRIL? Wouldn't this first mine coal only and when the script changes, mith only?
I'm very confused about this new script based system :rolleyes:

i luffs yeww

2010-06-27 07:40:14

^ Good point. If there's always coal around then mith would never be mined.

Gu3st...

2010-06-27 09:08:30

Like this:
SCRIPT_MGUILD_MITHRIL, SCRIPT_MGUILD_COAL

If it doesn't find mithril, then mine coal

Sir R. M8gic1an

2010-06-27 10:15:13

Script := [MINING_GUILD]
Objects := [ITEM_ORE_MITH, ITEM_ORE_COAL]

;)

~RM

Coh3n

2010-06-27 10:29:22

From: Rasta Magician
Script := [MINING_GUILD]
Objects := [ITEM_ORE_MITH, ITEM_ORE_COAL]

;)

~RM

^That. It's probably confusing because of the way the Varrock East area is laid out. The reason there will be SCRIPT_VE_TREES, SCRIPT_VE_OAKS, etc. is because the locations of the trees are so far apart and they require separate walking paths.

For a Guild Miner, there would be one path, and it would mine mith and coal by default (I would assume), unless set otherwise. Sorry if I confused anyone. :)

i luffs yeww

2010-06-27 20:44:01

^ Ahh, okay. :) Sorry, I just assumed it'd always be in descending order (trees, oaks, willows, maples, yews, magics, for example).

Coh3n

2010-06-27 21:45:54

From: i luffs yeww
^ Ahh, okay. :) Sorry, I just assumed it'd always be in descending order (trees, oaks, willows, maples, yews, magics, for example).

What would be in descending order?

i luffs yeww

2010-06-28 01:23:32

The things to cut/mine/etc.

Coh3n

2010-06-28 05:49:53

From: i luffs yeww
The things to cut/mine/etc.

It just goes in the order you choose depending on how you fill out PlayerObjects or the default if you choose to go that route.

i luffs yeww

2010-06-28 08:25:14

:p I know that now.. but I thought otherwise before.

Coh3n

2010-06-28 18:26:15

From: i luffs yeww
:p I know that now.. but I thought otherwise before.

I guess that would be what you meant in your above post. Lol I think my brain shut off yesterday. :duh: