SRL Archive - MSI Suggestions

Idea for consts


marpis

2010-06-30 06:29:29

http://villavu.com/forum/showthread.php?t=57656

If we had TItems, TMSObjects, ActionExperiences etc. all in their own global arrays, we wouldn't need to have 432x10^4 consts for a tree.

Current: (assuming we will make objects a global array)
Object: Objects[OBJ_TREE_NORMAL]
Item: Items[ITEM_LOGS_NORMAL]
Exp: ???? I have no idea

My idea:
Object: Objects[C_TREE]
Item: Items[C_TREE] (Common sense says it's logs)
Exp: Experiences[C_TREE] (Exp from cutting it)

This would ease calculating experiences for progressreports and cut down number of constants.

EDIT: Oh, I just came across a problem. We have different experiences for cutting a normal tree and burning the logs, but we want to have just 1 const… Dang. Ok, the experiences can't be in a global array all at once. :-\

EDIT 2: Solution :) ActionExperiences[skill_WoodCutting][C_TREE] and ActionExperiences[skill_FireMaking][C_TREE]

Coh3n

2010-06-30 18:12:29

From: marpis
If we had TItems, TMSObjects, ActionExperiences etc. all in their own global arrays, we wouldn't need to have 432x10^4 consts for a tree.

Current: (assuming we will make objects a global array)
Object: Objects[OBJ_TREE_NORMAL]
Item: Items[ITEM_LOGS_NORMAL]
Exp: ???? I have no idea

My idea:
Object: Objects[C_TREE]
Item: Items[C_TREE] (Common sense says it's logs)
Exp: Experiences[C_TREE] (Exp from cutting it)

This would ease calculating experiences for progressreports and cut down number of constants.

I would rather see:
[PHP]
TREE_NORMAL = 0;
TREE_OAK = 1;
TREE_WILLOW = 3;
//…
[/PHP]
What was the 'C' supposed to stand for?

From: marpis

EDIT: Oh, I just came across a problem. We have different experiences for cutting a normal tree and burning the logs, but we want to have just 1 const… Dang. Ok, the experiences can't be in a global array all at once. :-\

EDIT 2: Solution :) ActionExperiences[skill_WoodCutting][C_TREE] and ActionExperiences[skill_FireMaking][C_TREE]


I was thinking about this earlier today. Instead of having an extra dimension in the array, we could just have a skill case in these functions.

Function LoadObjExperiences(Objects: TIntegerArray): TExtendedArray;
var
i, e: integer;
begin
for i := 0 to High(Objects) do
begin

e := 0;
case MSI_Player[CurrentPlayer].Script[CurrentScript].SkillConstant of
SKILL_WOODCUTTING:
case Objects[i] of
{Trees}
OBJ_TREE_NORMAL : e := 25.0;
OBJ_TREE_OAK : e := 37.5;
OBJ_TREE_WILLOW : e := 67.5;
OBJ_TREE_MAPLE : e := 100.0;
OBJ_TREE_YEW : e := 175.0;
OBJ_TREE_MAGIC : e := 250.0;
end;

SKILL_MINING:
case Objects[i] of
{Rocks}
OBJ_ROCK_CLAY : e := 5.0;
OBJ_ROCK_TIN : e := 17.5;
OBJ_ROCK_COPPER : e := 17.5;
OBJ_ROCK_IRON : e := 35.0;
OBJ_ROCK_SILVER : e := 40.0;
end;
end;

Result[i] := e;
end;
end;
I'm not sure how much I like this idea. I could see things getting very confusing, but I could be wrong. I want to see what some other people say. :)

Sir R. M8gic1an

2010-06-30 18:22:02

I prefer the case. I actually find it clearer, in both directions (array wise and function wise).

~RM

Coh3n

2010-07-02 11:37:42

I'm having second thoughts about this. Although it means there will more a lot more constants, I really don't see how that would help anything. The way we currently have it is very organized and clear. I honestly think we would run into problems later on. Because this is such a large project, we need to be perfectly clear as much as possible. Also, cutting down on the amount of constants won't noticeably effect anything.

I just don't think it's worth it.

E: Also, it makes ItemInfo.scar/Objects.scar a lot easier to understand (I know that's like the 4th time I've said it would be clearer, but I think it's really important).

Sir R. M8gic1an

2010-07-02 14:04:25

honestly, I dislike the OBJ_ and ITEM_ prefixes the most.

you're always going to cut a TREE_NORMAL and burn LOGS_NORMAL. Why do we need the prefixes?

And I agree with coh3n on keeping both LOGS_NORMAL and TREE_NORMAL.
Counting trees in inventory doesn't seem too likely..

~RM

Coh3n

2010-07-02 15:11:07

From: Rasta Magician
honestly, I dislike the OBJ_ and ITEM_ prefixes the most.

you're always going to cut a TREE_NORMAL and burn LOGS_NORMAL. Why do we need the prefixes?

And I agree with coh3n on keeping both LOGS_NORMAL and TREE_NORMAL.
Counting trees in inventory doesn't seem too likely..

~RM

I added ITEM_ because there was already OBJ_ and I was staying consistent. I can take those prefixes off, you're right, they aren't really needed. And I'll work on everything else, keeping the constants as they are (excluding prefix) for now.

Sir R. M8gic1an

2010-07-02 15:24:03

You seem to have been doing all the work lately coh3n..

~RM

Coh3n

2010-07-02 15:26:53

From: Rasta Magician
You seem to have been doing all the work lately coh3n..

~RM

Are you saying you'd like other people to do some? Would you like me to make more threads about changing certain things? I don't really know how to take that..

NCDS

2010-07-04 20:19:04

I've been messing with the VEM, I was just waiting for Coh3n to commit his core changes before I did too much to avoid conflict.

Sorry for off topic but just so you know I'm still here!

As far as the prefixes go, I don't think they are necessary. They just tell you what .SCAR/Simba to look in for the information really :p