SRL Archive - SRL Archives

My Functions and Procedures


TOB

2007-03-06 18:53:39

Alright, previously I have made a thread with new functions each time, instead I'll just update and bump this topic(delete last bump and recreate) every time I add to it. I'll probably not add much…

{*******************************************************************************
procedure FTWait2(Time: Integer);
By: TOB
Description: Performs Wait and FindTalk.
*******************************************************************************}
procedure FTWait2(Time: Integer);
var
t, r: Integer;
begin
repeat
r:= 200 + Random(50);
Wait(r);
t:= t + r;
FindTalk;
until(t >= time);
end;

{*****************************************************************************
procedure UnequipItem(itemPos: Integer);
By: TOB
Description: Unequips item in slot itemPos
*****************************************************************************}
procedure UnequipItem(itemPos: Integer);
var
equipmentXY: TPoint;
begin
if (WearingItem(itemPos)) then
begin
equipmentXY := EquipmentCoords(itemPos);
Mouse(equipmentXY.x, equipmentXY.y, 5, 5, True);
end;
end;

{*****************************************************************************
function CheckBareHandFightMode: String;
By: TOB
Description: Unequips item in weapon and shield spot then sets fight mode to fightMode
*****************************************************************************}
function CheckBareHandFightMode: Integer;
begin
UnequipItem(5);
UnequipItem(7);
GameTab(1);
if(GetColor(593, 273) = 2106253) then
Result:= 1
else if(GetColor(669, 265) = 2106253) then
Result:= 2
else if(GetColor(589, 326) = 2106253) then
Result:= 3;
end;

{*****************************************************************************
procedure SetBareHandFightMode(fightMode: Integer);
By: TOB
Description: If fightMode != CheckBareHandFightMode
*****************************************************************************}
procedure SetBareHandFightMode(fightMode: Integer);
var
curFightMode: Integer;
curFightModeStr: string;
begin
curFightMode:= CheckBareHandFightMode;
if(curFightMode = 1) then
curFightModeStr:= 'Attack'
else if(curFightMode = 2) then
curFightModeStr:= 'Strength'
else if(curFightMode = 3) then
curFightModeStr:= 'Defence';
if(fightMode = 1) and (not(curFightMode = fightMode)) then
begin
Mouse(593, 271, 20, 20, True);
WriteLn(TheTime + ' Fight mode changed from ' + curFightModeStr + ' to Attack.');
end else if(fightMode = 2) and (not(curFightMode = fightMode)) then
begin
Mouse(699, 275, 20, 20, True);
WriteLn(TheTime + ' Fight mode changed from ' + curFightModeStr + ' to Strength.');
end else if(fightMode = 3) and (not(curFightMode = fightMode)) then
begin
Mouse(589, 326, 20, 20, True);
WriteLn(TheTime + ' Fight mode changed from ' + curFightModeStr + ' to Defense.');
end;
end;

// Truncates an extended number if it's shows more than the desired
// place in the number. Ex. 50.3943948 = 50.39
// Original by Ron, improvement by TOB
function Trunc3(num: Extended; place: Integer): Extended;
var tmpResult: string;
begin
tmpResult := FloatToStr(num);
if(pos('.', tmpResult) > 0) then
Result := StrToFloat(copy(tmpResult, 1, pos('.', tmpResult) + place));
end;

function empty(v: Variant): Boolean;
begin
try
Result:= (v = '');
except
Result:= (v = 0);
end;
end;

{*****************************************************************************
function HowManyPlayersInactive: Integer;
By: TOB
Description: Counts how many players in the Players array are set to inactive
*****************************************************************************}
function HowManyPlayersInactive: Integer;
var
Player: Integer;
begin
for Player:= 0 to HowManyPlayers - 1 do
begin
if(Players[Player].Active = False) then
Result:= Result + 1;
end;
end;

{*****************************************************************************
function AllPlayersInactive: Boolean;
By: TOB
Description: Checks to see if all players are set to inactive
*****************************************************************************}
function AllPlayersInactive: Boolean;
var
InactivePlayers: Integer;
begin
InactivePlayers:= HowManyPlayersInactive;
if(InactivePlayers = HowManyPlayers) then
begin
WriteLn(TheTime + ' All players are inactive.');
Result:= True;
end;
end;

These next few I have modded from SRL 3.5:

{*******************************************************************************
procedure NextPlayerOrder(Active : Boolean);
By: WT-Fakawi
Description: Logs in CurrentPlayer. If Player[CurrentPlayer].Active = False,
then next Player attempts to login.
*******************************************************************************}
procedure NextPlayerOrder(Active: Boolean);
begin
Writeln('NextPlayer');
if not Active then
Players[CurrentPlayer].Active := False;
LogOut;
PlayerCurTime := (GetSystemTime div 1000);
Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + ((PlayerCurTime - PlayerStartTime) / 60);
CurrentPlayer := CurrentPlayer + 1;
if CurrentPlayer > HowManyPlayers - 1 then
CurrentPlayer := 0;
AllPlayersInactive;
if Players[CurrentPlayer].Active = True then
begin
Logs := Logs + 1;
end;
LoginPlayer;
end;

{*******************************************************************************
procedure RandomNextPlayer(Active: Boolean);
By: Dankness based on WT-Fawki's NextPlayer
Description: Picks Random Player that is Active and Logs in
*******************************************************************************}
procedure RandomNextPlayer(Active: Boolean);
var LastPlayer: Integer;
begin
Writeln('NextPlayer');
LastPlayer := CurrentPlayer;
if not Active then
Players[CurrentPlayer].Active := False;
LogOut;
PlayerCurTime := (GetSystemTime div 1000);
Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + ((PlayerCurTime - PlayerStartTime) / 60);
repeat
CurrentPlayer := Random(HowManyPlayers);
Wait(100);
AllPlayersInactive;
until (Players[CurrentPlayer].Active) and (CurrentPlayer <> LastPlayer);
if Players[CurrentPlayer].Active = True then
begin
Logs := Logs + 1;
end;
LoginPlayer;
end;

{*******************************************************************************
procedure NextPlayer(Active: Boolean);
By: Dankness
Description: Logs in the next player.
Boolean: True - Current player is ok. False - Current player is false.
*******************************************************************************}
procedure NextPlayer(Active: Boolean);
begin
if RandomPlayer then
RandomNextPlayer(Active)
else
begin
Writeln('NextPlayer');
if not Active then
Players[CurrentPlayer].Active := False;
LogOut;
PlayerCurTime := (GetSystemTime div 1000);
Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + ((PlayerCurTime - PlayerStartTime) / 60);
CurrentPlayer := CurrentPlayer + 1;
if CurrentPlayer > HowManyPlayers - 1 then
CurrentPlayer := 0;
AllPlayersInactive;
if Players[CurrentPlayer].Active = True then
begin
Logs := Logs + 1;
end;
LoginPlayer;
end;
end;

{*******************************************************************************
procedure ClickCurrentPos(ranX, ranY: Integer; Left: Boolean);
by: TOB
Description: Clicks where current mouse position is with a little randomness
*******************************************************************************}
procedure ClickCurrentPos(ranX, ranY: Integer; Left: Boolean);
var
negRanX, negRanY: Integer;
begin
GetMousePos(x, y);
if(ranX > 0) then
negRanX:= Random(ranX) + 1;
if(ranY > 0) then
negRanY:= Random(ranY) + 1;
Mouse(x, y, ranX - negRanX, ranY - negRanY, Left);
end;

{*******************************************************************************
function InPin2(pin: String): Boolean;
by: TOB
Description: Puts in bank pin. Results True if BankScreen is open
*******************************************************************************}
function InPin2(pin: String): Boolean;
var
iNumber: Integer;
begin
if(FindText(x, y, 'First', Upchars, 175, 80, 212, 100)) then
begin
Wait(200 + random(200));
if(not(ClickText2(Pin[1], UpChars, 1, 1, 512, 336, True))) then ClickCurrentPos(5, 5, True);
Wait(500 + Random(500));
repeat
Wait(100);
if(not(LoggedIn)) then Exit;
until(FindText(x, y, 'Now', Upchars, 168, 80, 200, 100));
Wait(200 + random(200));
if(not(ClickText2(Pin[2], UpChars, 1, 1, 512, 336, True))) then ClickCurrentPos(5, 5, True);
Wait(500 + Random(500));
repeat
Wait(100);
if(not(LoggedIn)) then Exit;
until(FindText(x, y, 'Time', Upchars, 180, 80, 212, 100));
Wait(200 + random(200));
if(not(ClickText2(Pin[3], UpChars, 1, 1, 512, 336, True))) then ClickCurrentPos(5, 5, True);
Wait(500 + Random(500));
repeat
Wait(100);
if(not(LoggedIn)) then Exit;
until(FindText(x, y, 'Finally', Upchars, 175, 80, 222, 100));
Wait(200 + random(200));
if(not(ClickText2(Pin[4], UpChars, 1, 1, 512, 336, True))) then ClickCurrentPos(5, 5, True);
Wait(500 + Random(500));
repeat
Wait(100);
until BankScreen or not loggedin;
end;
if(BankScreen) then Result:= True;
end;

