Results 1 to 3 of 3

Thread: Using a variable in a procedure name?

  1. #1
    Join Date
    Aug 2007
    Location
    England
    Posts
    734
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Using a variable in a procedure name?

    Currently i have a variable Step, which is defined by many if statements to get the right step....

    i then use a

    SCAR Code:
    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?
    The truth finally came out...


  2. #2
    Join Date
    Feb 2006
    Location
    With mooncow on the moon
    Posts
    292
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by mat_de_b View Post
    Currently i have a variable Step, which is defined by many if statements to get the right step....

    i then use a

    SCAR Code:
    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.
    ~ Solemn Wishes

  3. #3
    Join Date
    Aug 2007
    Location
    England
    Posts
    734
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    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 as for the code, ill try and help you out

    This determines the value of step

    SCAR Code:
    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

    SCAR Code:
    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 but maybe itll turn out good
    The truth finally came out...


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. UseSandwichSolver variable...
    By orion pax in forum OSR Help
    Replies: 2
    Last Post: 10-22-2007, 08:57 PM
  2. Is there any variable like...?
    By dritar in forum OSR Help
    Replies: 2
    Last Post: 10-05-2007, 06:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •