Results 1 to 14 of 14

Thread: rofl case error :D

  1. #1
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    rofl case error :D

    feeling kinda newbish, but i really cant see anything wrong here:
    SCAR Code:
    function StopBurning : boolean;
    begin
     for i := 0 to 5 do
      case i of
       0: if TimeFromClickingLog > 15000) then (result := true);  // line 301
       1: if IsBlackText('he fire', 8) then (result := true);
       2: if IsBlackText('ou can', 8) then (result := true);
       3: if FindText(x, y, 'Congratulation', NPCChars, MCX1, MCY1, MCX2, MCY2) then (result := true);
       4: if InFight then (result := true);
       5: if FindNormalRandoms then (result := true);
      end;
    end;
    i get 'Identifier expected in script' all the time, ive tried to fix it but noes..
    It says that the error is in line 301, which is marked in the script above.

    PROBLEM SOLVED!!
    Now having another issue:
    InFight does not recognize if i am in fight or not. why? what to do?

  2. #2
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Declare I as Integer.


  3. #3
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    i have. If i hadn't it would tell me "unknown identifier i in the script"

  4. #4
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    function StopBurning: Boolean;
    var
      X, Y: Integer;
      I: Byte;
     
    begin
      Result := False;
      if not LoggedIn then exit;
      for i := 0 to 5 do
      begin
        case i of
          0: Result := TimeFromClickingLog > 15000;
          1: Result := FindBlackChatMessage('he fire');
          2: Result := FindBlackChatMessage('ou can');
          3: Result := FindText(x, y, 'Congratulation', NPCChars, MCX1, MCY1, MCX2, MCY2);
          4: Result := (FindColor(x, y, 65280, 230, 130, 280, 180) or
            FindColor(x, y, 255,   230, 130, 280, 180)); // InFight from Fighting.scar
          5: Result := FindNormalRandoms;
        end;
        if Result then exit;
      end;
    end;

    You should always try to declare your variables locally, within procedues or functions. That way, they'll be freed once SCAR exits out of the procedure/function.


    Edit: I assume that TimeFromClickingLog is a global integer?

  5. #5
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Thanks alot chicken! Now its working! I add you to my credits

  6. #6
    Join Date
    Feb 2007
    Location
    South East England
    Posts
    2,906
    Mentioned
    2 Post(s)
    Quoted
    8 Post(s)

    Default

    SCAR Code:
    1: Result := FindBlackChatMessage('he fire');

    Why would you want to stop burning every time you burn a log? Seems a bit pointless, make it so the program runs until all the logs are burnt.
    Jus' Lurkin'

  7. #7
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    You should have checked the script before that comment.

  8. #8
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    If you are doing for loop + case statements, make sure you set it to break when the result is true. Otherwise it is HIGHLY likely to return false.

    Also, instead of doing if Condition then Result := True, do Result := Condition, saves you lines and makes you look 1337.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  9. #9
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Only error is that it wont recognize if i am in combat or not. It only runs away like 20% of the time. Do you know if it's cause of the InFight function or..?

  10. #10
    Join Date
    Mar 2008
    Location
    ::1
    Posts
    915
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I get that with a lot of scripts... seems to be a hard issue... You can always count the number of hp bar red and hp bar green pixels to estimate if you're in a fight..... works as a failsafe for me... but do a TPA debug first so that you're not finding other green and red pixels that just happen to be in the area that your script works in.

    EDIT: I'm talking about the issue in the last post of the thread (the post right before mine).

    Records and Types Save Code (and make you look better)
    Quote Originally Posted by Wizzup? View Post
    Is it possible to make Runescape a 2D game with this?... That would greatly simplify... Just about anything.

  11. #11
    Join Date
    Feb 2007
    Location
    South East England
    Posts
    2,906
    Mentioned
    2 Post(s)
    Quoted
    8 Post(s)

    Default

    There's quite a few errors, it does not compile for me.
    Jus' Lurkin'

  12. #12
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    torrent yes that's the older version which had errors with cases. I remove it now

  13. #13
    Join Date
    Sep 2007
    Posts
    638
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by marpis View Post
    Only error is that it wont recognize if i am in combat or not. It only runs away like 20% of the time. Do you know if it's cause of the InFight function or..?
    You can try to use FindFight as a substitute for InFight.

  14. #14
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by marpis View Post
    Only error is that it wont recognize if i am in combat or not. It only runs away like 20% of the time. Do you know if it's cause of the InFight function or..?
    or do an HP check, like:
    SCAR Code:
    if HP =< 80% then
    RunAway(blah, blah...);

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Rofl!!!!!!!!!!!!!!!!!!
    By Brianb in forum News and General
    Replies: 10
    Last Post: 08-30-2008, 02:56 AM
  2. ROFL Jagex :)
    By Jason2gs in forum Semi Stupid Pictures
    Replies: 89
    Last Post: 05-12-2008, 12:56 AM
  3. ROFL look at what none autoers think we do this for
    By Dadeer in forum News and General
    Replies: 76
    Last Post: 09-14-2007, 01:40 AM
  4. rofl-video
    By TravisV10 in forum Music, Movies and TV
    Replies: 5
    Last Post: 08-11-2007, 02:25 PM
  5. Wanna rofl? Come here...
    By n3ss3s in forum News and General
    Replies: 3
    Last Post: 08-01-2007, 12:48 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
  •