Results 1 to 2 of 2

Thread: Error in tutorial island script

  1. #1
    Join Date
    Jun 2006
    Posts
    250
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Error in tutorial island script

    This is my code so far:
    Code:
    program juniorstutorialisland;
    {.include SRL\SRL.scar}
    //scarrage1
    
    var
    randomvar1: integer;
    accepta,yellowarrow,yellowmmarrow: integer; //Bitmap variables
    
    procedure openbag;
    begin
    mouse(650,185,2,2,true)
    end;
    
    
    procedure setupbitmaps;
    begin
    Accepta := BitmapFromString(6, 5, 'z78DA33304006CE48242670C62B824B' +
           '17312663AAC147020038F622CB');
    yellowarrow := BitmapFromString(21, 10, 'z78DA737376733475751B20D2000C' +
           '06C85E4303043004899B38D39AC4B0D700C50D4E6E96C696B420F' +
           '1DA4B4337106D2FAA1B1CDDCC8D8C2821C9B2970A6EA0D85E32DD' +
           '40557B497003CDEC25E006F2EC0500066B16B4');
    yellowmmarrow := BitmapFromString(11, 6, 'z78DA73737673347173A3803400014' +
           '33727374B63135249885E030430747374333774248634C0070C89' +
           'D06B684004A0442FA67BF0EB0500F12D56F5');
    end;
    
    procedure chooseclothes;
    begin
    randomvar1 := 3+random(4)
    repeat
    begin
    randomvar1 := randomvar1 -1
    if(random(3)) = 1 then
    mouse(56,90,3,3,true)
    wait(random(500))
    if(random(3)) = 1 then
    mouse(53,122,3,3,true)
    wait(random(500))
    if(random(3)) = 1 then
    mouse(56,158,3,3,true)
    wait(random(500))
    if(random(3)) = 1 then
    mouse(56,197,3,3,true)
    wait(random(500))
    if(random(3)) = 1 then
    mouse(56,229,3,3,true)
    wait(random(500))
    if(random(3)) = 1 then
    mouse(56,263,3,3,true)
    wait(random(500))
    if(random(3)) = 1 then
    mouse(56,298,3,3,true)
    wait(random(500))
    if(random(3)) = 1 then
    mouse(357,98,3,3,true)
    wait(random(500))
    if(random(3)) = 1 then
    mouse(357,132,3,3,true)
    wait(random(500))
    if(random(3)) = 1 then
    mouse(357,166,3,3,true)
    wait(random(500))
    if(random(3)) = 1 then
    mouse(357,200,3,3,true)
    wait(random(500))
    end;
    until(randomvar1 = 0)
    if(random(2))=1 then
    mouse(454,281,20,20,true)
    findbitmapspiraltolerance(Accepta,x,y,236,274,250,289,10)
    mmouse(x,y,0,0)
    wait(20+random(100))
    clickmouse(x,y,true)
    writeln('Clothes chosen')
    end;
    
    
    procedure talktostart;
    begin
    HighestAngle
    repeat //until we're talking to the guy
    begin
    repeat //waiting until we see the yellow arrow
    wait(100+random(200))
    until(findbitmapspiraltolerance(yellowarrow,x,y,4,3,516,336,20))=true
    MMouse(x+10,y+30,2,2)
    wait(20+random(20))
    clickmouse(x+10,y+30,true)
    wait(1000+random(300))
    flag;
    end; //end repeat until we talk to the guy
    until(findcolorspiraltolerance(x,y,594842,30,358,81,376,20)) //we see red meaning we're talking to the guy
    repeat
    mouse(300,447,3,3,true)
    wait(1500+(1000))
    until(findcolorspiraltolerance(x,y,594842,30,358,81,376,20))= false
    end;
    
    
    procedure opendoor;
    begin
    repeat //waiting until we see the yellow arrow
    wait(100+random(200))
    until(findbitmapspiraltolerance(yellowarrow,x,y,4,3,516,336,20))=true
    MMouse(x+10,y+22,2,2)
    MMouse(x+10,y+15,2,2)
    wait(20+random(20))
    clickmouse(x+10,y+30,true)
    wait(1000+random(300))
    flag;
    end;
    
    
    
    procedure fishing;
    begin
    repeat //until we're talking to the fishing guy
    begin
    repeat //waiting until we see the yellow arrow
    wait(100+random(200))
    until(findbitmapspiraltolerance(yellowmmarrow,x,y,622,98,686,136,20))=true
    MMouse(x,y,2,2)
    wait(20+random(20))
    clickmouse(x,y,true)
    wait(1000+random(300))
    flag;
    repeat //waiting until we see the yellow arrow above the guy
    wait(100+random(200))
    until(findbitmapspiraltolerance(yellowarrow,x,y,4,3,516,336,20))=true
    MMouse(x+10,y+30,2,2)
    wait(20+random(20))
    clickmouse(x+10,y+30,true)
    wait(1000+random(300))
    flag;
    until(findcolorspiraltolerance(x,y,16711680,188,410,430,459,20)=true) //we see dark red meaning we're talking to the guy
    mmouse(300,447,3,3)
    wait(100+random(1000))
    clickmouse(300,447,true)
    wait(100+random(1000))
    clickmouse(300,447,true)  //talking to the guy
    wait(2000+random(100))
    mouse(645,186,3,3,true)   //opening invent
    wait(100+random(1000))
    repeat //waiting until we see the yellow arrow above the tree
    wait(100+random(200))
    until(findbitmapspiraltolerance(yellowarrow,x,y,4,3,516,336,20))=true
    repeat
    mouse(x+3,y+3,2,2,true) //click on the tree
    wait(2000+random(300))
    flag;
    until(findcolorspiraltolerance(x,y,5276075,562,208,737,284,10))
    mouse(300,447,2,2,true)  //accepting the logs
    wait(2000+random(500))
    if(findcolorspiraltolerance(x,y,10066342,147,45,861,320,20)) then //if you have the tinter box
    begin
    mouse(x,y,2,2,true)
    wait(50+random(100))
    mouse(670,230,2,2,true)
    wait(2000+random(100)) //user tinter with logs
    mouse(585,181,2,2,true) //click on skills tab
    end;
    repeat //waiting until we see the yellow arrow above the guy
    wait(100+random(200))
    until(findbitmapspiraltolerance(yellowarrow,x,y,4,3,516,336,20))=true
    MMouse(x+10,y+30,2,2)
    wait(20+random(20))
    clickmouse(x+10,y+30,true)
    wait(1000+random(300))
    flag;
    end; //end repeat until we talk to the guy
    until(findcolorspiraltolerance(x,y,16711680,188,410,430,459,20)) //we see dark red meaning we're talking to the guy
    mmouse(300,447,3,3)
    wait(100+random(1000))
    clickmouse(300,447,true)
    wait(100+random(1000))
    clickmouse(300,447,true)  //talking to the guy
    end;
    repeat //waiting until we see the yellow arrow above the water
    wait(100+random(200))
    until(findbitmapspiraltolerance(yellowarrow,x,y,4,3,516,336,20))=true
    MMouse(x+10,y+30,2,2)
    wait(20+random(20))
    clickmouse(x+10,y+30,true)
    wait(1000+random(300))
    flag;
    openbag
    end; //end repeat until we fish
    until(findcolorspiraltolerance(x,y,5600690,561,209,734,454,50)) //we see shrimp in the invent
    begin
    
    repeat //repeat fishing
    begin
    if(findcolorspiraltolerance(x,y,5600690,561,209,734,454,50))=false then //if we dont have shrimp
    begin
    if(findcolorspiraltolerance(x,y,15116424,10,3,514,333,50))true then  //look for fishing spot
    begin
    mouse(x,y,2,2,true)
    wait(2000+random(200))
    flag;
    end;
    end;
    end;
    until(findcolorspiraltolerance(x,y,5600690,561,209,734,454,50)) //we see shrimp in the invent
    
    findcolorspiraltolerance(x,y,3184841,44,29,500,280,50) //find a fire
    mouse(708,230,2,2,true) //click on the shrimp
    wait(10+random(20))
    mouse(x,y,2,2,true)
    wait(1+random(2))
    mouse(x,y,2,2,true)  //click back on the fire
    if(findcolorspiraltolerance(x,y,747950,807,195,851,230,35)=false then //if the shrimp is burned
    begin
    mouse(x,y,2,2,false)
    wait(10+random(20))
    mouse(x,y+44,2,2,true)   //drop it if its burned
    end;
    end;
    until(findcolorspiraltolerance(x,y,748465,561,209,734,454)  //until we have cooked shrimp
    end;
    
    
    procedure opengate;
    begin
    repeat //waiting until we see the yellow minimap arrow
    wait(100+random(200))
    until(findbitmapspiraltolerance(yellowmmarrow,x,y,622,98,686,136,20))=true
    MMouse(x,y,2,2)
    wait(20+random(20))
    clickmouse(x,y,true)
    wait(1000+random(300))
    flag;
    repeat //waiting until we see the yellow arrow
    wait(100+random(200))
    until(findbitmapspiraltolerance(yellowarrow,x,y,4,3,516,336,20))=true
    Mouse(x+10,y+22,2,2)
    Mouse(x+8,y+15,2,2)
    Mouse(x+8,y+10,2,2)
    wait(1000+random(300))
    flag;
    end;
    
    
    begin
    activateclient
    setupbitmaps
    //chooseclothes
    //talktostart
    //opendoor
    //fishing
    //opengate
    opendoor
    end.
    but I keep getting this error:
    Failed when compiling
    Line 136: [Error] (14126:1): Identifier expected in script C:\Program Files\programs\rs\auto\SCAR 2.03\Scripts\mine\tutisland1.scar
    Whats wrong?

  2. #2
    Join Date
    Apr 2006
    Location
    Melbourne
    Posts
    186
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default very messy!

    Ok, I looked into your code, while some parts are ok, there are a large amount of errors you will have to fix... none of the below is trying to be harsh, but you will need to get a lot neater. If it is just because of the tags you used on this forum that you have lost your structure... then use the PHP tags instead like I have.

    I don't mind helping coding problems, but I'm not going to spend my time just tidying up someone's chaotic code.
    I've included a small sample below of how to neaten your code up. If you do neaten it up and still have some problems I'll help you some more.

    One Tip... you need to especially watch your "begin" and "end". I started structuring your code but there was dangling unfinished segments everywhere. For everything you have used in your fishing procedure there is no reason why every "begin" should not have an "end" associated with it.

    You also don't terminate everything. Every procedure called in normal code should have the ' ; ' after it... a small example from your code that was structured better. instead of =false.... you can write 'if not' instead.
    PHP Code:
    repeat //repeat fishing
          
    begin
            
    if(findcolorspiraltolerance(x,y,5600690,561,209,734,454,50))=false then //if we dont have shrimp
              
    begin                            // no '=' on the following and you don't need 'true' anyway
                
    if(findcolorspiraltolerance(x,y,15116424,10,3,514,333,50))true then  //look for fishing spot
                  
    begin
                  mouse
    (x,y,2,2,true)   // where is ' ; '
                  
    wait(2000+random(200))
                  
    flag;
                  
    end;
              
    end;
          
    end;
        
    until(findcolorspiraltolerance(x,y,5600690,561,209,734,454,50)) //we see shrimp in the invent 
    PHP Code:
    Procedure YourFishingProcedure;
    begin
      repeat
        begin 
    //try to nest your code like this so you can see what you are doing.
          
    Mouse(SomeX,SomeY,RandomX,RandomY,True);
          
    Wait(1000);
          
    DoSomeMoreStuff;
        
    end// every 'begin' usually has an 'end' yours are random everywhere.
      
    until ConditionIsMet //most of the color functions already return true... so you don't need to specify =true
      
      
    if ThisIsTrue then
        begin  
    // If statements must have begin and end if you are performing multiple lines of
               // instruction within the statement.
          
    CodeHere;
          
    MoreCodehere;
        
    end;
    end;

    // you can easily identify the individual loops and structures within the code with some formating. 

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Tutorial Island Script
    By chemistryal in forum RS3 Outdated / Broken Scripts
    Replies: 7
    Last Post: 03-22-2007, 05:17 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
  •