{*******************************************************************************
function SymbolExists(Name: String): Boolean;
By: TOB
Description: Finds if minimap symbol exists by name.
*******************************************************************************}
function SymbolExists(Name: string): Boolean;
var
necessaryx, necessaryy: Integer;
begin
if (GetSymbolColor(necessaryx, necessaryy, Lowercase(Name)) > 0) then
Result := True;
end;

{*******************************************************************************
function ClickSymbolIfExists(symbol: string): Boolean;
By: TOB
Description: Clicks if minimap symbol exists by name.
*******************************************************************************}
function ClickSymbolIfExists(symbol: string): Boolean;
var
necessaryx, necessaryy: Integer;
begin
if((GetSymbolColor(necessaryx, necessaryy, Lowercase(symbol)) > 0)) then
Result:= True;
if(Result) then
begin
Mouse(necessaryx, necessaryy, 10, 10, True);
Flag;
PerfectNorth;
end;
end;

procedure DirWalkUntilSymbol(dir, symbol: string; timeoutSec: Integer; clickWhenFound: Boolean);
var
StartDirWalk: Integer;
begin
MakeCompass(Lowercase(dir));
if(not(SymbolExists(symbol))) then
begin
MarkTime(StartDirWalk);
repeat
MakeCompass(Lowercase(dir));
Mouse(645, 35, 10, 8, True);
Writeln('Walking direction ' + dir + ' until ' + symbol + ' symbol is found.');
if(timeoutSec > 0) then
Writeln(' ' + IntToStr(TimeFromMark(StartDirWalk)) + '/' + (IntToStr(timeoutSec * 1000)) + ' milliseconds passed while searching.')
else
Writeln(' No timeout.');
FFlag(20);
if((TimeFromMark(StartDirWalk) > Seconds(timeoutSec)) and (timeoutSec > 0)) then Break;
until(SymbolExists(symbol));
end;
FindSymbol(x, y, symbol);
Mouse(645, y, 10, 8, True);
Flag;
Writeln(symbol + ' symbol found.');
if(clickWhenFound) then
ClickSymbolIfExists(symbol);
end;

{*******************************************************************************
function TimesNeededToLvl(Skill, Item, Task: string): Integer;
By: TOB
Description: Returns number of times needed to perform Task on Item to level up Skill
*******************************************************************************}
function TimesNeededToLvl(Skill, Item, Task: string): Integer;
var
tmpResult: Extended;
begin
tmpResult:= XpTilNextLevel(Skill, False) / GetExp(Item, Task);
if(tmpResult > Round(tmpResult)) then
Result:= Round(tmpResult) + 1
else
Result:= Round(tmpResult);
end;

{*******************************************************************************
function TimesNeededToExp(Skill, Item, Task: string; ToExp: Integer): Integer;
By: TOB
Description: Returns number of times needed to perform Task on Item to ToExp
*******************************************************************************}
function TimesNeededToExp(Skill, Item, Task: string; ToExp: Integer): Integer;
var
tmpResult: Extended;
begin
if(ToExp < CurrentSkillXp2(Skill)) then
begin
Result:= 0;
Exit;
end else
begin
tmpResult:= XpTilNextLevel(Skill, False) / GetExp(Item, Task);
if(tmpResult > Round(tmpResult)) then
Result:= Round(tmpResult) + 1
else
Result:= Round(tmpResult);
end;
end;

{*******************************************************************************
function TimesNeededToExpEx(Item, Task: string; FromExp, ToExp: Integer): Integer;
By: TOB
Description: Returns number of times needed to perform Task on Item to ToExp from FromExp
*******************************************************************************}
function TimesNeededToExpEx(Item, Task: string; FromExp, ToExp: Integer): Integer;
var
tmpResult: Extended;
begin
if(ToExp < FromExp) then
begin
Result:= 0;
Exit;
end else
begin
tmpResult:= (ToExp - FromExp) / GetExp(Item, Task);
if(tmpResult > Round(tmpResult)) then
Result:= Round(tmpResult) + 1
else
Result:= Round(tmpResult);
end;
end;

// * function GetExp(item, task: String): Extended;   // * TOB
{*******************************************************************************
function GetExp(item, task: String): Extended;
By: TOB
Description: Returns the experience for a doing/making item.
*******************************************************************************}
function GetExp(Item, Task: String): Extended;
begin
Item:= Task + '_' + Item;
case LowerCase(Item) of
//
//Agility Experience
//
'agility_pyramid entrance' : Result := 6;
'agility_pyramid floor 1' : Result := 116;
'agility_pyramid floor 2' : Result := 128;
'agility_pyramid floor 3' : Result := 72;
'agility_pyramid floor 4' : Result := 64;
'agility_pyramid floor 5' : Result := 34;
'agility_pyramid total' : Result := 1014;
'agility_gnome' : Result := 86.5;
'agility_barbarian' : Result := 153.2;
'agility_werewolves ' : Result := 540;
'agility_wilderness' : Result := 571.4;
'agility_ape atoll' : Result := 580;
'agility_yanille' : Result := 55.5;
'agility_brimhaven' : Result := 234;

//
//Fishing Experience
//
'fish_shrimp' : Result:= 10;
'fish_karambwanji' : Result:= 10;
'fish_sardine' : Result:= 20;
'fish_herring' : Result:= 30;
'fish_anchovy' : Result:= 40;
'fish_mackerel' : Result:= 20;
'fish_trout' : Result:= 50;
'fish_cod' : Result:= 45;
'fish_pike' : Result:= 60;
'fish_slimey eel' : Result:= 65;
'fish_salmon' : Result:= 70;
'fish_frog spawn' : Result:= 75;
'fish_tuna' : Result:= 80;
'fish_cave eel' : Result:= 80;
'fish_lobster' : Result:= 90;
'fish_bass' : Result:= 100;
'fish_swordfish' : Result:= 100;
'fish_lava eel' : Result:= 60;
'fish_karambwan' : Result:= 105;
'fish_monkfish' : Result:= 120;
'fish_shark' : Result:= 110;
'fish_sea turtle' : Result:= 38;
'fish_manta ray' : Result:= 46;

//
//Herb Identification Experience
//
'identify_guam leaf' : Result:= 2.5;
'identify_marrentill' : Result:= 3.8;
'identify_tarromin' : Result:= 5;
'identify_harralander' : Result:= 6.3;
'identify_ranarr weed' : Result:= 7.5;
'identify_toadflax' : Result:= 8;
'identify_irit leaf' : Result:= 8.8;
'identify_avantoe' : Result:= 10;
'identify_kwuarm' : Result:= 11.3;
'identify_snapdragon' : Result:= 11.8;
'identify_cadantine' : Result:= 12.5;
'identify_lantadyme' : Result:= 13.1;
'identify_dwarf weed' : Result:= 13.8;
'identify_torstol ' : Result:= 15;

//
//Potion experience
//
'potion_attack' : Result:= 25;
'potion_antipoison' : Result:= 37.5;
'potion_strength' : Result:= 50;
'potion_restore' : Result:= 62.5;
'potion_energy' : Result:= 67.5;
'potion_defence' : Result:= 75;
'potion_agility' : Result:= 80;
'potion_combat' : Result:= 84;
'potion_prayer' : Result:= 87.5;
'potion_super attack' : Result:= 100;
'potion_super antipoison' : Result:= 106;
'potion_fishing' : Result:= 112.5;
'potion_super energy' : Result:= 117.5;
'potion_super strength' : Result:= 125;
'potion_magic essence' : Result:= 130;
'potion_weapon poison' : Result:= 137.5;
'potion_super restore' : Result:= 142.5;
'potion_super defence' : Result:= 150;
'potion_extra-strong antidote' : Result:= 155;
'potion_antifire' : Result:= 157.5;
'potion_ranging' : Result:= 162.5;
'potion_weapon poison(+)' : Result:= 165;
'potion_magic' : Result:= 172.5;
'potion_zamorak brew' : Result:= 175;
'potion_super-strong antidote' : Result:= 177.5;
'potion_saradomin brew' : Result:= 180;
'potion_weapon poison(p++)' : Result:= 190;

