Results 1 to 8 of 8

Thread: function problem

  1. #1
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default function problem

    I have some sort of problem with the function "CastSpell(35)". It says that its an unkown identifier but I didn't think you would need to identify it.

    Script below:

    SCAR Code:
    Program AutoAlcher;
    {.include SRL/SRL.scar}

    Var
      AlchesDone, x,y :integer;

    Const
      NumberOfAlches = 10; //How many alches you want to do
      Magelvl = '1'; //Type your mage lvl in for auto-respond

    Procedure DeclarePlayers;
    Begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';//Your runescape username
      Players[0].Pass := '';//Your runescape password
      Players[0].Nick := '';//3 letter of your runescape username
      Players[0].Active := True;
    End;

    Var
    DTM: integer;

    Procedure DeclareDTM;
    Begin
         DTM := DTMFromString('78DA637CCDC4C0A0C9C80002CC0C10F0FF3F0' +
           '3831C906604B3FFFF677C03546388AA26292A0AAE060418DF03D5' +
           'E8A3AA99D6C88BAAE62B508D2EAA9A4513D351D57C04AA3140550' +
           '3924551F301D3AE0DD3F951D40000D0AA12BB');

    End;

    Procedure ClickHighAlch;
      Begin
        if CastSpell(35) then
          Begin
            WriteLN('Click High Alch');
            WriteLN('Clicking Yew Long');
          End;
            if not CastSpell(35) then
              Begin
                WriteLN('Cant cast High Alch');
                WriteLN('Make sure you have anough runes');
              End;
    End;

    Procedure ClickYewLong;
      Begin
      if(FindDTM(DTM,x,y,1,1,799,600))then
            Begin
              Mouse(x,y,2,2,true);
            End;
              Wait(800 + random(150))
              if not(FindDTM(DTM,x,y,1,1,767,503)) then
                Begin
                  WriteLN('Couldnt find any yew longs');
                  WriteLN('Logging out and terminating script');
                  Logout;
                  TerminateScript;
                  End;
    End;

    Procedure Alch;
      Begin
        Gametab(7);
          Repeat
            ClickHighAlch;
            Wait(500 + random(300))
            ClickYewLong;
            Wait(1900 + random(300))
          Until (AlchesDone >= NumberOfAlches);
        AlchesDone := AlchesDone + 1
      End;



    Function InChatLine(myString: string): Boolean;
      Begin
        Result := ( pos(myString, TheLine) <> 0 );
      End;

                                           
    Function ChatBack: Boolean; // By Lorax(SL Scripts)
    Begin
      SaveToChatLog;

      if ( OldLine = TheLine ) or ( pos(Players[CurrentPlayer].Nick, TheName) <> 0 ) then
        Exit;

      if InChatLine(Players[CurrentPlayer].Nick) then
      Begin
        Wait(1000 + Random(500));
        case Random(6) of
          0: TypeSend('hello');
          1: TypeSend('hi');
          2: TypeSend('hey');
          3: TypeSend('hey you');
          4: TypeSend('yo');
          5: TypeSend('sup?');
        End;

        Result := True;
        Exit;
      End;

      if ( InChatLine('mage') or InChatLine('magic') or InChatLine('age') ) and
         ( InChatLine('lv') or InChatLine('leve') ) then
      Begin
        Wait(1000 + Random(500));
        case Random(2) of
          0: TypeSend ('im '+(magelvl)+'');
          1: Typesend ('me,'+(magelvl)+'.');
      End;

        Result := True;
        Exit;
      End;

      if InChatLine('hi ') or InChatLine('ello') or InChatLine('sup') or
         InChatLine('whats up') then
      Begin
        Wait(1000 + Random(500));
        case Random(4) of
          0: TypeSend('hello');
          1: TypeSend('hey');
          2: TypeSend('hey there');
          3: TypeSend('hi');
      End;

        Result := True;
        Exit;
      End;

      if InChatLine('lol') or InChatLine('hehe') or InChatLine('hihi') or
         InChatLine('haha') then
      Begin
        Wait(1000 + Random(500));
        case Random(4) of
          0: TypeSend('...');
          1: TypeSend('lool');
          2: TypeSend('rofl');
      End;

        Result := True;
        Exit;
      End;

        Result := True;
        Exit;
      End;

    Procedure ProgressReport;
     Begin
      ClearDebug
      WriteLn('<<<<<<<<<<<<Auto Alcher v1.0>>>>>>>>>>>>');
      WriteLn('Alched for ' + TimeRunning + ' ');
      WriteLn('Did ' + IntToStr(AlchesDone) + ' High Alches ');
      WriteLn('Earnt ' + IntToStr(AlchesDone * 65) + ' XP');
      WriteLn('<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>');
      WriteLn(' ');
      WriteLN('Please post progress reports on thread')
      WriteLn(' ')
      Wait(2000 + random(200))
    End;

    Procedure AntiRandoms;
     Begin
      ChatBack;
      FindNormalRandoms;
      FindTalk;
     End;

    Procedure Prepare;
    Begin
     SetupSRL;
     ClearDebug;
     DeclareBMPs;
     ActivateClient;
     Wait(10);
     DeclarePlayers;
     Wait(10);
     LoginPlayer;
     Wait(10);
     SRLRandomsReport;
     GameTab(7);
    End;

    Begin
      Prepare;
        Repeat
          if (Not(LoggedIn)) then
          Exit;
          Alch;
          AntiRandoms;
          ProgressReport;
            Until (AlchesDone >= NumberOfAlches);
            If (AlchesDone >= NumberOfAlches) then
              Logout;
              ProgressReport;
              FreeDTM(DTM);
    End.

    All help very apreciated

  2. #2
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Just add:
    SCAR Code:
    {.include srl/srl/skill/magic.scar}
    At the beginning of your script

    This is because
    SCAR Code:
    CastSpell(Whatspell:integer)
    Is in skill magic.
    That is why SRL is split up into different sections.
    srl/srl.scar only includes The Core folder. which has function like 'Mouse' and 'MMouse'

    Good Luck

    EDIT:
    Your click Yew Long procedure is un-reliable
    What it should be like:
    SCAR Code:
    Procedure ClickYewLong;
      Begin
      if(FindDTM(DTM,x,y,MIX1,MIY1,MIX2,MIY2))then
            Begin
              Mouse(x,y,2,2,true);
            End;
              Wait(800 + random(150))
              if not(FindDTM(DTM,x,y,MIX1,MIY1,MIX2,MIY2)) then
                Begin
                  WriteLN('Couldnt find any yew longs');
                  WriteLN('Logging out and terminating script');
                  Logout;
                  TerminateScript;
                End;
      End;

    Scar stores the co-ords of:

    MIY=Inventory
    MSX=MainScreen
    MSC=Chatbox
    MMX= MiniMap

    Just like Sin Cos and Tan in your calculator

  3. #3
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    and i think (un-confirmed) that it should have '' between. the numbers.

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  4. #4
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Thanks both of you, I'll add your msn now as I'm still having trouble with learning SCAR, dw i wont bug you too much

    Anyway thanks again and I very apreciate you going out of your way to help others

  5. #5
    Join Date
    Feb 2007
    Location
    Estonia.
    Posts
    1,938
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    You must add->
    {.include SRL/SRL/skill/Magic.scar}
    to the beginning near the include srl/srl.scar
    Eerik.

  6. #6
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Lol he knows

  7. #7
    Join Date
    Feb 2007
    Location
    Estonia.
    Posts
    1,938
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by NaumanAkhlaq View Post
    Lol he knows
    Oops, i opened the window before, and didn't saw u posting. I apologise.
    Eerik.

  8. #8
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Weel, when you think about it, you would have helped if Naum didn't get there first :P

    so thanks

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 06-11-2008, 07:28 AM
  2. problem with dropexcept function
    By orion pax in forum OSR Help
    Replies: 1
    Last Post: 10-15-2007, 11:46 PM
  3. Inchat Function Problem
    By Granti in forum OSR Help
    Replies: 21
    Last Post: 06-29-2007, 04:01 AM
  4. Function problem
    By NinjaTerrorist in forum OSR Help
    Replies: 4
    Last Post: 02-16-2007, 11:15 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
  •