SRL Archive - MSI Suggestions

Scripts & DeclarePlayers


Coh3n

2010-10-05 23:03:26

This is just something I'm throwing out there for discussion. It's mainly an idea to keep everything organized and clear for both developers and users. Magic.simba has been in the works for quite some time now, and there's really no easy way to implement everything that's necessary.

I'm wondering what you guys think about making the DeclarePlayers script/skill-specific instead of having "Objects", "Priorities", etc. (attributes that are very general). What we have now works very well for the skills we have, but when we get into skills like magic or fighting, things could easily get disorganized and confusing.

This is what I thought of as I was writing this thread, and I'm liking it more and more. A new type (yes, another one!), TScriptSetup, that includes attributes specific to each script.

type
TScriptSetup = record
Script : Integer;
Rocks : TIntegerArray;
Trees : TIntegerArray;
FishSpots : TIntegerArray;
AlchItems : TIntegerArray;
Spells : TIntegerArray;
Monsters : TIntegerArray;
Priority : TIntegerArray;
DontDrop : TIntegerArray;

// May or may not be script specific
LoadsTotal: Integer;
LoadsBreak: Integer;
end;

with MSI_Players[1] do // Molly
begin
Name := '';
Pass := '';
Nick := '';
Pin := '';
Active := False;
Member := False;
Location := LOC_PS_DBOX;

with ScriptSetup[0] do
begin
Script := SCRIPT_POWER_CHOP;
Trees := [TREE_OAK, TREE_WILLOW];
Priority := [30, 70];
DontDrop := [MISC_BIRD_NEST];
end;

// This would be how to add another script to the player; by default the length of ScriptSetup can be 100 (like SRL's Players array)
with ScriptSetup[1] do
begin
Script := SCRIPT_FIGHTER;
CombatType := COMBAT_MAGIC;
Spell := SPELL_FIRE_BOLT;
Monsters := [DEMON_LESSER];
end;
end;
This would of course require us to create a function(s) to properly manipulate variables depending on the scripts, etc. Or maybe it would just require editing several functions.

Pros:
  • Much clearer player setup.
  • Clearer developing (I think).
  • No more multi dimension arrays! Well, there will still be some, but it won't be as bad.
  • Will be much easier to introduce new skills/scripts such as questers or gatherers.

Cons:
  • Can potentially have a very long DeclarePlayers when multiple script support is added, although I think that's a good trade (ease of setup for length).
  • I spent hours and hours getting all the multi dimension arrays to work, now I'm getting rid of it. :p

You may ask, "How will the user know which attributes to use?" Simple, we tell them. In the Supported Locations thread we have valid arguments for Location, Objects, etc., so why not this? Since they'll be script specific, we can easily add to the thread what the user simply needs to copy/paste into the DeclarePlayers.

I by no means think this will be rushed (unless we all think it's an amazing idea :p). I just want to discuss it and see what people think. Personally, I think it will be well worth it in the long run. Yes, it's a lot of work, but I can do it. Once I'm interested in something, I'll get it done. I'm sure there are several things everyone can do to pitch in also.

So, what do you guys think?

3Garrett3

2010-10-05 23:17:05

I dont have tons of time to read the actual code, I read the rest of the post. It seems like a good idea to me.

I vote do it.

Sir R. M8gic1an

2010-10-06 00:01:10

Sounds amazing! Especially this:

In the Supported Locations thread we have valid arguments for Location, Objects, etc., so why not this? Since they'll be script specific, we can easily add to the thread what the user simply needs to copy/paste into the DeclarePlayers.


It would be the easiest to setup script ever!

~RM

Coh3n

2010-10-06 00:54:44

From: Sir R. Magician
Sounds amazing! Especially this:


It would be the easiest to setup script ever!

~RM

Lol, I can't tell if you're if you're excited or sarcastic. I'm assuming excited, so thanks! :)

Gu3st...

2010-10-06 03:46:53

