Results 1 to 9 of 9

Thread: Writing Consts values

  1. #1
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default Writing Consts values

    hi, basically I'm trying to writeln the values I have in my consts (example below);
    Simba Code:
    Program AutoSpammer;
      {$i SRL\SRL.Simba}
    Const
      a = 0;
      b = 1;

    Procedure ActuallyWrite;
    Var
      i: Integer;
    Begin
      For i := 0 to 1 Do
        WriteLn([i]);
    End;

    Begin
      SetupSRL;
      ActuallyWrite; // Should type Write Line this letter: a
                     // Should type Write Line this letter: b
    End.
    (This writes, but not what I want; )
    Code:
    SRL Compiled in 0 msec
    [0]
    [1]
    Successfully executed.

    So overall, I can't figure out how to write the 'a' and then 'b' that I have stored as 0 and 1. (I need to keep the 0 and 1 relations to a and b, respectively in the consts)

    Any help is highly appreciated! :>

    Cheers

  2. #2
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    You're not actually writing A or B. You're writing The amount of iterations your loop is doing.

    I think you're trying to do:

    Simba Code:
    for I:= 0 To 1 Do
       WriteLn('WriteLn: A:' + ToStr(A) + '  B: ' + ToStr(B));
    I am Ggzz..
    Hackintosher

  3. #3
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    You've stored values in a and b, but they are just values. You would need to do:

    Simba Code:
    Writeln(a);
    Writeln(b);

    To write the the stored values in a and b.

  4. #4
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    U dont fully understand for loops; it doesn't work this way. If u want to write ur const, just
    Simba Code:
    Writeln(IntToStr(a));  //converts integer a to string
    Writeln(IntToStr(b));

    For loops is basically exactly the same as repeat...until loop except it automatically increases "i" by one and stops when i reaches the end value, i.e. its the same as
    repeat
    action1;
    Inc(i);
    until (i=1);

  5. #5
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Ah so if I understand, since I've stored values for a and b in the consts, I can't reverse the process - writing a or b from the const since they themselves are storing the values (it's not a 2-way street, meaning I'd have to flip flop them*?).

    * = Example below
    Simba Code:
    Const
    1 = a;
    2 = b;

  6. #6
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Le Jingle View Post
    Ah so if I understand, since I've stored values for a and b in the consts, I can't reverse the process - writing a or b from the const since they themselves are storing the values (it's not a 2-way street, meaning I'd have to flip flop them*?).

    * = Example below
    [simba) snip! (/simba]

  7. #7
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    LOL ahaha I actually had a good laugh reading the flip-flop.

    Anyway you cannot flip-flop them. Quick explanation that I hope I didn't go overboard with:

    Consts are constant values. They cannot change during run-time (basically cannot change after u pressed play). Your code should not try to change them either because they always stay the exact same. Hence the word constant.

    Now a constant can be assigned to once and a constant is either A: variable, B: value.

    Variables as we know, can be assigned to but values cannot be assigned to and do not change unless change by YOU.

    Example:
    Simba Code:
    const       //Declares that the values declared after this are constants and will not change at all!

      A = 1;     //A has a CONSTANT value of 1 and A will never change throughout the script.
      B = 2;     //B has a constant value of 2 and never changes at all unless you manually edit the script and change it.


      1 = A;     //Illegal. We cannot do this because 1 is already a constant in itself. It's like trying to say 1 = 2. Doesn't work. Both are constant and never change.
                 //Only variables can change, remember that. Constants are just a special type of variable that doesn't change.
                 //Values are not variables, but they are by definition "TRUE" constants.

    My first teacher told me: Imagine being in bed with a 100% girl and all of a sudden she turns tranny on you. Shouldn't happen because she's 100% constant girl.
    Last edited by Brandon; 06-21-2012 at 06:00 AM.
    I am Ggzz..
    Hackintosher

  8. #8
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    LOL ahaha I actually had a good laugh reading the flip-flop.

    Anyway you cannot flip-flop them. Quick explanation that I hope I didn't go overboard with:

    Consts are constant values. They cannot change during run-time (basically cannot change after u pressed play). Your code should not try to change them either because they always stay the exact same. Hence the word constant.

    Now a constant can be assigned to once and a constant is either A: variable, B: value.

    Variables as we know, can be assigned to but values cannot be assigned to and do not change unless change by YOU.

    Example:
    Simba Code:
    const       //Declares that the values declared after this are constants and will not change at all!

      A = 1;     //A has a CONSTANT value of 1 and A will never change throughout the script.
      B = 2;     //B has a constant value of 2 and never changes at all unless you manually edit the script and change it.


      1 = A;     //Illegal. We cannot do this because 1 is already a constant in itself. It's like trying to say 1 = 2. Doesn't work. Both are constant and never change.
                 //Only variables can change, remember that. Constants are just a special type of variable that doesn't change.
                 //Values are not variables, but they are by definition "TRUE" constants.

    My first teacher told me: Imagine being in bed with a 100% girl and all of a sudden she turns tranny on you. Shouldn't happen because she's 100% constant girl.
    hahah! this is a great lesson to have been learned by me! Thanks a ton, plus it really sticks in your head, the way you explained it &

    So in hopes of learning as well as easing my workload for using this in a high repetition manner, if I did this (see code below), how would I go through and write all the lines of strings stored in the constants? *marked the line towards the end

    Simba Code:
    Const
      A_String = 'WeNeedToWriteThis1';
      B_String = 'WeNeedToWriteThis2';
      C_String = 'WeNeedToWriteThis3';
      D_String = 'WeNeedToWriteThis4';
      E_String = 'WeNeedToWriteThis5';
      LeStrings = 'WeNeedToWriteThis6';

    Var
      i, g: Integer;
      LeStrings: TStringArray;

    Begin
      ClearDebug;
      g := High(LeStrings);
      For i:= 0 To g Do
        Begin
          WriteLn('What String we are writing:' + {The 1st Const stored String} + '.');
          Wait(5000);
          TypeByte(vk_down);
          WriteLn('What String we are writing:' + {The 2nd Const stored String} + '.');
          Wait(5000);
          TypeByte(vk_down);
          WriteLn('What String we are writing:' + {The 3rd Const stored String} + '.');
          Wait(5000);
          TypeByte(vk_down);
          {Any way to also shorten this (array somehow, but all my attempts are failures)
            so when its used thousands of time, it's not write, wait, mmouse?}

        End;
    End.
    Last edited by Le Jingle; 06-21-2012 at 07:20 AM.

  9. #9
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Is this what you are looking for:
    Simba Code:
    Const
      A_String = 'WeNeedToWriteThis1';
      B_String = 'WeNeedToWriteThis2';
      C_String = 'WeNeedToWriteThis3';
      D_String = 'WeNeedToWriteThis4';
      E_String = 'WeNeedToWriteThis5';
      F_String = 'WeNeedToWriteThis6';

    Var
      i, g: Integer;
      LeStrings : TStringArray;

    Begin
      ClearDebug;
      LeStrings := [A_String, B_String, C_String, D_String, E_String, F_String];
      g := High(LeStrings);
      For i:= 0 To g Do
        Begin
          WriteLn('What String we are writing: ' + LeStrings[i] + '.');
          Wait(5000);//If this is for runescape don't use static waits, either do Wait(4000+Random(2000)); or wait(RandomRange(4000, 6000));
          TypeByte(vk_down);
        End;
    End.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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