//
//Hunting Experience
//
'hunting_crimson swift' : Result:= 34;
'hunting_golden warbler' : Result:= 48;
'hunting_copper longtail' : Result:= 61;
'hunting_cerulean twitch' : Result:= 65;
'hunting_tropical wagtail' : Result:= 96;
'hunting_polar kebbit' : Result:= 30;
'hunting_common kebbit' : Result:= 36;
'hunting_feldip kebbit' : Result:= 48;
'hunting_desert devil' : Result:= 66;
'hunting_razorbacked kebbit' : Result:= 348;
'hunting_ruby harvest' : Result:= 24;
'hunting_sapphire galcialis' : Result:= 34;
'hunting_snowy knight' : Result:= 44;
'hunting_black warlock' : Result:= 54;
'hunting_wild kebbit' : Result:= 128;
'hunting_barbtailed kebbit' : Result:= 168;
'hunting_prickly kebbit' : Result:= 204;
'hunting_sabretooth kebbit' : Result:= 200;
'hunting_swamp lizard' : Result:= 152;
'hunting_orange salamander' : Result:= 224;
'hunting_red salamander' : Result:= 272;
'hunting_black salamander' : Result:= 304;
'hunting_spotted kebbit' : Result:= 104;
'hunting_dark kebbit' : Result:= 132;
'hunting_dashing kebbit' : Result:= 156;
'hunting_chinchompa' : Result:= 198.5;
'hunting_red chinchompa' : Result:= 265;
'hunting_spined larupia' : Result:= 180;
'hunting_horned graahk' : Result:= 240;
'hunting_sabretooth kyatt' : Result:= 300;
'hunting_imp' : Result:= 450;

//
//Woodcutting Experience
//
'wc_regular' : Result:= 25;
'wc_charcoal tree' : Result:= 25;
'wc_light jungle' : Result:= 32;
'wc_oak' : Result:= 37.5;
'wc_medium jungle' : Result:= 55;
'wc_willow' : Result:= 67.5;
'wc_teak' : Result:= 85;
'wc_dense jungle' : Result:= 80;
'wc_maple' : Result:= 100;
'wc_hollow' : Result:= 82.5;
'wc_mahogany' : Result:= 125;
'wc_yew' : Result:= 175;
'wc_magic' : Result:= 250;

//
//Cooking Experience
//
'cook_chicken' : Result:= 30;
'cook_meat' : Result:= 30;
'cook_shrimp' : Result:= 30;
'cook_karambwanji' : Result:= 30;
'cook_bread' : Result:= 40;
'cook_sardine' : Result:= 40;
'cook_anchovies' : Result:= 30;
'cook_herring' : Result:= 50;
'cook_baked potato' : Result:= 15;
'cook_mackerel' : Result:= 60;
'cook_redberry pie' : Result:= 78;
'cook_thin snail meat' : Result:= 65;
'cook_trout' : Result:= 70;
'cook_spider on stick' : Result:= 80;
'cook_lean snail meat' : Result:= 85;
'cook_cod' : Result:= 75;
'cook_nettle tea' : Result:= 80;
'cook_pike' : Result:= 80;
'cook_meat pie' : Result:= 80;
'cook_fat snail meat' : Result:= 85;
'cook_salmon' : Result:= 90;
'cook_stew' : Result:= 117;
'cook_cooked slimey eel' : Result:= 85;
'cook_mud pie' : Result:= 128;
'cook_chompy bird' : Result:= 100;
'cook_tuna' : Result:= 100;
'cook_apple pie' : Result:= 130;
'cook_fishcake' : Result:= 100;
'cook_garden pie' : Result:= 138;
'cook_pizza' : Result:= 143;
'cook_wine' : Result:= 200;
'cook_cave eel' : Result:= 115;
'cook_baked potato with butter' : Result:= 95;
'cook_lobster' : Result:= 120;
'cook_cake' : Result:= 180;
'cook_baked potato with chilli-con-carne' : Result:= 135;
'cook_jubbly' : Result:= 160;
'cook_bass' : Result:= 130;
'cook_swordfish' : Result:= 140;
'cook_meat pizza' : Result:= 26;
'cook_fish pie' : Result:= 164;
'cook_baked potato with cheese' : Result:= 199.5;
'cook_chocolate cake' : Result:= 30;
'cook_oomlie wrap' : Result:= 40;
'cook_baked potato with egg and tomato' : Result:= 190;
'cook_laval eel' : Result:= 30;
'cook_anchovy pizza' : Result:= 39;
'cook_uqthanki kebab' : Result:= 120;
'cook_karambwan(partly cooked)' : Result:= 80;
'cook_karambwan(fully cooked)' : Result:= 190;
'cook_curry' : Result:= 280;
'cook_monkfish' : Result:= 150;
'cook_baked potato with mushroom and onion' : Result:= 270;
'cook_pineapple pizza' : Result:= 168;
'cook_baked potato with tuna and sweetcorn' : Result:= 309;
'cook_admiral pie' : Result:= 210;
'cook_shark' : Result:= 210;
'cook_sea turtle' : Result:= 212;
'cook_wild pie' : Result:= 240;
'cook_manta ray' : Result:= 216;
'cook_summer pie' : Result:= 260;

//
//Successful Spell Cast Experience
//
'spell_wind strike' : Result:= 5.5;
'spell_confuse' : Result:= 13;
'spell_water strike' : Result:= 7.5;
'spell_enchant lvl-1 jewelry' : Result:= 17.5;
'spell_earth strike' : Result:= 9.5;
'spell_weaken' : Result:= 21;
'spell_fire strike' : Result:= 11.5;
'spell_bones to bananas' : Result:= 25;
'spell_wind bolt' : Result:= 13.5;
'spell_curse' : Result:= 29;
'spell_bind' : Result:= 30;
'spell_low level alchemy' : Result:= 31;
'spell_water bolt' : Result:= 16.5;
'spell_varrock teleport' : Result:= 35;
'spell_enchant lvl-2 jewelry' : Result:= 37;
'spell_earth bolt' : Result:= 19.5;
'spell_lumbridge teleport' : Result:= 41;
'spell_telekinetic grab' : Result:= 43;
'spell_fire bolt' : Result:= 22.5;
'spell_falador teleport' : Result:= 48;
'spell_crumble undead' : Result:= 24.5;
'spell_teleport to house' : Result:= 30;
'spell_wind blast' : Result:= 25.5;
'spell_superheat item' : Result:= 53;
'spell_camelot teleport' : Result:= 55.5;
'spell_water blast' : Result:= 28.5;
'spell_enchant lvl-3 jewelry' : Result:= 59;
'spell_iban blast' : Result:= 30;
'spell_snare' : Result:= 60;
'spell_magic dart' : Result:= 30;
'spell_ardougne teleport' : Result:= 61;
'spell_earth blast' : Result:= 31.5;
'spell_high levl alchemy' : Result:= 65;
'spell_charge water orb' : Result:= 66;
'spell_enchant lvl-4 jewelry' : Result:= 67;
'spell_watchtower teleport' : Result:= 68;
'spell_fire blast' : Result:= 34.5;
'spell_charge earth orb' : Result:= 70;
'spell_bones to peaches' : Result:= 35.5;
'spell_saradomin strike' : Result:= 35;
'spell_claws of guthix' : Result:= 35;
'spell_flames of zamorak' : Result:= 35;
'spell_trollheim teleport' : Result:= 68;
'spell_wind wave' : Result:= 36;
'spell_charge fire orb' : Result:= 73;
'spell_ape atoll teleport' : Result:= 74;
'spell_water wave' : Result:= 37.5;
'spell_charge air orb' : Result:= 76;
'spell_vulnerability' : Result:= 76;
'spell_enchant lvl-5 jewelry' : Result:= 78;
'spell_earth wave' : Result:= 40;
'spell_enfeeble' : Result:= 83;
'spell_teleother lumbridge' : Result:= 84;
'spell_fire wave' : Result:= 42.5;
'spell_entangle' : Result:= 89;
'spell_stun' : Result:= 90;
'spell_charge' : Result:= 180;
'spell_teleother falador' : Result:= 92;
'spell_tele block' : Result:= 95;
'spell_enchant lvl-6 jewelry' : Result:= 97;
'spell_teleother camelot' : Result:= 100;

//
//Mining Experience
//
'mine_clay' : Result:= 5;
'mine_rune essence' : Result:= 5;
'mine_copper' : Result:= 17.5;
'mine_tin' : Result:= 17.5;
'mine_limestone' : Result:= 26.5;
'mine_blurite' : Result:= 17.5;
'mine_iron' : Result:= 35;
'mine_silver' : Result:= 40;
'mine_pure essence' : Result:= 5;
'mine_coal' : Result:= 50;
'mine_sandstone' : Result:= 60;
'mine_gold' : Result:= 65;
'mine_gem rocks' : Result:= 65;
'mine_granite' : Result:= 75;
'mine_mithril' : Result:= 80;
'mine_adamantite' : Result:= 95;
'mine_runite' : Result:= 125;

//
//Bone Burying Experience
'bone_regular' : Result:= 4.5;
'bone_wolf' : Result:= 4.5;
'bone_burnt' : Result:= 4.5;
'bone_monkey' : Result:= 5;
'bone_bat' : Result:= 5.25;
'bone_big' : Result:= 15;
'bone_jogre' : Result:= 15;
'bone_zogre' : Result:= 22.5;
'bone_shaikahan' : Result:= 25;
'bone_babydragon' : Result:= 30;
'bone_wyvern' : Result:= 50;
'bone_dragon' : Result:= 72;
'bone_fayrg' : Result:= 87;
'bone_raurg' : Result:= 96;
'bone_dagannoth' : Result:= 125;
'bone_ourg' : Result:= 140;

//
//Runecrafting Experience
//
'rc_air' : Result:= 5;
'rc_mind' : Result:= 5.5;
'rc_water' : Result:= 6;
'rc_earth' : Result:= 6.5;
'rc_fire' : Result:= 7;
'rc_body' : Result:= 7.5;
'rc_cosmic' : Result:= 8;
'rc_chaos' : Result:= 8.5;
'rc_astral' : Result:= 8.7;
'rc_nature' : Result:= 9;
'rc_law' : Result:= 9.5;
'rc_death' : Result:= 10;
'rc_blood' : Result:= 10.5;
'rc_soul' : Result:= 11;

//
//Tiara Runecrafting Experience
//
'tiara_air' : Result:= 25;
'tiara_mind' : Result:= 27.5;
'tiara_water' : Result:= 30;
'tiara_earth' : Result:= 32.5;
'tiara_fire' : Result:= 35;
'tiara_cosmic' : Result:= 40;
'tiara_chao' : Result:= 42.5;
'tiara_nature' : Result:= 45;
'tiara_law' : Result:= 47.5;
'tiara_death' : Result:= 50;

//
//Crafting Experience
//
'craft_molten glass' : Result:= 20;
'craft_beer glass' : Result:= 17.5;
'craft_candle lantern' : Result:= 19;
'craft_oil lamp' : Result:= 25;
'craft_vial' : Result:= 35;
'craft_orb' : Result:= 52.5;
'craft_lantern lens' : Result:= 55;
'craft_water battlestaff' : Result:= 100;
'craft_earth battlestaff' : Result:= 112.5;
'craft_fire battlestaff' : Result:= 125;
'craft_air battlestaff' : Result:= 137.5;
'craft_pot' : Result:= 12.5;
'craft_pie dish' : Result:= 25;
'craft_bowl' : Result:= 33;
'craft_plant pot' : Result:= 33;
'craft_pot lid' : Result:= 40;
'craft_gloves' : Result:= 13.8;
'craft_boots' : Result:= 16.3;
'craft_cowl' : Result:= 18.5;
'craft_vambraces' : Result:= 22;
'craft_leather body' : Result:= 25;
'craft_chaps' : Result:= 27;
'craft_coif' : Result:= 37;
'craft_hard leather body' : Result:= 35;
'craft_studded leather body' : Result:= 65;
'craft_studded leather chaps' : Result:= 69;
'craft_green leather vambraces' : Result:= 62;
'craft_green leather chaps' : Result:= 124;
'craft_green leather body' : Result:= 186;
'craft_blue leather vambraces' : Result:= 70;
'craft_blue leather chaps' : Result:= 140;
'craft_blue leather body' : Result:= 210;
'craft_red leather vambraces' : Result:= 78;
'craft_red leather chaps' : Result:= 156;
'craft_red leather body' : Result:= 234;
'craft_black leather vambraces' : Result:= 86;
'craft_black leather chaps' : Result:= 172;
'craft_black leather body' : Result:= 258;
'craft_sapphire' : Result:= 50;
'craft_emerald' : Result:= 67;
'craft_ruby' : Result:= 85;
'craft_diamond' : Result:= 107.5;
'craft_dragonstone' : Result:= 137.5;
'craft_onyx' : Result:= 168;
'craft_opal' : Result:= 15;
'craft_jade' : Result:= 20;
'craft_red topaz' : Result:= 25;
'craft_gold ring' : Result:= 15;
'craft_gold necklace' : Result:= 20;
'craft_gold amulet' : Result:= 30;
'craft_sapphire ring' : Result:= 40;
'craft_sapphire necklace' : Result:= 55;
'craft_sapphire amulet' : Result:= 65;
'craft_emerald ring' : Result:= 55;
'craft_emerald necklace' : Result:= 60;
'craft_emerald amulet' : Result:= 70;
'craft_ruby ring' : Result:= 70;
'craft_ruby necklace' : Result:= 75;
'craft_ruby amulet' : Result:= 85;
'craft_diamond ring' : Result:= 85;
'craft_diamond necklace' : Result:= 90;
'craft_diamond amulet' : Result:= 100;
'craft_dragonstone ring' : Result:= 100;
'craft_dragonstone necklace' : Result:= 105;
'craft_dragonstone amulet' : Result:= 150;
'craft_onyx ring' : Result:= 115;
'craft_onyx necklace' : Result:= 120;
'craft_onyx amulet' : Result:= 165;
'craft_cape' : Result:= 2.5;
'craft_limestone brick' : Result:= 6;
'craft_snelm' : Result:= 32.5;

//
//Bow Fletching Experience
//
'bow_long regular' : Result:= 20;
'bow_long oak' : Result:= 50;
'bow_long willow' : Result:= 83;
'bow_long maple' : Result:= 116.6;
'bow_long yew' : Result:= 150;
'bow_long magic' : Result:= 183;
'bow_short regular' : Result:= 10;
'bow_short oak' : Result:= 33;
'bow_short willow' : Result:= 66;
'bow_short maple' : Result:= 100;
'bow_short yew' : Result:= 133;
'bow_short magic' : Result:= 166.6;

//
//Log Burning Experience
//
'burn_regular' : Result:= 40;
'burn_oak' : Result:= 60;
'burn_willow' : Result:= 90;
'burn_teak' : Result:= 105;
'burn_maple' : Result:= 135;
'burn_mahogany' : Result:= 157.5;
'burn_yew' : Result:= 202.5;
'burn_magic' : Result:= 303;

//
//Pyremaking Experience
//
'pyre_regular' : Result:= 60;
'pyre_oak' : Result:= 70;
'pyre_willow' : Result:= 100;
'pyre_teak' : Result:= 120;
'pyre_maple' : Result:= 175;
'pyre_mahogany' : Result:= 210;
'pyre_yew' : Result:= 255;
'pyre_magic' : Result:= 404.5;

//
//Thieving Experience
//

//
//Smithing Experience
//
end;
end;

As of the date of this post all functions using colors and/or gametabs for RuneScape have not been altered in 3-4 months and may be outdated and have poorer scripting standards.

—

function StrToChar(s: string): Char;
var tmpResult: Variant;
begin
tmpResult:= copy(s, 1, 1);
Result:= tmpResult;
end;

function CharToStr(c: Char): String;
var tmpResult: Variant;
begin
tmpResult:= c;
Result:= tmpResult;
end;

{*******************************************************************************
function OrderString(Str1, Str2: string; Reversed: Boolean): string;
By: TOB
Description: Outputs the string that would come first alphabetically according the ASCII values.
*******************************************************************************}
function OrderString(Str1, Str2: string; Reversed: Boolean): string;
var
i: Integer;
Str1CurPos, Str2CurPos: Char;
begin
Result:= Str1;
if (not(Str1 = Str2)) then
begin
i:= 1;
repeat
Str1CurPos:= StrToChar(Uppercase(Str1[i]));
Str2CurPos:= StrToChar(Uppercase(Str2[i]));
if(ord(Str1CurPos) < ord(Str2CurPos)) then
begin
Result:= Str1;
if(Reversed) then
Result:= Str2;
end else if(ord(Str2CurPos) < ord(Str1CurPos)) then
begin
Result:= Str2;
if(Reversed) then
Result:= Str1;
end else
i:= i + 1;
until(not(Result = ''));
end;
end;

I'm really proud of OrderString xD, I couldn't think of a better name for it anyway. It uses StrToChar so put that next to it.

function PartialNames(Name: string; MinStrLength, Outputs: Integer): array of string;
var Rand1, Rand2, NameLength, i: Integer;
begin
if(Outputs < 1) then
begin
SetArrayLength(Result, 1);
Result[0]:= Name;
Exit;
end else
begin
SetArrayLength(Result, Outputs + 1);
Result[0]:= Name;
NameLength:= Length(Name);
for i:= 1 to Outputs do
begin
Rand1:= Random(NameLength);
if((NameLength - MinStrLength) < Rand1) then
Rand1:= MinStrLength;
//Writeln('Rand1=' + IntToStr(Rand1));
Rand2:= MinStrLength + Random(NameLength - Rand1);
//Writeln('Rand2=' + IntToStr(Rand2));
Result[i]:= copy(Name, Rand1, Rand2)
end;
end;
end;

PartialString is another function I'm pretty proud of xD See it's use in http://www.villavu.com/forum/showthread.php?t=6977


function LoadSymbolBitmap(var Color: Integer; Name: string): Integer;
begin
Result := 0;
if (LowerCase(Name) = 'bank') then
begin
Result := BitmapFromString(15, 5, 'z78DA33B434B4343473B' +
'100421364D2D9D2C9C9D4C4CDCDD5D1CCD0C2D5DCC5D00299ED04' +
'8226C824B25E43B0998664990C213175116F32B2F9C824B2F9A4B' +
'A1997F9B842865493890F734C9301ACE46928');
Color := 6417151;
end;
if (LowerCase(Name) = 'mining spot') or (LowerCase(Name) = 'mining site') then
begin
Result := BitmapFromString(15, 5, 'z78DA95D03B0EC430' +
'0804D02B610C832931D9DCFF48894293C8DAD5464853F07905342' +
'91A67A46FF43BA31914AE602183A9E5686799A64E3C04BA4CFA43' +
'7E98439C770971257CB09F934B8E089F2FE43287A2F534166629A' +
'1121D03DB5BB94C0B1D9D811E2DEF66ED94BCF6BFC97753A33BF3' +
'7ABBCAEB9F0FD413672D');
Color := 4219541;
// Color:=4092315;
end;
if (LowerCase(Name) = 'transportation') then
begin
Result := BitmapFromString(15, 5, 'z78DA33303534347074353' +
'4B73032219E34763173348592A62E666E66A6C8B20660330D904C' +
'86A841D6858BC454896C3EA6C9C498899FC465B291A3B193910B3' +
'124A69910715C269317CEC866229B0C00B3496273');
Color := 2650848;
end;
if (LowerCase(Name) = 'magic shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA95D0510A80300806' +
'E02B9906B6C77F3AEF7FA4A0066DABC17A1111FD1469A74CC5C46' +
'0D6C60875CEA17288D63CE08C771D02A09BA5CBA499DC99AD3CFA' +
'EB72041B97B9D9C83F6F2ECE69C3D71F46F9EE5C979D155AFDBAA' +
'5BBFF312D915399C927AF756C82');
Color := 1714669;
end;
if (LowerCase(Name) = 'water source') or (LowerCase(Name) = 'water') then
begin
Result := BitmapFromString(15, 5, 'z78DAA5CF410A80300C44' +
'D12B25B6A964E9907AFF2329CC42A5448A12F874111EA9A89C830' +
'A438C6DB646B7A51BF6C27A75F3C8F659D16BE665F68F7C37B121' +
'3AF8162D2DE2FDF21999E628B3DFE4C7DF1339BB9CE601EA0F684' +
'0');
Color := 14497281;
end;
if (LowerCase(Name) = 'furnace') then
begin
Result := BitmapFromString(15, 5, 'z78DA3334353435B470' +
'3101423308696A028466E6C6A6A626E66E6E1640062E12A206A2D' +
'EC90408A1261882CD3424CA6427472320DBCDCDC810C61EFC2653' +
'3F34882171990C0058F36390');
Color := 3508223;
end;
if (LowerCase(Name) = 'anvil') then
begin
Result := BitmapFromString(15, 5, 'z78DA95CF510AC0300803D02B' +
'A59DE0F2D9F6FE771A2CFB10CAC4FE04117C443434D8E4C2EA4A8' +
'7DFCE8B06FB369AF38C025E139B5C7194EA106F73B9D2991C187D' +
'3773F92F2BE6A91CBFD05CE9FC00C9DB6164');
Color := 4012591;
end;
if (LowerCase(Name) = 'rare trees') or (LowerCase(Name) = 'tree') then
begin
Result := BitmapFromString(15, 5, 'z78DA33303400424757270' +
'B4757086960686209128390E6F84833470B20696C618E6E020262' +
'33D99C0C9238938976391269E16A69614192C96012EC6B2889C34' +
'CFC26639A0F516FE46CE80267BB9AB919B8426C413613393400AC' +
'8C5FC9');
Color := 96513;
end;
if (LowerCase(Name) = 'fishing spot') or (LowerCase(Name) = 'fish') then
begin
Result := BitmapFromString(15, 5, 'z78DA8DCE410E80300844D12B4D5BA' +
'9BAA404EE7F2413675343AA6EFE82D217D061682636ACCCADA779' +
'045B641F117987CDAFB84D2479D67257B28A0EFD90B9C9F9BB3FD' +
'FF02EC337F347B39977D83F37AFFEA2D76EDEA4543DE870B2922F' +
'BB6B6878');
Color := 16743189;
end;
if (LowerCase(Name) = 'cook') or (LowerCase(Name) = 'cookery') then
begin
Result := BitmapFromString(15, 5, 'z78DAA590410AC0200C04BFB41' +
'B4D5B8F2ACDFF9FD4D25008885EBC0C21EC0E211010EC6CD66EE7' +
'C1A4F869A9524AD74BB2CF3139233E2782D9BB713F52CE37A1D98' +
'4A823D7E678A15FAE4CC4EDDDB5B9B258D932BB61C67DF3FACF0F' +
'3E40632F');
Color := 1194607;
end;
if (LowerCase(Name) = 'quest') then
begin
Result := BitmapFromString(15, 5, 'z78DA8D90410A80300C04BF94' +
'B49A36475BD3FF3F497011564AC5CB1042322C2B4954B46B1B2D9' +
'8D53C45F1DEFCCC25D51206629FCBD69F9B437DF8EB576EA74C66' +
'DC83B0B19F9DCC6F33675B71DBCDC257FC9F993BC12F3263E61B7' +
'402AECC73CF9839DBDC33B70DE70515B06618');
Color := 15107954;
end;
if (LowerCase(Name) = 'mill') then
begin
Result := BitmapFromString(15, 5, 'z78DAB58F3B0AC0300C43AF24A' +
'75D3CD621BEFF9102D52228822C5D1EC69F878C8140CCA8AEE5D8' +
'DD0BA97C223BED3E5E27C48CBAE7B878ABF54987B5337FB3E995D' +
'26DF2973F323B33C9A9D26573A47303B52569D1');
Color := 655103;
end;
if (LowerCase(Name) = 'dungeon') then
begin
Result := BitmapFromString(15, 5, 'z78DAC5CC310E80300C04C1' +
'2F9D2DE5229736C1FF7F121269229922888266BB1D28047248649' +
'CB5D974A8D55A82682E96F670E136F1971CDE9DD5CCC14E7E9157' +
'7FC77C2BAF9DE68E7C01216D6A72');
Color := 2698741;
end;
if (LowerCase(Name) = 'weave') then
begin
Result := BitmapFromString(15, 5, 'z78DA33303230343074367472' +
'73724526CD0C4C0C8CDC1C0D2DDD2C5D8DDD8C4C0CA0E2103644D' +
'CDCD1CCD4C40CC246D66B0036D300AFC9986622B3293119979B21' +
'ECC1E966649793EA6600F03E685F');
Color := 926783;
end;
if (LowerCase(Name) = 'pottery') or (LowerCase(Name) = 'pot') then
begin
Result := BitmapFromString(15, 5, 'z78DA8DCE5B0AC0200C44D1' +
'2D6592691B3F2DD5FD2FA98F08554A410217C9C73102B966673E7' +
'64617AA094DA16349D4B15E96621EED05C13B5F19F9DEFF178E14' +
'3F869CE8479A9267FCFEE619992A55100D7F8519CC37562DBDD6F' +
'AECE76FEEFD55D5A50983FFBCB76A807CE5139EC460AC');
Color := 270148;
end;
if (LowerCase(Name) = 'spinning wheel') or (LowerCase(Name) = 'spin') then
begin
Result := BitmapFromString(15, 5, 'z78DA7D90510E803' +
'00843AF04B2E1F894B9FB5FC9C4EE0383DB4FD314F22025A642EC' +
'DEC507545B31BECD2FB1715AED872187FFC9ABB21CC891D0CBA44' +
'0AE2E46731A37333FEFB4A155DA9EAC5A9C053EDECAFC8F86CF57' +
'644CA3E256EC2AFE3CFBD99273272B1FF9B91F301FD6076714');
Color := 2710649;
end;
if (LowerCase(Name) = 'guide') then
begin
Result := BitmapFromString(15, 5, 'z78DA33303400424717470B27' +
'33086961E168E4EC64E866E264EE0C614349170B0B4B336411143' +
'56059880906860848C06488995432193F89CB47F84D869A8FE14E' +
'8869F8CD24C664E2431E533DC44C00EBA66771');
Color := 13345416;
end;
if (LowerCase(Name) = 'shop') or (LowerCase(Name) = 'store') then
begin
Result := BitmapFromString(15, 5, 'z78DA95D0410AC4300805D02B' +
'99A889596AECFDAF3461FE26A52D9DD97C41E1A1D251A2E8CCF46' +
'4A41D2306776FC415A929B39E3AD7E92ED0D7A4ABDC8C34669849' +
'73EBCC03D95269F9A15AFBA86A4591E87886C78B8C4D209F527B6' +
'389D2A5E42E236D55F327197FB8317F90D738449E64E72037DCFE' +
'F7CEF8E1267F0053466502');
Color := 3498103;
end;
if (LowerCase(Name) = 'shield') then
begin
Result := BitmapFromString(15, 5, 'z78DACDCC3112C0200844D12' +
'B611484920DE4FE47CA8CA63085BDCD9F6DF6511614BE233CEADA' +
'16ECFC9553204DD36055D92EF56E2AFD99DB038EDF97864927C8C' +
'339595EFD9D3CCD9DFC02CAE26976');
Color := 9542286;
end;
if (LowerCase(Name) = 'altar') then
begin
Result := BitmapFromString(15, 5, 'z78DA33703574323475767171' +
'7431B670B574B2A4888498630036D300C96464F3DD880610F58E2' +
'E4E8E4E501297C9C49B8F69267E37936732B25EFC26131F1AB84C' +
'06006E357035');
Color := 9542286;
end;

if (LowerCase(Name) = 'arrow') then
begin
Result := BitmapFromString(15, 5, 'z78DA33303570333470353437' +
'3372249E343633B33475829026161646E626C8B20660330D904C8' +
'6A841D6858BC454896C3EA6C9C498899FC465B2919BB1A5B12931' +
'24A69910715C269317CEC866229B0C001E5A61CB');
Color := 2782945;
end;

if (LowerCase(Name) = 'bar') then
begin
Result := BitmapFromString(15, 5, 'z78DAB5CC310EC0200C43D12B41' +
'E3001D0389EF7FA44ACD82D4952E5F968757B5B4E28EA56B66E33' +
'685908EEEA4115736FF1523A016BD8113A636079B0877A1BE663D' +
'24E73E25A7F99F9CE659F96BEEF2031A5D69A8');
Color := 4433385;
end;

if (LowerCase(Name) = 'underground') then
begin
Result := BitmapFromString(15, 5, 'z78DA33303400422743' +
'272727134CD2D5C2C8D4D01993B47033303630B434B474B2C4A2C' +
'BC01001E96FB28B9BA3A10516335D5DCC8C4D9D293119D97C62CC' +
'24D5646412622631260300830265FA');
Color := 1844712;
end;

if (LowerCase(Name) = 'tanner') then
begin
Result := BitmapFromString(15, 5, 'z78DA8D904B0EC0200805AF0' +
'4F85F4ABDFF991AFB162521D26E26462703919898BAAACEAB82B5' +
'E5C4ABB52289FED316E8699229DBE63ECB8AA7F8D75319843374C' +
'C594B4FC2C5177003C7FAE0A90CC2C92ACA392E5B3FDED9F22DCB' +
'47D9FFF30DFAEB6308');
Color := 3363443;
end;