I agree, this would be a great way to do it :)
We should get the Form going. It wont have to be perfect (As we talked about in the other thread).
Would make it more user-friendly too :)

Coh3n

2010-10-06 12:53:51

From: Zyt3x
I agree, this would be a great way to do it :)
We should get the Form going. It wont have to be perfect (As we talked about in the other thread).
Would make it more user-friendly too :)

I forgot to mention that in the first post. Using this system, all the form components can be stored and only made visible when certain boxes are checked off.

I really hate to say this, but we may have been better off going with a traditional form that just gets the job done, rather than one that's flashy, but doesn't work properly and no one can figure out why.

NCDS

2010-10-06 12:55:53

I like it :)

I don't really know if it will solve our problems with people not knowing how to set it up, as the only reason they don't get it is because they are too lazy to look. Though I do really like this for implementing multiple scripts per player when the world walker is in MSI and it certainly makes things easier on us.

Coh3n

2010-10-06 12:57:42

From: NCDS
I don't really know if it will solve our problems with people not knowing how to set it up, as the only reason they don't get it is because they are too lazy to look. Though I do really like this for implementing multiple scripts per player when the world walker is in MSI and it certainly makes things easier on us.

It may not completely solve it, but it will sure as hell help. There won't be multidimension arrays for the user to setup, plus they'll have to copy/paste the script attributes so they HAVE to look. :p

Coh3n

2010-10-09 15:23:13

I'm probably going to start working on this, so I've moved it to public to get the user's opinions and suggestions if there are any.

E: Here's what I have so far. I just edited some types to make more sense. :)

(**
* Used to make it easier for users to setup and for scripters to follow the
* code around the include
*)
type
TScriptSetup = record
Script : Integer;
Rocks : TIntegerArray;
Trees : TIntegerArray;
FishSpots : TIntegerArray;
Priority : TIntegerArray;
DontDrop : TIntegerArray;
Loads : Integer;

// Not setup by the user
Items : array of TIntegerArray;
end;

(**
* Stores all the necessary script information for ease of adding new scripts
*)
type
TScript = record
Name : string;
Constant : Integer;
SkillName : string;
SkillConst : Integer;
BankType : TBank;
WhichBank : Integer;
AutoObjects : function: Boolean;
PlayerSetup : function: Boolean;
Defaults : TScriptSetup;
PathInfo : TPath;
end;

(**
* Stores the necessary information for a player's progress report
*)
type
TProggy = record
LoadsDone : Integer;
PlayerTime : Integer;
ScriptTime : TIntegerArray;
SkillLevels : TIntegerArray;
GainedExp : TIntegerArray;
Loads : TIntegerArray;
FalseReason : string;
Items : array of array of TIntegerArray;
ItemAmounts : array of array of TIntegerArray;
Experiences : array of array of TExtendedArray;
end;

(**
* MSI's custom player record; used to setup each player. TUser can be found in
* SRL (Players.scar)
*)
type
TPlayerInfo = record
Name : string;
Pass : string;
Nick : string;
Pin : string;
Active : Boolean;
Member : Boolean;
Location : Integer;
TotalLoads : Integer;
TotalTime : Integer;
Scripts : array[0..100] of TScriptSetup;

// Not setup by the user
ReportInfo : TProggy;
end;
The editing I did also allows us to get rid of the ProgressReportArray variable.

nickrules

2010-10-10 20:11:25

I think I understand it…. and I like it! would make it easy to add skills which don't use set items as 'best' items (runecrafting, magic, crafting(?), etc.)

NCDS

2010-10-12 20:05:30

From: Coh3n on MSN

Cohen says:
Hey do you mind making a post in MSI on the Scripts and DeclarePlayers thread saying that I'm working on it. My modem got fried in a power outage so internets been gone for a few days and will be gone for the rest of the week.

…

Coh3n

2010-10-25 02:30:26

This has now been committed. See this thread for more details. :)