Results 1 to 14 of 14

Thread: Help with Official First Script

  1. #1
    Join Date
    Aug 2006
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help with Official First Script

    Hi-
    Here's my code...so far:
    SCAR Code:
    program New;
    {.Include SRL\SRL.scar}
    {.Include SRL\SRL\core\Login.scar}
    {.Include SRL\SRL\core\Bank.scar}

    var
    result :integer;

    begin
    LoggedIn
    If(result=true) Then
    OpenBank3
    Withdraw(3,1,15)
    CloseBank;
    end.

    I know it's not much, but it's my first time using SRL and I don't really understand it, and I've been creating this script for around 15 minutes. I'd really appreciate it if someone could tell me what I've been doing wrong and what I need to do in the future.

    Thanks
    --
    Wizard Snu

  2. #2
    Join Date
    Oct 2006
    Location
    Arizona
    Posts
    29
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Code:
    program New;
    {.Include SRL\SRL.scar}
    {.Include SRL\SRL\core\Login.scar}
    {.Include SRL\SRL\core\Bank.scar}
     
    var
    result :integer;
     
    begin
    LoggedIn
    If(result=true) Then
    OpenBank3
    Withdraw(3,1,15)
    CloseBank;
    end.
    Well I haven't used SRL at all yet but I'm guessing LoggedIn is a function that checks if you are logged in. So just putting LoggedIn on it's own line will do nothing except check if you are logged in and result true. So instead of:
    Code:
    LoggedIn
    If(result=true)Then
    You would want to put
    Code:
    If(LoggedIn)Then
    I didn't even have to put if(LoggedIn = true)then because in an if statement it will automatically check if it is true, if you wanted to check if it was false then you would have to put if(LoggedIn=false)then.

    Also you have result declared as an integer. An integer is any negative or positive whole number, &or 0. You wanted to see if result was True in your if statement and that would mean it would have to be a declared as a boolean. However in this script you would not have to declare anything.

    Code:
    If(result=true) Then
    OpenBank3
    Withdraw(3,1,15)
    CloseBank;
    Aside from your if statement being wrong, right now, it will do OpenBank3 if the if statement is true. Withdraw and CloseBank it will do regardless of whether the if statement is true or not. You would want to code it like this:
    Code:
    If(LoggedIn)Then
    begin
     OpenBank3;
     Withdraw(3,1,15);
     CloseBank;
    end;
    By enclosing your bank process in a begin and end it's saying if loggedin, then, and it sees everything in the being to end instead of just the OpenBank.

    Also notice how the end has a semi-colon after it, all ends have semi-colons after them except for the main routine statement of your script, the very last begin-end statement of the script which is the one that executes will have an end with a period after it to mark the end of the script.

    Finally it should look like this if I've got everything correct:
    Code:
    program New;
    {.Include SRL\SRL.scar}
    {.Include SRL\SRL\core\Login.scar}
    {.Include SRL\SRL\core\Bank.scar}
     
    begin
    If (loggedin) Then
    begin
     OpenBank3;
     Withdraw(3,1,15);
     CloseBank;
    end;
    end.

  3. #3
    Join Date
    Feb 2006
    Posts
    406
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Login.scar and Bank.scar
    are included when your put
    {.Include SRL\SRL.scar}

  4. #4
    Join Date
    Aug 2006
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You are the best! Thanks for the help.
    I'll probably have a lot more question !

    Thanks Again
    --
    Snu Woods

    edit: Do I have to put "result :boolean;" then?

  5. #5
    Join Date
    Aug 2006
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Here's my script now:
    SCAR Code:
    program New;
    {.Include SRL\SRL.scar}


    begin
    activateclient
    wait(random(30)+350);
    If(LoggedIn) Then
    begin
    OpenBank3
    DepositALL
    Withdraw(3,1,15)
    CloseBank;
    end;
    end.



    But, I get this error:
    SCAR Code:
    [Runtime Error] : Exception: Access violation at address 006549BC in module 'scar.exe'. Read of address 00000000 in line 38 in script C:\Program Files\SCAR 2.03\includes\srl\srl\core\Bank.scar

    Thanks
    --
    Snu Woods

  6. #6
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Call SetupSRL; Once



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  7. #7
    Join Date
    Oct 2006
    Location
    Ohio
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Um did you read the error?

    Your missing your includes I think...

    Quote Originally Posted by snu_woods
    SCAR Code:
    program New;
    {.Include SRL\SRL.scar}
    Like your first script it'll need to be
    SCAR Code:
    program New;
    {.Include SRL\SRL.scar}
    {.Include SRL\SRL\core\Login.scar}
    {.Include SRL\SRL\core\Bank.scar}

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

    Default

    I thought core files are inlcuded with {.Include SRL\SRL.scar}. It's everything else like misc that you have to put after.

  9. #9
    Join Date
    Jun 2006
    Posts
    366
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I had tht same problem in my script... but it went away when i called SetupSRL;

    also ppl please help me wid my trouble in the other topic named air rune crafter

  10. #10
    Join Date
    Oct 2006
    Posts
    412
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Wizzup? is correct. To use the functions and precdures in the include, you need to call to it so it knows that it needs to be used. I dont know the answer to the access violation though.

  11. #11
    Join Date
    Feb 2006
    Location
    Myrtle Beach, SC USA!
    Posts
    841
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by IronTeapot View Post
    Wizzup? is correct. To use the functions and precdures in the include, you need to call to it so it knows that it needs to be used. I dont know the answer to the access violation though.
    The access violation is because your using a variable for a bitmap, dtm, etc, etc without ever setting it. Thats why you have to call SetupSRL to initalize all the variables, dtm's, bitmaps, arrays, etc, etc...

    And by including SRL.Scar you do not need to include any other core includes IE : Login, Bank, Color, etc, etc because inside of SRL.Scar it includes all of them...

  12. #12
    Join Date
    Aug 2006
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hi-
    Been busy lately....
    this my seem n00bey, but what does calling mean?...{.include.....}?

    Thank
    --
    Snu Woods

  13. #13
    Join Date
    Jul 2006
    Location
    NY
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by snu_woods View Post
    Hi-
    Been busy lately....
    this my seem n00bey, but what does calling mean?...{.include.....}?

    Thank
    --
    Snu Woods
    Calling basically means to add something into your coding or to place a procedure in your coding/script. And include contains alot of procedures that can be placed into your coding to make it easier for you. For example instead of making a whole procedure you can just "Call" the procedure like this
    SCAR Code:
    Loginplayer; //This will login your player from login screen
    Login player is already a procedure in your include so you will be able to just call/place it into your script instead of creating a whole procedure for it.
    Hope this helps
    ~jR

  14. #14
    Join Date
    Aug 2006
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks...hopefully I'll be able to get this script out within the month

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. SCAR Script Official Standards
    By Bam Bam in forum Outdated Tutorials
    Replies: 62
    Last Post: 04-21-2010, 11:28 PM
  2. Its official
    By kingarabian in forum RuneScape News and General
    Replies: 27
    Last Post: 03-05-2008, 01:22 AM
  3. 'Official' SRL IRC Chat here!
    By Harry in forum News and General
    Replies: 44
    Last Post: 10-08-2007, 02:28 AM
  4. Official NFL Talk
    By IEatJ00erBaybees in forum Discussions & Debates
    Replies: 13
    Last Post: 09-28-2007, 10:41 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
  •