if (LowerCase(Name) = 'churn') then
begin
Result := BitmapFromString(15, 5, 'z78DA9590410A00210845AFA4' +
'A5FE5A564CF73FD240CE40502DDA3C5CE8031F318150D1ACE94C4' +
'104C7D04365F159253E2C16A5737342B5735F6F6938E960D66430' +
'9B0D1B5292146ECD92156ABF1F013CD39DBE736D1E05FCF644FFE' +
'8BAC6A8FAF927AEB5338A958DF905A105631F');
Color := 1720403;
end;
if (LowerCase(Name) = 'house') then
begin
Result := BitmapFromString(15, 5, 'z78DA9D90410AC0300804BF6' +
'41B2DF66863F3FF2715BA978560A0BD0C32E2B228F766123D53BB' +
'33E5F5A08DC3ECD434550779BBBE9D3D1290C9846FDEC63EC02A8' +
'13D9B7F5C77AE9AF337B86DE4A5E1E0D7649EABE4F9F601C37765' +
'F5');
color := 4740173
end;
if (LowerCase(Name) = 'axe shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA95D04B0EC3300804D02B91' +
'0033F6127F72FF23A52A1BA4AA55BA1959483C036202E953A74F7' +
'EA6BBC35B260C403335377680767CEB92B7293FE59A71BEBE187D' +
'1136D2C7C583CAC6E0CCCABF7235B9A13A728B34EB2EA1E1F148E' +
'E8D8655CDECADF7C977D69FC8B1BA0269E2B27DEEDA9B13D63933' +
'EB356E4B7C6439');
color := 6841956;
end;
if (LowerCase(Name) = 'cookery shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA8DCE410AC0300804C0' +
'2F194CDCE42896FCFF49856E0F421072D983BA83D2C56485C608E' +
'4C484236CA341999CBBFA7020A6CEFEDF74339B9CF3463E530A99' +
'4993ADDCA55C6D6F647E955B959CB757F22754F2F9ED8DBCCCD01' +
'B137B3CDAB290E76797E60B5A736560');
color := 7565679
end;
if (LowerCase(Name) = 'windmill') then
begin
Result := BitmapFromString(15, 5, 'z78DA3330313033B074367' +
'6367536C745BA0181A11132E968EC68EA8853BD01D84C0324930D' +
'5C4C8D8C9C217A91D9C48840D8B84CC6741BB22E6412974A885F6' +
'8E1665C264348882C3289CB6DB848889900AC8467DB');
color := 1245183;
end;
if (LowerCase(Name) = 'minigame') then
begin
Result := BitmapFromString(15, 5, 'z78DA8D90410EC0200804B' +
'FB4AD22E568B1FFFF52132129C6DAF432214626CB22A340342929' +
'47B68DAE82066E2C0D99323BFBBB0A0E88CD3555AAC32EBA1393D' +
'99D6E36E7E38FCEC86FF3906D412D09FBB9E4FFCCA113DFED996D' +
'8E7FAC13E3CAFCD2B3DD1BB34D3DC7B6CD79039CA16371');
color := 4670928;
end;
if (LowerCase(Name) = 'fur trader') then
begin
Result := BitmapFromString(15, 5, 'z78DA3330313033B0743' +
'67636753647262D2C4C8C0D2C31497357A07A0B64D2D1D8D1D4D1' +
'1C4242F41A80CD34C06132A6F9C49849BCC9B8CCC76526792623B' +
'B16BF7A52438378F321660200DE126419');
color := 607112;
end;
if (LowerCase(Name) = 'archery shop') then
begin
Result := BitmapFromString(15, 5, 'z78DAA5CE490AC0201' +
'044D12BB5560F71E910EF7FA4403A0B8318846CFEAA78143129A5' +
'8A2AD5769A9A29172F8385CD9B91253F1BBA4DDA964733A91A07D' +
'7FEC8A366A702C59D51DB9215140BF77804BCCC2E0D6136E7AE64' +
'37477FF5F35BBE0049C36545');
color := 4945565;
end;
if (LowerCase(Name) = 'staff Shop') then
begin
Result := BitmapFromString(15, 5, 'z78DAA5D03B0AC0300C0' +
'3D02BD9F1AF198D83EF7FA442BCB6C1B48B26F110020685191412' +
'D6C9A96A8C96B2089D5CFCA103DB84B65CA60F49CC32FFCBA55D8' +
'B7DD0D9ECCBFD9DDFE4F3AB6FF20D38E96664');
color := 4286358;
end;
if (LowerCase(Name) = 'clothes shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA8DD04B0AC0200' +
'C45D12D3DF2D13A0CE9FED754681CA4484A267720CF8308C1C072' +
'76F51925BE2023CAB2A0D66916F09A487236CF66A73AAFE4686C8' +
'C4D6DE25622AFE4D8E4FDBE55C8D1BE9CF7FF6FFEFC585B3EFFF9' +
'012BE4618A');
color := 5935156;
end;
if (LowerCase(Name) = 'farming spot') then
begin
Result := BitmapFromString(15, 5, 'z78DA9DCCD10A80300885E1' +
'57D29CC775698BBDFF2315B98BC120AC9B1F41FDA810686FD2B45' +
'9BE2A02D6D2B7CA22C7E60C17571F5B7A4CFA2887190D6DEE3F19' +
'24276335D7CB8C6CD5EE577463938C9991875900D490637E3767F' +
'9024D406555');
color := 1390163;
end;
if (LowerCase(Name) = 'apothecary') then
begin
Result := BitmapFromString(15, 5, 'z78DA9DD0310AC030088' +
'5E12B69A3A68ED6D6FB1FA9D02C4230942CFF241F0F814040BD39' +
'7BAFAA8748C46847C2A75B33B6F21E3E13967236B33CBA2767CDD' +
'5EFE05926C5F3D23DB932B33C7FE6FFE66AED5A7E01E72B65AE');
color := 16737938;
end;
if (LowerCase(Name) = 'sword shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA95D0410AC030080' +
'4C02FD9C66CE25125FFFF524BBD08A5C520EC41964124269078F3' +
'EEE33FC5EF918535971A1B0C6000539B761D91D1A4C7A4829CCD1' +
'06293E5DCFF929BF231CEBAB92B47EE9A956FBC2FAF9859BE0057' +
'DB6637');
color := 10067100;
end;
if (LowerCase(Name) = 'platebody shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA8DD0410AC02' +
'00C44D12BA56832761902BDFF910A9DCD8055DCFC850C4FD1BA85' +
'DDD5CA0B6CF48818F1E042633190A87D55B0CF349167534FD459D' +
'DBB92596EB2A527DC3DFC4FFE6EE446F7EC4A66CF65DDEFDFAC3D' +
'97E77F7E014609646B');
color := 8157816;
end;
if (LowerCase(Name) = 'scimitar shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA9DD04D0AC340' +
'0805E02B8D7FCF71399349EF7FA4A6B8A825109A203C5CE887D8A' +
'81D356962CA3FD9475FDD96AE581012880405E267A6D1B7CE0277' +
'61DBAB56CDEC6963A2F14CAE5AA69B0FF76ADE95315CBDA59FBB2' +
'AEAAAF50367F35A0630711C0AB697B1B9E9678223F3DAACF21B5C' +
'65625E');
color := 8752522;
end;
if (LowerCase(Name) = 'gem stall') then
begin
Result := BitmapFromString(15, 5, 'z78DAA58E4B0AC0300844' +
'AFA4F96719F3B9FF919A640A154A3729836F21FA18629A1196201' +
'6ECCD772FE0E03AAA057B32F350338DF50B6A03F1932FF34DEDDC' +
'1BED0433E7900FCD835C76011B89BFCDAFB6AEAEFB504FCC6013F' +
'6C4DA8C9E306B1653E29C4D6DBE0027B7630B');
color := 1777896;
end;
if (LowerCase(Name) = 'silk stall') then
begin
Result := BitmapFromString(15, 5, 'z78DA333034004227432' +
'733276364D2C2C4C0D0D488181253AF81210262CA42484B67030B' +
'33476248DA996C696869664994C9C48706B299F84D36733630347' +
'62486849889CB6400B4306127');
color := 5374340;
end;
if (LowerCase(Name) = 'plateskirt shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA3330340042' +
'2743273327634CD2D9D8CCC2D9009974323235763282909686966' +
'696587419182220F126239B4F9EC9B8DC8929423B93315D4E2034' +
'709843BCC900457662CC');
color := 12609731;
end;
if (LowerCase(Name) = 'agility') then
begin
Result := BitmapFromString(15, 5, 'z78DA333034B03030743276' +
'3677328590066011086969EC686E494004591CD30464933165F19' +
'B802C428CC9B8CCC734873C93F1BB9F18F5C4A881B80D339C71E9' +
'020052926073');
;
Color := 67585;
end;
if (LowerCase(Name) = 'training dummy') then
begin
Result := BitmapFromString(15, 5, 'z78DAA5CC5B0AC43' +
'00805D02D69468DF9BC6DEAFE97D401032384F92845B8888F434C' +
'DF0210386A6A6B9D3833270E0F5F5B7371D2FD2B93F857FFE4D4A' +
'AE962D402E738ED1A0768E08D5CE743FA14A49CB9DF3C95CDA4B3' +
'A6EC1FB73E6BBE974D6572403C74F9AB2F9769DEA32D69B5');
Color := 9146250;
end;
if (LowerCase(Name) = 'food shop') or (LowerCase(Name) = 'food store') then
begin
Result := BitmapFromString(15, 5, 'z78DAA5D0610AC0200806' +
'D02B559ADA4F37DAFD8F3499C11C6D63B02F900A79882959B28AC' +
'A825E09908A0893A0B4C25441ED49A0DA2AB3DFFDDF7B467FE64D' +
'C88594CF13E56651A08C1DD66146F9A82E47532C0DDFE531F92C8' +
'77A9183F945BED9C66F396EC385D91F321AD29FE41DF6B66191');
Color := 7837098;
end;
if (LowerCase(Name) = 'fishing shop') or (LowerCase(Name) = 'fish store') then
begin
Result := BitmapFromString(15, 5, 'z78DA3330340042470B470B' +
'27134CD2D2C2C4C8C010425A0081A509844456832962608880E49' +
'9099431773425DE64E2CD4426F19B8C6CA6990950812BAE50C234' +
'19D9765C6E8698894C62BA193334304D0600DE086263');
Color := 9734280;
end;
if (LowerCase(Name) = 'jewelery') then
begin
Result := BitmapFromString(15, 5, 'z78DA9D904B0AC0300844A' +
'F646843E2D24FBCFF911A6217820DB4DD0C32EA43070A28B08088' +
'6054AB664DB46B07E64276220109A1D7EEFB4CDE85C5840D79E0E' +
'05223D3D5BBEEFB4CF4DF933333AA5FFE957CFFDB95DB5356CBFF' +
'479E471FB395F2DCE59FC917FB9B6AAB');
color := 4829105;
end;
if (LowerCase(Name) = 'crafting shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA95CEC10AC020' +
'0C03D05F8AD3D979AC71FFFF4BC27A29C8A45E420EE111240C748' +
'2648B24BEFDD5B36414149626F793E45D3708CBDEACA98EAA662A' +
'94DA2C4FE5D5F49A374FE53F73FF642F9B693D627A79020EC868E' +
'C');
color := 3159851;
end;
if (LowerCase(Name) = 'portal') then
begin
Result := BitmapFromString(15, 5, 'z78DAA5D04B0AC0300805' +
'C02B69D2D6B8D47CEE7FA4045CD442ED22457848D0410208AB549' +
'4942D2F4858DAA9B05A6A4895251DB93FD2DE6DC6E6BD0078D7B7' +
'A98374A0CFC86761E2173977C052F764DB8DE43F375B46F2DE3F7' +
'BD3CB13F26764CE');
color := 15287202;
end;
if (LowerCase(Name) = 'makeover mage') then
begin
Result := BitmapFromString(15, 5, 'z78DA333034703170' +
'7236707676B68490066011571367734B174CD2D2D8CCD5C418993' +
'4C06182015E9391D5608A209BEC68E0E8EC4882C9C4BB99129391' +
'DD499EC9F8CDC76526A6C9003E5F6688');
color := 10340324;
end;
if (LowerCase(Name) = 'mace shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA9DD14B0A80300C04' +
'D02B4D4CF3E93226DEFF4A82155404296EB21A1E330484C29AC8C' +
'CFE7DAD7BB89A38D9A6696EA2A4A511888C4712878909D9521BB3' +
'A6086368B248C969FE932F7381546BE477ED6DCEC80F135C64DFD' +
'A8C7CDFFEEE39F39161EE1ADD6893');
color := 8817273;
end;
if (LowerCase(Name) = 'hair dresser') then
begin
Result := BitmapFromString(15, 5, 'z78DA33303470317072' +
'36707676B68490066011030C71E2D5E0977534707476C4A206998' +
'DAC8654B7E1B2059984C84248F27C8D6C3EB269C4BB19531CD91C' +
'4CF7E37233005E916796');
color := 13225152;
end;
if (LowerCase(Name) = 'mining shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA33B03430313074' +
'B670367672C5241D2D1C8D2DA1A40158258474737473333285909' +
'8BA9055E232199944360DBFF9C49B8C6926B22F20E21011FC263B' +
'5998BAC0447099499EC9C498896C022E9301172B6823');
color := 10396584;
end;
if (LowerCase(Name) = 'silver stall') then
begin
Result := BitmapFromString(15, 5, 'z78DA958E410AC0400' +
'803BF14D1823D6E6DF3FF2715EA4510A17B09C198211008347031' +
'A4AB4169E2E6EA071F06EFF4F5DE5BF89818C8D9ADB4AE13FF0FB' +
'976FBF2F4F9B370726D90FBB64977C913BFA6D3E61755066363');
color := 8749956;
end;
if (LowerCase(Name) = 'spice stall') then
begin
Result := BitmapFromString(15, 5, 'z78DA9DD0C10E80200C' +
'03D05FEA06883B22D2FFFF2413F140B240D44BD3C3FA0E8340102' +
'A0E5619D3984CAC714B50B224D1A72B9BEEBDF71BBFC56DC2C96F' +
'CCB5EFE5A9F9D1F77244609C66B67CE6B6CE0263997EE39FDFCD5' +
'1BE002BE06493');
color := 157167;
end;
if (LowerCase(Name) = 'farming shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA95CE410E80200' +
'C44D12B4D5B405C160CF73F92C461D1C498E0E6D374F1280402EB' +
'68A30B6B559340150D25F5F95ED55392D556735365BBA96B661DE' +
'7F025E031F192A9D1E75CAA1D52A2CFD2E42FFB7234BFE478FF8E' +
'9CE7128332E72FEDAF1C2FDF91A319E51BD93562F0');
color := 1918090;
end;
if (LowerCase(Name) = 'slayer master') then
begin
Result := BitmapFromString(15, 5, 'z78DAA5D04B0AC030' +
'0804D02B8D89A5CD320D9DFB1FA9BF8D622D8582B810E6210381A' +
'00EAC1CA2A85461E3F34C1CB366FBCE7634F6533C4C04D9FAEE62' +
'84ECF22EDB3F9D53B89525CADF7F4E1BB864B77FB411B359C351D' +
'E019F8C655C');
color := 7666933;
end;
if (LowerCase(Name) = 'herbalist') then
begin
Result := BitmapFromString(15, 5, 'z78DA7D8E5D0AC0300883' +
'AFA4FDD33E5AC6EE7FA415C258C0D10A22267E8DA8EC5A253C9CB' +
'B5EF5166D7D4C89DE6DE9C45C6DF8BB1733FBBB15FD0A1B10B001' +
'99F9CCC42C5AB77B16DFEF4C86BF370B355C653272428513EA990' +
'C3FF3393954EEFC2327CFE4CCCFC933136A263F5CC35F29');
color := 682309
end;
if (LowerCase(Name) = 'candle shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA33303400422723' +
'470B470B4CD2CDD0C2D5C01042BA9ABB9A9A3A218BE0D26560888' +
'0B8D4209B8F6CB2A591051040488A4C367035753571317136B134' +
'8390B8CC1CEA26030022F6653F');
color := 6022631;
end;
if (LowerCase(Name) = 'saw mill') then
begin
Result := BitmapFromString(15, 5, 'z78DAB58EB10DC03008045' +
'70A600C2EFDF1FE33450A299088A53469AEB08FD3D3498D7861C9' +
'3A2A4D3ABA0FF1E99619EFBB2BBA9B54CA0A157D69C66FED87FFA' +
'55CD7663FF7C30120F87173EEEFCA266DF2431F0AB6E11D3C770C' +
'A76EBE00CD48658B');
color := 8882835;
end;
if (LowerCase(Name) = 'kebab shop') then
begin
Result := BitmapFromString(15, 5, 'z78DA7DD0410E4321080' +
'4D02B8922C812F473FF2335E97441627E3713A399274A4A83DA91' +
'D3F75353D670B2877733DDE143122987981AF248F092BB4B5F932' +
'E192D986F895BBA51D06FFD5FAE26E6412BCFE9AE48ECBBE9E055' +
'5F51FD5BCE787277C8A1A632EF3921E3D453F79C3164D2821F12D' +
'D5F7F03DDAA455B3E1B1C4C8BB42636962647679855FE005B3666' +
'35');
color := 7316427;
end;
if (LowerCase(Name) = 'short cut') then
begin
Result := BitmapFromString(15, 5, 'z78DA8D90410AC0300804' +
'BFA421A1E95137EDFF9F54E8F62088259741161D64C5B4E98573E' +
'9821B1A206E3EE49F5DAC1F835724F36F7E9D12CCD370DBE40EE7' +
'9854FE9864330DF993C8ECC9CC66F65039F7FD551B3BDCFFF9018' +
'756682E');
color := 5286667
end;
if (LowerCase(Name) = 'hunter store') then
begin
Result := BitmapFromString(15, 5, 'z78DA95D0510AC3300' +
'806E02BC558CDEFA309F6FE47DAC08E3942A143F041934FB1517B' +
'87C78447CD76BA591CCA445015EE5DD641C459F9D4F554C997F56' +
'FA36FEC3204819E663A77F25CAE633C972F01BC48AAB9FBB9C373' +
'79DFB6E69C98DDE1E0813FAE1106FCF897564C992A6277F20B925' +
'96443');
color:=1261916;
end;
if (LowerCase(Name) = 'hunter training') then
begin
Result := BitmapFromString(15, 5, 'z78DA8DCF410A00' +
'210C03C02FC52D76E9B18AFFFF92B0EB2150025E728876AC78916' +
'8D3678C55D360F6F89FE919211B9EC267A2C87CB32F6FFD08EC70' +
'CF6FDDC8D554597F712FF3AC3AE546C96A1FE573B2BC0197F063A' +
'B');
color:=10398118
end;
if (Result = 0) then
begin
WriteLn('Please enter a valid symbol name');
Exit;
end;
end;

