SRL Archive - Help

There has got to be a better way to do this


rj

2013-01-01 12:48:40

Is there a better way to format this lol?

 FreeDTM(Spell_Stun);
FreeDTM(Spell_87Enchant);
FreeDTM(Rune_Earth);
FreeDTM(Rune_Fire);
FreeDTM(Rune_Chaos);
FreeDTM(Rune_Nature);
FreeDTM(Rune_Astral);
FreeDTM(Rune_Soul);
FreeDTM(Rune_Air);
FreeDTM(Rune_Water);
FreeDTM(Rune_Death);
FreeDTM(Rune_Mind);
FreeDTM(Rune_Cosmic);
FreeDTM(Rune_Body);
FreeDTM(Rune_Law);
FreeDTM(Rune_Blood);
FreeDTM(Spell_EarthBolt);
FreeDTM(Spell_FireBolt);
FreeDTM(Spell_WindBlast);
FreeDTM(Spell_Superheat);
FreeDTM(Spell_WaterBlast);
FreeDTM(Spell_49Enchant);
FreeDTM(Spell_EarthBlast);
FreeDTM(Spell_HighAlch);
FreeDTM(Spell_57Enchant);
FreeDTM(Spell_FireBlast);
FreeDTM(Spell_WindWave);
FreeDTM(Spell_WaterWave);
FreeDTM(Spell_Vulner);
FreeDTM(Spell_68Enchant);
FreeDTM(Spell_EarthWave);
FreeDTM(Spell_Enfeeble);
FreeDTM(Spell_FireWave);
FreeDTM(Tele_Var);
FreeDTM(Tele_Lum);
FreeDTM(Tele_Fal);
FreeDTM(Tele_Cam);
FreeDTM(Tele_Ard);
FreeDTM(Tele_Skill);
FreeDTM(Tele_Train);
FreeDTM(Tele_Ape);
FreeDTM(Spell_WindStrike);
FreeDTM(Spell_Confuse);
FreeDTM(Spell_Weaken);
FreeDTM(Spell_WaterStrike);
FreeDTM(Spell_7Enchant);
FreeDTM(Spell_EarthStrike);
FreeDTM(Spell_27Echant);
FreeDTM(Raw_Shark);
FreeDTM(Raw_RockTail);
FreeDTM(Raw_Manta);
FreeDTM(Cook_Shark);
FreeDTM(Cook_RockTail);
FreeDTM(Cook_Manta);
FreeDTM(Tab_Cb);
FreeDTM(Tab_Skills);
FreeDTM(Tab_Inventory);
FreeDTM(Tab_Wear);
FreeDTM(Tab_Pray);
FreeDTM(Tab_Spell);
FreeDTM(Cure_Me);
FreeDTM(SS_Test);

King

2013-01-01 12:51:13

You could write them as procedures with their specific names as the procedure? Like Procedure Free Tabs, Procedure Free Fish ect?

rj

2013-01-01 12:59:34

From: SRLKing
You could write them as procedures with their specific names as the procedure? Like Procedure Free Tabs, Procedure Free Fish ect?


I was thinking I could list it somehow to form rows like how i did with the variables:
Cure_Me,Tele_Var,Tele_Lum,Tele_Fal,Tele_Cam,Tele_Ard,Tele_Skill:Integer;
Tele_Train,Tele_Ape,Spell_WindStrike,Spell_Confuse,Spell_Weaken:Integer;
Spell_WaterStrike,Spell_7Enchant,Spell_EarthStrike,Spell_27Echant:Integer;
Spell_EarthBolt,Spell_FireBolt,Spell_WindBlast,Spell_Superheat:Integer;
Spell_WaterBlast,Spell_49Enchant,Spell_EarthBlast,Spell_HighAlch:Integer;
Spell_57Enchant,Spell_FireBlast,Spell_WindWave,Spell_WaterWave:Integer;
Spell_Vulner,Spell_68Enchant,Spell_EarthWave,Spell_Enfeeble:Integer;
Spell_FireWave,Spell_Stun,Spell_87Enchant:Integer;
{ Runes Written by RJJ95 }
Rune_Earth,Rune_Fire,Rune_Chaos,Rune_Nature,Rune_Astral,Rune_Soul:Integer;
Rune_Air,Rune_Water,Rune_Death,Rune_Mind,Rune_Cosmic,Rune_Body:Integer;
Rune_Law,Rune_Blood:Integer;
Instead of:
Cure_Me:Integer;
Tele_Var:Integer;
Tele_Lum:Integer;
Tele_Fal:Integer;
Tele_Cam:Integer;
Tele_Ard:Integer;
Tele_Skill:Integer;
Tele_Train:Integer;
Tele_Ape:Integer;
Spell_WindStrike:Integer;
Spell_Confuse:Integer;
Spell_Weaken:Integer;
Spell_WaterStrike:Integer;
Spell_7Enchant:Integer;
Spell_EarthStrike:Integer;
Spell_27Echant:Integer;
Spell_EarthBolt:Integer;
Spell_FireBolt:Integer;
Spell_WindBlast:Integer;
Spell_Superheat:Integer;
Spell_WaterBlast:Integer;
Spell_49Enchant:Integer;
Spell_EarthBlast:Integer;
Spell_HighAlch:Integer;
Spell_57Enchant:Integer;
Spell_FireBlast:Integer;
Spell_WindWave:Integer;
Spell_WaterWave:Integer;
Spell_Vulner:Integer;
Spell_68Enchant:Integer;
Spell_EarthWave:Integer;
Spell_Enfeeble:Integer;
Spell_FireWave:Integer;
Spell_Stun:Integer;
Spell_87Enchant:Integer;
{ Runes Written by RJJ95 }
Rune_Earth:Integer;
Rune_Fire:Integer;
Rune_Chaos:Integer;
Rune_Nature:Integer;
Rune_Astral:Integer;
Rune_Soul:Integer;
Rune_Air:Integer;
Rune_Water:Integer;
Rune_Death:Integer;
Rune_Mind:Integer;
Rune_Cosmic:Integer;
Rune_Body:Integer;
Rune_Law:Integer;
Rune_Blood:Integer;

