Results 1 to 17 of 17

Thread: Integers

  1. #1
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Integers

    Why does I:=1 to 99 give me 'Identifier expected' and how can I make it so that I := 1, 2, 3, 4, 5, 6, bah bah bah , 99?

    I do not want to use a 'For I = 1 to 99 do' line.
    Active only during the Summer...

  2. #2
    Join Date
    Nov 2007
    Location
    Nowhereville
    Posts
    1,155
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Edit:
    Sorry saw first post:

    SCAR Code:
    repeat
      i:=i+1
    until(i=99);

    Now It's right.
    Formerly known as Cut em2 it

  3. #3
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hey thanks you completely did not answer my question!
    I'm trying to make it so that I = everything between 1 and 99. Not 1 or 2 or 3 or 4 or 5 or blah. I'm looking for a way so that it equals 1 and 2 and 3 and 4 and 5 and blah.
    P.S.
    You missed a semicolon on line 2.
    Active only during the Summer...

  4. #4
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Can you clarify your question some more?
    Like an example of why you need this/ what your using it for?

  5. #5
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    3:begin
          if FindChatText('c lvl')then
          begin
            SayCurrentLevels('Runecraft');
            Typesend('yours?');        
            I := 1 to 99;
            repeat
              wait(50+random(50));
              Players[CurrentPlayer].Integers[2] := Players[CurrentPlayer].Integers[2] - 1;
            until FindChatText(inttostr(I)) or (Players[CurrentPlayer].Integers[2] = 0);
          end;
        end;
    Returns me an error (Identifier).

    I'm trying to make it so that I has multiple meanings. No sequence to it, I could make it so that it repeats until 'true,' but this got me curious.

    Not 1 2 3 4 5 6 7 8 9 10, not so that it is achieved by randoms, but so that it is every number between 1 and 99.
    SCAR Code:
    I := 1 2 3 4 5 8 7 9 6 10 15 25.

    I guess I could do
    SCAR Code:
    a
    for I:=1 to 99 do
    if found=false
    I:= 99 downto 1
    if found = false
    goto a
    or something to this effect as well, but this has nothing to do with it either.
    Does this explain what I'm asking or have I confused you some more?
    BAAHH THEY ALWAYS LEAVE! CMON GUYS! BEING LAZY ONLY ANSWERING DUMB QUESTIONS.
    Active only during the Summer...

  6. #6
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Umm, don't you need to declare I as a variable?
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  7. #7
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by IP-Drowner View Post
    Umm, don't you need to declare I as a variable?
    HAHHAHAHHAHAHAHHAHAHAHHAHAHAHA.
    Active only during the Summer...

  8. #8
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    3:begin
          if FindChatText('c lvl')then
          begin
            SayCurrentLevels('Runecraft');
            Typesend('yours?');        
            for I := 1 to 99 do
            begin
              wait(50+random(50));
              Players[CurrentPlayer].Integers[2] := Players[CurrentPlayer].Integers[2] - 1;
              if FindChatText(inttostr(I)) or (Players[CurrentPlayer].Integers[2] = 0) then
                Break;
            end;
          end;
        end;
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  9. #9
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Santa_Clause View Post
    SCAR Code:
    3:begin
          if FindChatText('c lvl')then
          begin
            SayCurrentLevels('Runecraft');
            Typesend('yours?');        
            for I := 1 to 99 do
            begin
              wait(50+random(50));
              Players[CurrentPlayer].Integers[2] := Players[CurrentPlayer].Integers[2] - 1;
              if FindChatText(inttostr(I)) or (Players[CurrentPlayer].Integers[2] = 0) then
                Break;
            end;
          end;
        end;
    No, it goes in a sequence.
    Is it that hard to understand? Yes I know that this will work, good.
    I'm not asking for a method of finding some crazy string, I'm asking is SCAR or any language at that capable of making it so that some variable is between two integers (greater than 0 and less than 100). And if so in SCAR, how would you write it?
    Active only during the Summer...

  10. #10
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    No you can't do that..

    I'd just do something like this:
    SCAR Code:
    while not FindChatText(inttostr(I)) do
      begin
        Inc(i);
        if (i >= 99) then i := 1;
        Players[CurrentPlayer].Integers[2] := Players[CurrentPlayer].Integers[2] - 1;
        if (Players[CurrentPlayer].Integers[2] = 0) then Break;
      end;
    But idk, I don't really know what it's for so..

    EDIT: lol Santa beat me to it

  11. #11
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Derek- View Post
    No you can't do that..

    I'd just do something like this:
    SCAR Code:
    while not FindChatText(inttostr(I)) do
      begin
        Inc(i);
        if (i >= 99) then i := 1;
        Players[CurrentPlayer].Integers[2] := Players[CurrentPlayer].Integers[2] - 1;
        if (Players[CurrentPlayer].Integers[2] = 0) then Break;
      end;
    But idk, I don't really know what it's for so..

    EDIT: lol Santa beat me to it
    OK, thanks =/ Too bad.

    What this does is it takes the predefined variable (Players.Integers[2]) which in the script I am writing has a default of 50, which goes up every 'load' and goes down every .050 secs if someone asks your rc level. I wanted I to have 99 different values, which I did not think was possible, but got curious so I figured I'd ask.
    Boiled down, an autoresponder.
    Active only during the Summer...

  12. #12
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Oh I see..
    Well really you only need to search for the digits 0-9.. Since any number 1-99 will have those.. Then find what lvl they say (if that's what you want to find).

    I'm sure you could make a function like this pretty easily.
    If you want more help on it I'm willing to help

  13. #13
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, I thought of this too because I knew that it could* think a number is three different things (really two, the 'outliers') depending on whether it's on the downto or to...so now I'm looking at bitmaps. Hmm I may just trash this idea completely, although I want my script to be a considerate little cheater.

    Ex.

    98 contains
    98
    9
    8
    Active only during the Summer...

  14. #14
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Yes and then there's always if the player has numbers in their name it might mess everything
    up..

    EDIT: I'd do something like this idk..
    SCAR Code:
    Function PlayerSaysLevel: Boolean;
    var
      i : Integer;
      chat : string;
    begin
      repeat
        for i := 0 to 9 do
        begin
          GetLastChatText(chat);
          if (Pos(chat, IntToStr(i)) <> 0) then
          begin
            Result := True;
            Exit;
          end;
        end;
      until (Players[CurrentPlayer].Integers[2] = 0)
    end;

  15. #15
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Derek- View Post
    Yes and then there's always if the player has numbers in their name it might mess everything up..
    I have not thought of this...Hmm...
    FindChatText I think is the one that grabs the last line of text...It may have coordinates that do not include the name.
    Edit:Actually, I take that back. The name and the text are different colors. The username should not be included.
    That looks like it would work, but you never subtract from the integer used as a fail-safe.
    Active only during the Summer...

  16. #16
    Join Date
    Jul 2007
    Location
    St. Louis, Missouri, USA.
    Posts
    575
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You could use an array of the numbers as a string
    SCAR Code:
    I := ['0','1','2','3','4','5','6','7','8','9'];
    and then and then use something like if PosArray <> 0 then blah. I don't have all the details right now, look up some autoresponders, you might find one that does what I said. InChat will get messed up by players names but if you use a function like GetTextAtEx it can work.
    -You can call me Mick-



  17. #17
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by mickaliscious View Post
    You could use an array of the numbers as a string
    SCAR Code:
    I := ['0','1','2','3','4','5','6','7','8','9'];
    and then and then use something like if PosArray <> 0 then blah. I don't have all the details right now, look up some autoresponders, you might find one that does what I said. InChat will get messed up by players names but if you use a function like GetTextAtEx it can work.
    Yeah I see what you mean, but like I said, I'm more interested in scripting than scripting itself. (If you get what I'm saying, I'm more interested in the rules than doing it.)
    Active only during the Summer...

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Integers in TIntegerArray
    By marpis in forum OSR Help
    Replies: 12
    Last Post: 03-03-2009, 11:19 PM
  2. Randomizing Integers
    By daw_guy in forum OSR Help
    Replies: 15
    Last Post: 01-13-2008, 12:14 PM
  3. Should integers get any larger?
    By R0b0t1 in forum Discussions & Debates
    Replies: 15
    Last Post: 11-04-2007, 09:06 AM
  4. integers!
    By Cruel100 in forum OSR Help
    Replies: 7
    Last Post: 10-27-2007, 04:28 PM
  5. Help with Multiplying integers...
    By snuwoods in forum OSR Help
    Replies: 5
    Last Post: 02-07-2007, 12:05 AM

Posting Permissions

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