Results 1 to 7 of 7

Thread: Need Basic Help

  1. #1
    Join Date
    Apr 2012
    Location
    Florida!
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default Need Basic Help

    I've read a few tutorials, I understand them no problem, but when it comes to actually piecing bits of code together on my own, I get some weird errors.
    Right now I'm trying to make a simple fletching script, for now I just want to make maple shieldbow's , will work on adding the rest of them once I have my skeleton for my script complete. At the moment I've gotten only as far as depositing everything in the inventory on startup, and I recieve an error when I try to compile with my main loop, which isn't making sense to me.

    The script I have so far is at the bottom, but I also need a few simple questions answered:

    1) What is the code for exiting a program/ending the script? For example, in the code below i want to put " if result:=false " then the result would be the script exiting.
    2) What is the code for 6hr relog? Is there a general code for this? ( such as procedure declareplayers )


    Program Stringing;
    {$DEFINE SMART}
    {$i srl/srl.simba}

    //Login at draynor bank

    Procedure DeclarePlayers;
    begin
    HowManyPlayers := 1;
    NumberOfPlayers(HowManyPlayers);
    CurrentPlayer := 0;
    Players[0].Name :='';
    Players[0].Pass :='';
    Players[0].Pin :='';
    Players[0].Nick :='';
    //Players[0].WorldInfo:=[44]; //If You Want A Home World
    Players[0].Active:=True; //Don't Touch
    WORLDSWITCHERENABLED:=False; //Don't Touch
    end;

    Function Clearinv: Boolean;
    Var
    db: string;
    Begin
    if findbank(db)then
    Result := true;
    Wait(RandomRange(100,350));
    depositall;
    end



    begin;
    ActivateClient;
    SetUpSRL;
    DeclarePlayers;
    Clearinv;
    end.

  2. #2
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    To terminate a script, call TerminateScript.
    To exit out of a routine, call Exit.

    The script automatically terminates when the codes in the main program has been executed.

    Simba Code:
    Function ClearInv: Boolean;
    begin
      Result := findbank('db');
      if not Result then
        Exit; //or terminateScript
      Wait(RandomRange(100,350));
      depositall;
    end;

    begin
      //codes
      if not ClearInv then
        TerminateScript;
    end.

  3. #3
    Join Date
    Apr 2012
    Location
    Florida!
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    To terminate a script, call TerminateScript.
    To exit out of a routine, call Exit.

    The script automatically terminates when the codes in the main program has been executed.

    Simba Code:
    Function ClearInv: Boolean;
    begin
      Result := findbank('db');
      if not Result then
        Exit; //or terminateScript
      Wait(RandomRange(100,350));
      depositall;
    end;

    begin
      //codes
      if not ClearInv then
        TerminateScript;
    end.
    Thank you so much!

  4. #4
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by Keasbey View Post
    Thank you so much, for the first part ( where you added " if not result " ) does SRL assume that the result will be true?
    Well SRL itself doesn't do the compiling, but no. He sets Result to the result of FindBank, and if it's not True, then it will Exit the function.

    And just to add some information, at the start of a function, Result is set to False.

  5. #5
    Join Date
    Sep 2012
    Location
    Here.
    Posts
    2,007
    Mentioned
    88 Post(s)
    Quoted
    1014 Post(s)

    Default

    As for your second question relating to the six hour log.
    You will need to add
    Simba Code:
    Smart_FixSpeed := TRUE;
        SRL_SixHourFix := TRUE;
    somewhere in your initialization of the program. That will tell your script to check for Runescape declaring your session has ended at a login attempt. However, for it to reach that point, you will have to tell your client to
    Simba Code:
    loginPlayer;
    at some point in time it is logged out. For example, in one of my scripts I have a generic failure method I wrote and call whenever all my failsafes fail and the script should shutdown. I simply call this:
    Simba Code:
    procedure FailOutOfCode(message: String);
    begin
      If(not (LoggedIn)) then
      begin
        LogInPlayer;
      end else
      begin
        WriteLn(message);
        FreeMyDTMs;
        Logout;
        TerminateScript;
      end;
    end;
    and it verifies first whether it's loggedin, at which point it will login the player (and bypass the six hour fix).

    However, it's also possible to get around the issue in other manners, such as something along the lines of:
    Simba Code:
    repeat
      //do all your normal code runtime stuff
    until(not loginplayer);
    LoginPlayer returns true if currently logged in OR if it was logged out and could log in, and that can also run your six hour fix.

  6. #6
    Join Date
    Apr 2012
    Location
    Florida!
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Thanks so much for the help guys, I have to admit that you guys are helping a lot as I understand more of where things go and how to piece them together now.
    Wrote the code up to the point of withdrawing supplies now :P
    I can honestly see scripting becoming a hobby of mine as I often wonder what to do when I'm not at school/the gym to occupy my time haha.

    Edit: What are the functions/procedures that aren't supposed to be used because they look too robotic?
    Last edited by Keasbey; 02-13-2013 at 07:30 PM.

  7. #7
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by Keasbey View Post
    Thanks so much for the help guys, I have to admit that you guys are helping a lot as I understand more of where things go and how to piece them together now.
    Wrote the code up to the point of withdrawing supplies now :P
    I can honestly see scripting becoming a hobby of mine as I often wonder what to do when I'm not at school/the gym to occupy my time haha.

    Edit: What are the functions/procedures that aren't supposed to be used because they look too robotic?
    Avoid using Movemouse, and clickmouse . instead use MMouse and ClickMouse2 (they are SRL functions)
    Using SRL functions are safe! Just check the function list on the leftside of Simba or includes in C:\Program files\Simba\Includes\SRL\


    And make sure u use before SetupSRL;
    Simba Code:
    Smart_FixSpeed := TRUE;
    SRL_SixHourFix := TRUE;
    SetupSRL;  // This after the six hour fix

    Creds to DannyRS for this wonderful sig!

Thread Information

Users Browsing this Thread

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

Posting Permissions

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