Le Jingle

2013-01-01 13:07:52


var
i : integer;
dtms : array of integer;
begin
SetLength(dtms, 3);
dtms[0] := DtmFromString('aaa');
dtms[1] := DtmFromString('bb');
dtms[2] := DtmFromString('c');
for i := 0 to high(dtms) do
FreeDTM(i);
end.

can store dtm's in an array of integer / TIntegerArray / array [0..2] of integer -> as shown in the example above. Also thought there was a FreeDTMS(int arr); method, however perhaps I was wrong thus the for loop to free DTM's.

On a side note, if you are making an include, it could work better to review some of the SRL include as that many DTMs can easily make a script too much memory intensive.

Cheers,
Lj :)

rj

2013-01-01 13:14:16

From: Le Jingle

var
i : integer;
dtms : array of integer;
begin
SetLength(dtms, 3);
dtms[0] := DtmFromString('aaa');
dtms[1] := DtmFromString('bb');
dtms[2] := DtmFromString('c');
for i := 0 to high(dtms) do
FreeDTM(i);
end.

can store dtm's in an array of integer / TIntegerArray / array [0..2] of integer -> as shown in the example above. Also thought there was a FreeDTMS(int arr); method, however perhaps I was wrong thus the for loop to free DTM's.

On a side note, if you are making an include, it could work better to review some of the SRL include as that many DTMs can easily make a script too much memory intensive.

Cheers,
Lj :)


Thanks but I'm not sure that will work. The include won't have nearly as many DTM's as the SRL include

DannyRS

2013-01-01 13:15:23

You can put them on same line if that helps ;)

e.g.


FreeDTM(Spell_Stun); FreeDTM(Spell_87Enchant);
FreeDTM(Rune_Earth); FreeDTM(Rune_Fire); FreeDTM(Rune_Chaos);

rj

2013-01-01 13:19:39

From: DannyRS
You can put them on same line if that helps ;)

e.g.


FreeDTM(Spell_Stun); FreeDTM(Spell_87Enchant);
FreeDTM(Rune_Earth); FreeDTM(Rune_Fire); FreeDTM(Rune_Chaos);


I think Ill do that thanks

Echo_

2013-01-01 14:19:30

Just expanding on what Le Jingle came up with:

var
DTMs: array[0..3] of LongInt;
Indexes: (Rune_Air, Rune_Water, Rune_Fire, Rune_Earth);

procedure LoadDTMs;
begin
DTMs[Rune_Air] := DTMFromString('');
DTMs[Rune_Water] := DTMFromString('');
DTMs[Rune_Fire] := DTMFromString('');
DTMs[Rune_Earth] := DTMFromString('');
end;

procedure FreeDTMs;
var
I: Integer;
begin
for I := 0 to High(Indexes) do
FreeDTM(I);
end;

Olly

2013-01-01 14:24:08

Why so many dtms of like spells etc.. a mousebox would do them fine.

rj

2013-01-01 16:17:44

From: Ollybest
Why so many dtms of like spells etc.. a mousebox would do them fine.


I am making it more easy for the user to input they spell they want instead of having to change code themselves

Echo_

2013-01-01 16:33:14

From: rjj95
I am making it more easy for the user to input they spell they want instead of having to change code themselves


Mousebox would still be easier, just by using spell icon bounds stored in constants and creating a function that will click within the correct bounds for the requested spell.

King

2013-01-01 17:47:00

From: Echo_
Mousebox would still be easier, just by using spell icon bounds stored in constants and creating a function that will click within the correct bounds for the requested spell.


Agreed, this seems like it will take forever, where as you can just use a record to store the Co-ordinate boxes and then go off of User input?