Results 1 to 13 of 13

Thread: Runtime Canvas error..

  1. #1
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Runtime Canvas error..

    Here's the error:

    SCAR Code:
    [Runtime Error] : Exception: Canvas does not allow drawing in line 641 in script C:\Program Files\SCAR 3.11\includes\SRL/SRL/Core/Symbol.scar

    it occurs when i call: FindSymbolIn...

    I HAVE called SetupSRL. Any suggestions?

  2. #2
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    Can I see example of your code please?


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  3. #3
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Do you want to see the whole script? or just that procedure that has that piece of code in it?

  4. #4
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    Whole script might be nice.. if not, just a piece.


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  5. #5
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, here's the full script: I started it like an hour or so ago... soo stick with me. its still a BIT messy...

    NOTE: I call FindSymbolIn in the WalkToWaterAlter procedure.


    EDIT: did anyone see my password?? cause i left it in there for a little bit, but i think i deleted it before anyone could see it..
    SCAR Code:
    program New;
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Skill\RuneCrafting.scar}

    //----------------------------------------------------------------------------\\
    //----------------------------------------------------------------------------\\
    //                        -->   USER DEFINED PARAMETERS   <--                 \\
    //----------------------------------------------------------------------------\\
    //----------------------------------------------------------------------------\\
    Const  NumberOfUsers = 1;
    Const  StartPlayer = 0;
    Const  VerNumber = '.85b'; //No need to change this.
    Const  YourSRLSTATSID   = '';  // Stats ID.
    Const  YourSRLSTATSPASS = ''; // Stats Pass.
    Const  YourRCMASTER      = ''; // Remote Control Master.
    Const  DoDebug = 4;//1: title bar. 2: writeln. 3: status. 4: All
    Const  ExtendedDebug = True; //My debug? It helps me correct bugs etc..

    //----------------------------------------------------------------------------\\
    //                        -->   VARIABLES   <--                               \\
    //----------------------------------------------------------------------------\\

    Var
      TiaraDTM,X,Y,Loads: Integer;
    Var
      SkipItems: Array[1..21] of String;
    //----------------------------------------------------------------------------\\
    //                        -->   DEBUG   <--                                   \\
    //----------------------------------------------------------------------------\\

    procedure DoomDebug(S:String);
    begin
     Case DoDebug Of
      1:Disguise(S);
      2:Writeln(S);
      3:Status(S);
      4: Begin
         Disguise(S);
         Writeln(S);
         Status(S);
         end;
     end;
    end;

    //----------------------------------------------------------------------------\\
    //                        -->   DECLARE PLAYERS   <--                         \\
    //----------------------------------------------------------------------------\\

    Procedure DeclarePlayers;
    Begin
      DoomDebug('Declare Players');
      NumberOfPlayers(NumberOfUsers);
      HowManyBooleans := 1;

      Players[0].Name := ''; //Username
      Players[0].Pass := '';     //Password
      Players[0].Integers[0] := 50;     //Loads to do..
      Players[0].Booleans[0] := True; //True for tiara, false for tally
      Players[0].Strings[0] := '';   //Bank pin. If none, leave blank.
      Players[0].Strings[1] := 'E';  //Direction to run. N, E, S, W.
      Players[0].Active := True; //Is the player active?

      Players[1].Name := '';
      Players[1].Pass := '';
      Players[1].Integers[0] := 15;
      Players[1].Booleans[0] := False;
      Players[1].Extendeds[0] := 0; //DONT TOUCH!
      Players[1].Extendeds[1] := 0; //DONT TOUCH!
      Players[1].Extendeds[2] := 0; //DONT TOUCH!
      Players[1].Strings[0] := '';
      Players[1].Strings[1] := 'E';
      Players[1].Active := True;

      Players[2].Name := '';
      Players[2].Pass := '';
      Players[2].Integers[0] := 15;
      Players[2].Booleans[0] := False;
      Players[2].Extendeds[0] := 0; //DONT TOUCH!
      Players[2].Extendeds[1] := 0; //DONT TOUCH!
      Players[2].Extendeds[2] := 0; //DONT TOUCH!
      Players[2].Strings[0] := '';
      Players[2].Strings[1] := 'E';
      Players[2].Active := True;

      Players[3].Name := '';
      Players[3].Pass := '';
      Players[3].Integers[0] := 15;
      Players[3].Booleans[0] := False;
      Players[3].Extendeds[0] := 0; //DONT TOUCH!
      Players[3].Extendeds[1] := 0; //DONT TOUCH!
      Players[3].Extendeds[2] := 0; //DONT TOUCH!
      Players[3].Strings[0] := '';
      Players[3].Strings[1] := 'E';
      Players[3].Active := True;

      Players[4].Name := '';
      Players[4].Pass := '';
      Players[4].Integers[0] := 5;
      Players[4].Booleans[0] := True;
      Players[4].Extendeds[0] := 0; //DONT TOUCH!
      Players[4].Extendeds[1] := 0; //DONT TOUCH!
      Players[4].Extendeds[2] := 0; //DONT TOUCH!
      Players[4].Strings[0] := '';
      Players[4].Strings[1] := 'E';
      Players[4].Active := True;

      Players[5].Name := '';
      Players[5].Pass := '';
      Players[5].Integers[0] := 5;
      Players[5].Booleans[0] := True;
      Players[5].Extendeds[0] := 0; //DONT TOUCH!
      Players[5].Extendeds[1] := 0; //DONT TOUCH!
      Players[5].Extendeds[2] := 0; //DONT TOUCH!
      Players[5].Strings[0] := '';
      Players[5].Strings[1] := 'E';
      Players[5].Active := True;

      Writeln('Using '+IntToStr(HowManyPlayers)+' Players');
      LoadPlayerArray;
    end;

    Procedure LoadDTMBMP;
    Begin
      TiaraDTM := DTMFromString('78DA637466666078CDC80002109281E1EF9F3' +
           'F0C5C50FE7F20603401AA790A9165628001543D8C014035CF09A8' +
           'B105AAF9885F0D00C2DC0BCA');
    End;

    //----------------------------------------------------------------------------\\
    //                        -->   LOAD NULL WORS   <--  creds to Mad Cow        \\
    //----------------------------------------------------------------------------\\

    procedure LoadNullWords;
    begin
      SkipItems[1] := 'the';
      SkipItems[2] := 'but';
      SkipItems[3] := 'yes';
      SkipItems[4] := 'lol';
      SkipItems[5] := 'brb';
      SkipItems[6] := 'gtg';
      SkipItems[7] := 'cya';
      SkipItems[8] := 'how';
      SkipItems[9] := 'hey';
      SkipItems[10] := 'wat';
      SkipItems[11] := 'umm';
      SkipItems[12] := 'him';
      SkipItems[13] := 'she';
      SkipItems[14] := 'man';
      SkipItems[15] := 'wow';
      SkipItems[16] := 'god';
      SkipItems[17] := 'nub';
      SkipItems[18] := 'nop';
      SkipItems[19] := 'did';
      SkipItems[20] := 'you';
      SkipItems[21] := 'ing';
    end;


    //----------------------------------------------------------------------------\\
    //                        -->   CREATE NICK   <--  creds to Mad Cow           \\
    //----------------------------------------------------------------------------\\

    function CreateNick(Username : String) : String;
    var
      UserLength, NickStart, INick, A : Integer;
      Nicks, Temp : String;
      BadNick : Boolean;
    begin
      UserLength := Length(Username);
      INick := 0;
      LoadNullWords;
      repeat
        BadNick := False;
        NickStart := 2 + INick;
        Nicks := Nicks + Copy(Username, NickStart, 3);
        for A := 1 to 3 do
        begin
          Temp := Copy(Nicks, A, 1);
          if(Temp = ' ') or (Temp = '_')then
          begin
            INick := INick + 1;
            Nicks := '';
            BadNick := True;
          end;
        end;
        for A := 1 to 21 do
        begin
          if(Nicks = SkipItems[A]) then
          begin
            INick := INick + 1;
            Nicks := '';
            BadNick := True;
          end;
        end;
      until((not(BadNick)) or (NickStart >= 15))
      Result := Nicks;
    end;

    //----------------------------------------------------------------------------\\
    //                        -->   GENERATE NICKNAMES   <--  creds to Mad Cow    \\
    //----------------------------------------------------------------------------\\

    Procedure GenerateNickNames;
    Begin
      Writeln('');
      Writeln('Creating Nicknames:');
      Status('Creating Nicknames');
      For X := 0 to HowManyPlayers - 1 do
      begin
        if(Players[X].Nick = '') then
        begin
          Players[X].Nick := CreateNick(Players[X].Name);
          WriteLn('  Players[' + IntToStr(X) + '].Nick := ' + Players[X].Nick + ';');
          Wait(1);
        end;
      end;
      Writeln('');
      Status('Setting Players Current Location:');
      For X := 0 to HowManyPlayers - 1 do
        Players[X].Loc := 'Not Yet Started Autoing';
      Status('If you see this Message for Longer than 3 Seconds, Stop the Script and Restart Straight Away!');
    end;

    //----------------------------------------------------------------------------\\
    //                        -->   AUTO RETALIATE   <--                          \\
    //----------------------------------------------------------------------------\\

    procedure AutoRetaliate(Yes: Boolean);
    begin
      GameTab(1)
        case Yes of
        True: if (not (GetColor(637, 386) = 2106255)) then
              Begin
                MouseBox(570, 361, 714, 400, True);
                Wait(600 + Random(200));
              End;

        False: if (GetColor(637, 386) = 2106255) then
               Begin
                 MouseBox(570, 361, 714, 400, True);
                 Wait(600 + Random(200));
               End;
      end;
    end;


    //----------------------------------------------------------------------------\\
    //                        -->   TIARA/TALLY FINDING   <--                     \\
    //----------------------------------------------------------------------------\\
    Function TallyCheck:Boolean;
    Begin
      GameTab(4);
      Result := FindBitmap(talis_air, x, y);
    End;

    Function TiaraCheck:Boolean;
    Var
      i : LongInt;
    Begin
      GameTab(4);
      Result := FindDTM(TiaraDTM, x, y, MIX1, MIY1, MIX2, MIY2);
      If (ExtendedDebug) Then
      Begin
        DoomDebug('Found Tiara in inventory..');
        DoomDebug('We are now equipping it..');
      End;
      If (Result) Then
      Begin
        Mouse(x, y, 2, 2, True);
        For i := 0 to 100 do
        Begin
          Wait(100);
          If (Not(FindDTM(TiaraDTM, x, y, MIX1, MIY1, MIX2, MIY2))) Then
            Break;
        End;
      End;

      If (Not(FindDTM(TiaraDTM, x, y, MIX1, MIY1, MIX2, MIY2))) Then
      Begin
        GameTab(5);
        If (FindDTM(TiaraDTM, x, y, MIX1, MIY1, MIX2, MIY2))Then
          Result:= True;
          If (ExtendedDebug) Then
            DoomDebug('Found Tiara in equip tab..');
      End;

    End;

    Function AutoColorLadder:Boolean;
    Var
      Ladder,LadderColor,iX,iY : LongInt;

    Begin
      Ladder:= DTMFromString('78DA63BCC0C8C0F09D010C18211443A20E1B8' +
           '30694FF1F08180F03590F20724C503515C5F10C22487A181F0359' +
           '9F195000BA1A002D570CC0');
      If (FindDTM(Ladder, iX, iY, MMX1, MMY1, MMX2, MMY2))Then
      Begin
        LadderColor:= GetColor(iX, iY);
        Result:= True;
        If (ExtendedDebug) Then
          DoomDebug('Ladder color: '+IntToStr(LadderColor));
        If (FindColorSpiralTolerance(x, y, LadderColor, iX - 50, iY - 50, iX + 50, iY + 50, 5))Then
        Begin
          Mouse(x-10, y-15, 0, 0, True);
          Wait(5000+Random(2500));
          Flag;
        End;
      End;

    End;

    Procedure WalkToWall;
    Var
      WallDTM : LongInt;
    Begin
      WallDTM := DTMFromString('78DA632C626260E86200032608C5B0716D2F8' +
           '332906604E2FF40C0580194A966400115A5F10C22503520C0580F' +
           '543313554D6A5C2CAA9A0CA09A46FCE60000DC2D0E01');
      If (FindDTM(WallDTM, x, y, MMX1, MMY1, MMX2, MMY2))Then
      Begin
        Mouse(x, y + 10, 4, 4, True);
        Flag;
      End;
    End;

    Procedure WalkToWaterAlter;
    Var
     RadialWalkingWorking : Boolean;
     i,rx,ry : LongInt;
    Begin
      If (RadialRoadWalk(FindFallyRoadColor, 201, 185, 70, -2, 2)) Then
      Begin
        For i:= 0 to 100 Do
        Begin
          Wait(100);
          If FlagPresent Then
          Break;
        End;
        Flag;
        RadialWalkingWorking := True;
        If (ExtendedDebug) Then
          DoomDebug('Using RRW..');
      End;

      If Not(RadialWalkingWorking) Then
      Begin
        AutoColorLadder;
        If (ExtendedDebug) Then
          DoomDebug('Using ladder color..');
      End;

      RadialWalkingWorking := False;
      If(RadialRoadWalk(FindFallyRoadColor, 184, 165, 58, 2, -2))Then
      Begin
        RadialWalkingWorking:= True;
        If (ExtendedDebug) Then
          DoomDebug('Using RRW..');
      End;

      If Not(RadialWalkingWorking) OR Not(FindSymbolIn(rx, ry, 'tree', MMX1, (MMY1 - MMX1/2), MMX2, (MMY2 - MMX2/2)))Then
      Begin
        WalkToWall;
        If (ExtendedDebug) Then
          DoomDebug('Using WalkToWall..');
      End;

    End;





    begin
      SetupSRL;
      LoadSRLTalismanBitmaps;
      LoadDTMBMP;
      SymbolAccuracy := 0.4;
      FindWindowBySize(766, 504);
      Activateclient;

      //Repeat
        NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
        If not(Loggedin)then LoginPlayer;
        Status('Preparing Character');
        PlayerStartTime := GetSystemTime;
        GameTab(4);
        DoomDebug('Calibrating..');
        HighestAngle;
        GetAllLevels;
        MakeCompass('N');
        AutoRetaliate(False);
        If (Random(20) >= 15) Then
          SetRun(True);
        TallyCheck;
        TiaraCheck;

        //Repeat
            GameTab(4);
            WalkToWaterAlter;
        //Until(Loads >= Players[CurrentPlayer].Integers[0]);

        Loads := 0;
        FreeBitmap(NickNameBMP);

        //NextPlayer(LoggedIn);
      //Until(False)
    end.

  6. #6
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    YourSRLSTATSID = ''; // Stats ID.
    YourSRLSTATSPASS = ''; // Stats Pass.

    DUDE! ur passes in there!!


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  7. #7
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    whoops! lol, edit your post please.

  8. #8
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    My post already is edited

    Hmnm.. works fine for me..?

    Successfully compiled
    SRL Compiled in 250 msec
    Current player is not Active...


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  9. #9
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lol, i didnt see that your post was edited..

    Did you run the script and let it get to the south fally wall?

  10. #10
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    I just compiled it- I have no rune crafters.


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  11. #11
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh, well, yea, i know it compiles.. But i get that runtime error when i call FindSymbolIn.. Its pretty strange.. Got any ideas?

    EDIT: I got it working.. Someone can lock this thread..

  12. #12
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    MMX1, (MMY1 - MMX1/2), MMX2, (MMY2 - MMX2/2)

    huh??

  13. #13
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lol, i figured that code would be a little confusing.. It is SUPPOSED to only search the left half of the minimap.. But then i thought about it, and that is probably the DUMBEST way to possibly do that.. And anyway, in my code, my parenthesis are wrong..

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 05-28-2008, 07:01 PM
  2. [Runtime Error]:Canvas does not allow drawing
    By sp00nfu11 in forum OSR Help
    Replies: 3
    Last Post: 03-22-2008, 12:52 PM
  3. Replies: 9
    Last Post: 02-05-2008, 01:36 PM
  4. Replies: 4
    Last Post: 02-02-2008, 10:04 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
  •