SRL Archive - MSI Suggestions

Code in MSI before release


Sir R. M8gic1an

2010-04-14 13:26:29


{******************************************************************************}
{ function MSI_BestTool: Integer; }
{ By: Coh3n }
{ Description: Determines the best tool for the job at hand. }
{******************************************************************************}
function MSI_BestTool: Integer;
var
skillsArr: TStringArray;
currSkill, currLevel: Integer;
begin
if (not LoggedIn) then
Exit;

{ In order for this to work properly, the skillsArr indexes must correspond
to the skills constants in SRL's Players.scar }
skillsArr := [ 'attack', 'strength', 'defence', 'range', 'prayer', 'magic',
'runecrafting', 'hitpoints', 'agility', 'herblore', 'thieving',
'crafting', 'fletching', 'slayer', 'mining', 'smithing',
'fishing', 'cooking', 'firemaking', 'woodcutting', 'farming',
'construction', 'hunting', 'summoning' ];

{ Get the current level of the chosen skill, and then look for the required
tool, starting with the best one for that player's skill level. }
currSkill := PlayerSkills[CurrentPlayer][CurrentSkill] - 1;
currLevel := GetSkillLevel(skillsArr[currSkill]);

..
SRL has skill_SkillName in Players.scar, and GetSkillLevel takes integers. Why are we doing all this? Would it not be easier to just do

CurrLevel := GetSkillLevel(currSkill); ?

Also, Zeph just recently changed it so the skill array starts from 1 instead of 0.


Function MSI_GetItem(ID : Integer) : Boolean;
Begin
Case ID Of
//Test item xP
{
CAVADA_BERRIES :
With MSI_Item[CAVADA_BERRIES] Do
Begin
Name := 'Cadava Berries';
UpText := ['dava ber'];
ItemP := Point(0, 0);
Colors := [10033858, 8984493, 7804054, 6558079, 12001255, 9705915];
Stackable := True;
DTM := DTMFromString('78DA63CC616260E0606440066EBA9C0C22401A26CA980554C386A6C6'+
'C118554D0EA61A902C86391C04D4E401D570A1AA392A3D07D32E2EFC6E0600B439067C');

BMP := BitmapFromString(7, 7, 'beNoTrfVwMPGwM3G2NmRgYHTT5XTRASE3B2MIAgraa3A'+
'ASYggUDGEbaTABmEASSAyV2YH6oWwgYxpIuUdQjlAtoc+F5B8pbDzkfzmWsHkqSJlEAXXZFcdlZ6zVbI/lz8Mogto1G7JKWvFO+cCACNQHR0=');
End;

The With..Do statements should be indented.

Same for MSI_GetObject.


in MSI_IsMoving the comment have to be taken out.

{$IFDEF REFLECTION} should just simply be left there at all times. We just simply don't define ref. That's why it's done this way. IsMoving is in ColorWalking.scar

In Banking.scar Symbol accuracy and bitmap tol should use constants.


And that's all that I could see. I'd change it around myself, but still have a quite a few things to type out and i'm short on time.

~RM

Naum

2010-04-14 13:40:10

Sure, I'll get onto it :)

Coh3n

2010-04-14 14:17:26

For MSI_BestTool, I'm not exactly sure why I included the whole skill array. :o

I commented out the reflection defines in MSI_IsMoving because CharacterMoving wasn't working properly when I did use reflection.

Sir R. M8gic1an

2010-04-14 19:54:14

i just noticed that MSI_BestTool still needs taking care of >.>

~RM

Coh3n

2010-04-14 22:06:28

From: Rasta Magician
i just noticed that MSI_BestTool still needs taking care of >.>

~RM

It has been in my version… unless you're talking about another part of it?

Sir R. M8gic1an

2010-04-15 06:20:39

http://villavu.com/repositories/msi/Mainloop.scar


It's not on the main revision….


~RM

Coh3n

2010-04-15 10:16:11

What's not taken care of? :confused: