Bad Processor
2009-01-21 12:58:21
Hey everyone. I feel I do not contribute enough to SRL itself. Sometimes I feel I am useless in certain things. So I decided to pull myself together and make a function which could make scripting that little bit easier. I just hope it hasn't been implemented already. The idea is this:
You have a script, and want to check a level hasn't leveled up. You have two point in your script:
1. the marker
2. a point where you want to check if a skill, eg. cooking, has leveled up the marker.
So, my idea is to make this slightly easier. Here is my code (feel free to use the list of skills in your script, or check if a curse\whatever has lowered your skill), also made to look like it is inside SRL:
Sorry if this isn't good enough. Maybe I just don't have the potential to make good things yet.:(
Please comment,
– BadProcessor
Edit: Oh Yeah, forgot to mention:
Use SetupSkillList at point 1
FindLevelUp at point 2
You have a script, and want to check a level hasn't leveled up. You have two point in your script:
1. the marker
2. a point where you want to check if a skill, eg. cooking, has leveled up the marker.
So, my idea is to make this slightly easier. Here is my code (feel free to use the list of skills in your script, or check if a curse\whatever has lowered your skill), also made to look like it is inside SRL:
var OldSkills: array [1..24] of Integer;
var SkillList: array [1..24] of string;
{*******************************************************************************
procedure SetupSkillList;
By: BadProcessor
Description: Use to setup everything.
*******************************************************************************}
procedure SetupSkillList;
var Forl: Integer;
begin
SkillList[1]:='attack';
SkillList[2]:='strength';
SkillList[3]:='ranged';
SkillList[4]:='magic';
SkillList[5]:='defence';
SkillList[6]:='craft';
SkillList[7]:='hp';
SkillList[8]:='pray';
SkillList[9]:='agility';
SkillList[10]:='herblore';
SkillList[11]:='thief';
SkillList[12]:='fish';
SkillList[13]:='runecraft';
SkillList[14]:='slay';
SkillList[15]:='farm';
SkillList[16]:='mine';
SkillList[17]:='smith';
SkillList[18]:='hunt';
SkillList[19]:='cook';
SkillList[20]:='fire';
SkillList[21]:='wc';
SkillList[22]:='fletch';
SkillList[23]:='construction';
SkillList[24]:='summoning';
for Forl:= 1 to 24 do begin
OldSkills[Forl]:= GetSkillLevel(SkillList[Forl]);
end;
end;
{*******************************************************************************
function FindLevelUp(SkillName:String): Boolean;
By: BadProcessor
Description: Checks if the selected skill has leveled up since the last call of
SetupSkillList.
*******************************************************************************}
function FindLevelUp(SkillName:String): Boolean;
var SkillNumber,Forl: Integer;
begin
SetupSkillList;
for Forl:= 1 to 24 do begin
if SkillName = SkillList[Forl] then begin
SkillNumber:= Forl;
end;
end;
if GetSkillLevel(SkillNumber) >= OldSkills[SkillNumber] then begin
Result:= True;
end;
end;
Sorry if this isn't good enough. Maybe I just don't have the potential to make good things yet.:(
Please comment,
– BadProcessor
Edit: Oh Yeah, forgot to mention:
Use SetupSkillList at point 1
FindLevelUp at point 2