SRL Archive - General

Splitting up the TScript Record


Coh3n

2010-12-28 15:02:20

This is an idea I got a couple days ago. Its a MAJOR change, and I'm not really sure about it. It would take several hours to make this update if it were to be done. The idea is that each skill would be split into it's own record, instead of one record for every type of script. The reason for this is that, currently, some parts of certain scripts are being overcomplicated to support another type of script.

For example, Woodcutting. There is only one item chopped from a tree, and because Fishing can have multiple items, we're treating all the Trees as if we can get Normal and Oak logs from a Normal Tree. See what I mean? I'm sure there would be several other examples as more skills were added.

This would also get rid of the TScriptSetup type because it would all be in one type for that skill. Here's my thought:

type
TWoodcuttingScript = record
Name: string;
Constant: Integer;
// + everything else
end;

var
MSI_WoodcuttingScripts: array of TWoodcuttingScript;
There would be a type and variable like that for each skill. Yes, I realize that Woodcutting, Mining and Fishing will be very similar, but it avoids a lot of confusion if they're split into different sections rather than mashed together.

Pros:
  • More orgainzed.
  • Easier to follow.
  • Easier to add new skills.

Cons:
  • Would take forever to actually make work.
  • Would have to loop through each variable if we wanted to loop through all the scripts.
  • All the scripts would be stored in separate vars instead of one (not really sure if this is good or bad right now).

Thoughts?

marpis

2010-12-28 15:42:35

I think it should have been made like this from the beginning.
I hope someone has the time.


type
TScript_WoodCutting = record
Objects: TIntegerArray;
AssociatedItems: TIntegerArray;
PathTo, PathFrom: T2DPointArray; // paths are 2D now with obstacles?
end;

TScript_Mining = record
Objects: TIntegerArray;
AssociatedItems: TIntegerArray;
PathTo, PathFrom: T2DPointArray; // paths are 2D now with obstacles?
end;

TScript_Fishing= record
Objects: TIntegerArray;
AssociatedItems: TIntegerArray;
PathTo, PathFrom: T2DPointArray; // paths are 2D now with obstacles?
end;

TScript_Magic = record
Spells: TIntegerArray; //SPELL_HIGHALCHEMY
Runes: TIntegerArray; // dunno how this would be done though, probably a GetRequiredRunes(spell: integer) function
Staves: TIntegerArray;
end;

Scratches, ofcourse.

NCDS

2010-12-28 16:36:01

Yeah, I like it. :) Certainly makes adding new things (such as skills) a lot less stressful and 'intimidating'.

Coh3n

2010-12-28 18:44:01

From: marpis
I think it should have been made like this from the beginning.
I hope someone has the time.


type
TScript_WoodCutting = record
Objects: TIntegerArray;
AssociatedItems: TIntegerArray;
PathTo, PathFrom: T2DPointArray; // paths are 2D now with obstacles?
end;

TScript_Mining = record
Objects: TIntegerArray;
AssociatedItems: TIntegerArray;
PathTo, PathFrom: T2DPointArray; // paths are 2D now with obstacles?
end;

TScript_Fishing= record
Objects: TIntegerArray;
AssociatedItems: TIntegerArray;
PathTo, PathFrom: T2DPointArray; // paths are 2D now with obstacles?
end;

TScript_Magic = record
Spells: TIntegerArray; //SPELL_HIGHALCHEMY
Runes: TIntegerArray; // dunno how this would be done though, probably a GetRequiredRunes(spell: integer) function
Staves: TIntegerArray;
end;

Scratches, ofcourse.

There are a lot of things that should/could have been done better since the beginning. The thing is, no one thinks of them then. :p

For the path, it would be PathInfo: TPath.

From: NCDS
Yeah, I like it. :) Certainly makes adding new things (such as skills) a lot less stressful and 'intimidating'.

Yeah, that's what I was thinking.

As for someone having time: I have lots, so I can probably eventually get it done, but I don't want to write it so we'll just end up changing it again in the future. I want to think about all possibilities.

3Garrett3

2010-12-28 18:57:52

To get to my point without repeating any info posted already: I like it.

Coh3n

2010-12-28 19:02:39

Lol, I was afraid everyone was going to like it. :p

While we're at it, let'd post anything we think could be done better/differently. If we're making a huge change like this, we may as well discuss others as well.

NCDS

2010-12-28 20:24:11

From: Coh3n

As for someone having time: I have lots, so I can probably eventually get it done, but I don't want to write it so we'll just end up changing it again in the future. I want to think about all possibilities.

Mine is pretty slim but should hopefully get better now that the holidays are pretty much over and I'm all moved in. Hopefully we'll be able to work together over IRC/MSN or something.

From: Coh3n

While we're at it, let'd post anything we think could be done better/differently. If we're making a huge change like this, we may as well discuss others as well.

I'll post them as I think of/find them. :)

Gu3st...

2010-12-28 21:16:14

I like this, but it would be a hell amount of work

Suggestion:
TDefaultScriptSettings = record
Name : Integer;
Constant : Integer;
// Everything else
end;
TWoodcuttingScript = record
Settings : TDefaultScriptSettings;
Objects: TIntegerArray;
AssociatedItems: TIntegerArray;
PathTo, PathFrom: T2DPointArray; // paths are 2D now with obstacles?
end;

NCDS

2010-12-28 21:48:23

From: Zyt3x

Suggestion:
TDefaultScriptSettings = record
Name : Integer;
Constant : Integer;
// Everything else
end;
TWoodcuttingScript = record
Settings : TDefaultScriptSettings;
Objects: TIntegerArray;
AssociatedItems: TIntegerArray;
PathTo, PathFrom: T2DPointArray; // paths are 2D now with obstacles?
end;


That would require us to do a 'Default' record for each skill anyways, otherwise it would be the same as it is now, no? Might as well set the defaults in ScriptSetup I say.

Coh3n

2010-12-29 02:02:56

Yeah I'm not really sure I see the point of it, Zyt3x. Care to elaborate?

Gu3st...

2010-12-29 18:12:42

It doesn't matter if we have
TWoodcuttingScript = record
*Name : Integer;
**Constant : Integer;
**…
end;

or

TWoodcuttingScript = record
**Default : TScriptSettings;
**…
end;

I just suggested it so that we wouldn't have to repeat as much code

Coh3n

2010-12-29 18:44:53

From: Zyt3x
It doesn't matter if we have
TWoodcuttingScript = record
*Name : Integer;
**Constant : Integer;
**…
end;

or

TWoodcuttingScript = record
**Default : TScriptSettings;
**…
end;

I just suggested it so that we wouldn't have to repeat as much code

Ah yes, that makes sense if we're going to have several of the same for each script (which I'm assuming we will).

After the discussion here, I'm putting this on hold (not like I was working on it before, but still, just so people know).