function FindSymbolIn(var rx, ry: Integer; Name: string; sx1, sy1, sx2, sy2: Integer): Boolean;
//Thank you SCAR 2.0 for making this much easier, work in progress
var
Bitmap, SymbolColor, c: Integer;
acc: Extended;
begin
Bitmap:= LoadSymbolBitmap(SymbolColor, Name);
FindDeformedBitmapToleranceIn(Bitmap, x, y, sx1, sy1, sx2, sy2, 70, 0, True,
acc);
if (acc > SymbolAccuracy) then
begin
repeat
c := c + 5;
if (FindColorTolerance(x, y, SymbolColor, x, y, x + 15, y + 5, c)) then
begin
Result := True;;
rx := x;
ry := y;
end;
until (Result = True) or (c > 70);
end;
FreeBitmap(Bitmap);
end;

This is a FindSymbolIn until next SRL comes out. When searching for symbols try to search in sections such as –
Left Top Quadrant: MMX1, MMY1, MMCX, MMCY
Right Top Quadrant: MMCX, MMY1, MMX2, MMCY
Left Bottom Quadrant: MMX1, MMCY, MMCX, MMY2
Right Bottom Quadrant: MMCX, MMY1, MMX2, MMY2
Left Half: MMX1, MMY1, MMCX, MMY2
Right Half: MMCX, MMY1, MMX2, MMY2
Top Half: MMX1, MMY1, MMX2, MMCY
Bottom Half: MMX1, MMCY, MMX2, MMY2

Ron

2007-03-09 20:23:57

cool functions man!

pwnaz0r

2007-03-09 20:30:22

Dang son I like 'em :D

TOB

2007-03-09 23:23:06

Can someone check for me if most of the RS ones still work?

Edit: I'm on a Macintosh right now that's why I cannot.

Boreas

2007-03-10 09:57:01

Hehe I've already seen AllPlayersInactive in some scripts!

TOB

2007-03-10 14:24:11

From: Boreas
Hehe I've already seen AllPlayersInactive in some scripts!


Serious?!

I know I've seen it in a new user's script using it once and I had to tell him how to use it properly.

TOB

2007-03-11 12:46:45

Bump, I've added StrToChar, CharToStr, and OrderString. Just for clarification, the Reversed boolean does not search the string backwards and instead just reverses the output after it finds which comes first alphabetically.

Edit: Added a description to OrderString.

Boreas

2007-03-12 09:49:07

What do you mean laggy?
program New;
{.include SRL/SRL.scar}
var strarray:array of string;
var t:integer;

function StrToChar(s: string): Char;
var tmpResult: Variant;
begin
tmpResult:= copy(s, 1, 1);
Result:= tmpResult;
end;
{*******************************************************************************
function OrderString(Str1, Str2: string; Reversed: Boolean): string;
By: TOB
Description: Outputs the string that would come first alphabetically according the ASCII values.
*******************************************************************************}
function OrderString(Str1, Str2: string; Reversed: Boolean): string;
var
i: Integer;
Str1CurPos, Str2CurPos: Char;
begin
Result:= Str1;
if (not(Str1 = Str2)) then
begin
i:= 1;
repeat
Str1CurPos:= StrToChar(copy(Uppercase(Str1), i, 1));
Str2CurPos:= StrToChar(copy(Uppercase(Str2), i, 1));
if(ord(Str1CurPos) < ord(Str2CurPos)) then
begin
Result:= Str1;
if(Reversed) then
Result:= Str2;
end else if(ord(Str2CurPos) < ord(Str1CurPos)) then
begin
Result:= Str2;
if(Reversed) then
Result:= Str1;
end else
i:= i + 1;
until(not(Result = ''));
end;
end;

function OrderArrayString(TheArray:array of string):array of string;
var tmpArray:array of string;
Count:integer;
Done:boolean;
temp:string;
begin
tmpArray:=TheArray;
repeat
Done:=true;
for Count:=0 to getarraylength(tmpArray)-2 do
begin
if not(tmpArray[Count]=tmpArray[Count+1])then
begin
if orderstring(tmparray[Count],tmparray[Count+1],false)= tmparray[Count+1] then
begin
temp:=tmpArray[Count];
tmpArray[Count]:=tmpArray[Count+1];
tmpArray[Count+1]:=temp;
Done:=false;
end;
end;
end;
until Done;
result:=tmpArray;
end;

function strArrayToStr(strArray: array of string): string;
var
i, arrayLength: Integer;
begin
arrayLength := GetArrayLength(strArray);
repeat
Result := Result + (strArray[i]);
if (not (i = (arrayLength - 1))) then
Result := Result + ' ';
i := i + 1;
until (i = arrayLength)
end;

begin
SetupSRL;
strarray:=['the','quick','red', 'fox', 'jumped','over','the','lazy','brown','dog'];
t:=getsystemtime;
writeln(inttostr(getsystemtime-t));
strarray:=orderarraystring(strarray);
writeln(strarraytostr(strarray));
end.


TOB

2007-03-12 14:46:14

Touche :P I had been thinking about when you had an assload of strings though.

You know I originally made this function so I could make the array one for that TPoint thing you requested but I wanted to use strings instead xD. ;)

Boreas

2007-03-13 00:34:39

Hehe I already did the Tpoint thing with a bubble sort, didn't take me as long as I thought.

TOB

2007-03-18 18:49:39

This is a FindSymbolIn until next SRL comes out. When searching for symbols try to search in sections such as –
Left Top Quadrant: MMX1, MMY1, MMCX, MMCY
Right Top Quadrant: MMCX, MMY1, MMX2, MMCY
Left Bottom Quadrant: MMX1, MMCY, MMCX, MMY2
Right Bottom Quadrant: MMCX, MMY1, MMX2, MMY2
Left Half: MMX1, MMY1, MMCX, MMY2
Right Half: MMCX, MMY1, MMX2, MMY2
Top Half: MMX1, MMY1, MMX2, MMCY
Bottom Half: MMX1, MMCY, MMX2, MMY2