Log in

View Full Version : Using a variable in a procedure name?



mat_de_b
08-23-2007, 05:52 PM
Currently i have a variable Step, which is defined by many if statements to get the right step....

i then use a


case Step of
1 : Step1;
etc...
end;


my questions is am i able to replace that with
Step[Step];

or something on those lines?

EDIT:
another question, should i load DTMs in thier own procedures or should i ahve them avaliable throughout? basically is a DTM hard for the computer to manage?

solemn wishes
08-23-2007, 07:15 PM
Currently i have a variable Step, which is defined by many if statements to get the right step....

i then use a


case Step of
1 : Step1;
etc...
end;


my questions is am i able to replace that with
Step[Step];

or something on those lines?

EDIT:
another question, should i load DTMs in thier own procedures or should i ahve them avaliable throughout? basically is a DTM hard for the computer to manage?


would it be possible for you to show me some more of you code because i dont fully understand what you are asking, or even better explain it a lil more indeph?

and as for the DTM question loading them at the start of a script i would reccomend. Simple create a procedure e.g. Procedure LoadDtms; they only need to be loaded once, however do use memory when doing so.

You 'could' call upon them in a procedure or function then simply using freedtm(dtmname) free memory up when they are not being used....all depends on what you are doing with them.

mat_de_b
08-23-2007, 09:02 PM
Yeh ive got them declared in a load procedure at the moment, and i suppose ill keep it like that, it asnt made anything lag yet, so i guess im fine :D as for the code, ill try and help you out

This determines the value of step


Procedure DetermineStep;
begin
Status('Getting Step');
Step := 0;
while(Step = 0) do
begin
if(FindNpcChatText('Getting started'))then
begin
Step :=1
Writeln('Just gonna chat to the RS Guide');
end;

if(FindNpcChatText('Please click'))then
begin
Step :=2
Writeln('Opening Up the Settings Tab');
end;

if(FindNpcChatText('On the side panel'))then
begin
Step :=3
Writeln('Looks like RS Guide wants to chat some more... shame');
end;

end;
end;



This then according to its value runs a procedure


begin
DetermineStep;
Status('Getting To Work');
HighestAngle;
Case Step of
1 : Step1;
2 : Step2;
3 : Step3;
4 : Step4;
5 : Step5;
6 : Step6;
7 : Step7;
8 : Step8;
9 : Step9;
10 : Step10;
11 : Step11;
12 : Step12;
13 : Step13;
14 : Step14;
15 : Step15;
16 : Step16;
17 : Step17;
18 : Step18;
19 : Step19;
20 : Step20;
21 : Step21;
22 : Step22;
23 : Step23;
24 : Step24;
25 : Step25;
26 : Step26;
27 : Step27;
28 : Step28;
29 : Step29;
30 : Step30;
31 : Step31;
32 : Step32;
33 : Step33;
34 : Step34;
35 : Step35;
36 : Step36;
37 : Step37;
38 : Step38;
end;
end.

basically im wondering, if i can replace the entire case part with something that puts the variable Step after the words Step so like

Step[Step]; where step would equal say 5 so ti would do Step5;

im not sure if this is possible and im not sure why i made my script like this :D but maybe itll turn out good