Results 1 to 18 of 18

Thread: how do i make a procedure true

  1. #1
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default how do i make a procedure true

    Well my question is how do i make a procedure true so that i can put it in a until(....)?

    Like a fisher
    repeat
    the fishing part
    etc
    until(there is no fish in the inventory)
    ^^^^^^^^^^^^^^^^^^^^^^^
    How do i do this?

    I was thinking about

    procedure NoFish;
    begin
    if(not((FindBitmapin(Sardine,x,y,MIX1,MIY1,MIX2,MI Y2)))or
    (FindBitmapin(Herring,x,y,MIX1,MIY1,MIX2,MIY2)))or
    (FindBitmapin(Pike,x,y,MIX1,MIY1,MIX2,MIY2))or
    (FindBitmapin(Trout,x,y,MIX1,MIY1,MIX2,MIY2))or
    (FindBitmapin(Salmon,x,y,MIX1,MIY1,MIX2,MIY2))then
    exit;//>>i wanted to put here 'Result:= True' but he don't knows what it means
    end;

    and then in the loop
    until(NoFish = True)>but that's failure, an error
    So can someone help me plz?

  2. #2
    Join Date
    Jun 2006
    Location
    USA
    Posts
    1,828
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    See this example of Functions:

    SCAR Code:
    Function HowMuch:integer; //Function HowMuch, returns as a number
    begin
    Result:=5+random(6) //Function HowMuch is value 5 + random number 6 (from 0 to 5)
    Writeln(inttostr(Result)) //Writes how much 5 + random 6 is
    end;

    Function IsTen:Boolean; //Function IsTen, returns True if HowMuch is 10
    begin
    if(HowMuch=10)then
    Result:=True;  //If value of HowMuch is 10 then Function IsTen is True
    end;

    begin
    cleardebug;
    if(IsTen)then  //If IsTen is true (Howmuch=10)then it writes the text
    writeln('it is 10')
    end.
    Hope this helps you...

  3. #3
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks pentti gonna test it out

  4. #4
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Line 11: [Error] (17942:1): Duplicate identifier 'Result' in script
    ...
    procedure NoFish;
    begin
    if(not((FindBitmapin(Sardine,x,y,MIX1,MIY1,MIX2,MI Y2)))or
    not(FindBitmapin(Herring,x,y,MIX1,MIY1,MIX2,MIY2)) )or
    not(FindBitmapin(Pike,x,y,MIX1,MIY1,MIX2,MIY2))or
    not(FindBitmapin(Trout,x,y,MIX1,MIY1,MIX2,MIY2))or
    not(FindBitmapin(Salmon,x,y,MIX1,MIY1,MIX2,MIY2))t hen
    Result:=True
    end;
    then
    bla
    bla
    bla
    until(NoFish = True)
    andi get this error
    Line 11: [Error] (17942:1): Duplicate identifier 'Result' in script

    plz help

  5. #5
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Line 11: [Error] (17942:1): Duplicate identifier 'Result' in script
    ...
    procedure NoFish;
    begin
    if(not((FindBitmapin(Sardine,x,y,MIX1,MIY1,MIX2,MI Y2)))or
    not(FindBitmapin(Herring,x,y,MIX1,MIY1,MIX2,MIY2)) )or
    not(FindBitmapin(Pike,x,y,MIX1,MIY1,MIX2,MIY2))or
    not(FindBitmapin(Trout,x,y,MIX1,MIY1,MIX2,MIY2))or
    not(FindBitmapin(Salmon,x,y,MIX1,MIY1,MIX2,MIY2))t hen
    Result:=True//>>> failure
    end;
    bla
    bla
    bla
    until(NoFish = True)>>>failure, error

    Line 11: [Error] (17942:1): Duplicate identifier 'Result' in script

  6. #6
    Join Date
    Jun 2006
    Location
    USA
    Posts
    1,828
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Hmm... If you put Result as a variable into your script
    SCAR Code:
    Var result:Boolean;
    , delete it from variables...

    only thing in your script that you had to edit was your procedure NoFish; To this:
    SCAR Code:
    Function NoFish:Boolean;
    begin
    if(not((FindBitmapin(Sardine,x,y,MIX1,MIY1,MIX2,MI Y2)))and
    not(FindBitmapin(Herring,x,y,MIX1,MIY1,MIX2,MIY2)) )and
    not(FindBitmapin(Pike,x,y,MIX1,MIY1,MIX2,MIY2))and
    not(FindBitmapin(Trout,x,y,MIX1,MIY1,MIX2,MIY2))and
    not(FindBitmapin(Salmon,x,y,MIX1,MIY1,MIX2,MIY2))then
    Result:=True
     else
    Result:=False;
    end;

  7. #7
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    yea sorry, i'm very frustrated now and also sorry for the double post (pc = slow)atm

  8. #8
    Join Date
    Jun 2006
    Location
    USA
    Posts
    1,828
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by the scar noob View Post
    yea sorry, i'm very frustrated now and also sorry for the double post (pc = slow)atm
    alright, Did you get it work?

  9. #9
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    what i've got to do then?
    Line 11: [Error] (17942:1): Duplicate identifier 'result' in script
    because of the var

  10. #10
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    Procedures cant return values, so you cant use Result:=.... This will generate an Error.
    Functions can return values. If unset, it will always return False, as everything in Delphi always return 0 or False unless a value is set.
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  11. #11
    Join Date
    Jun 2006
    Location
    USA
    Posts
    1,828
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by the scar noob View Post
    what i've got to do then?
    Line 11: [Error] (17942:1): Duplicate identifier 'result' in script
    because of the var
    Do you have something like this in your script:
    SCAR Code:
    Program Name;
    var Result:Boolean;
    ?
    If is, delete var Result:Boolean; from there.

  12. #12
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    you can have procedures return a value in there vars, isnt it, or is that functions only too

    like you have procedure bla(var x, y : integer, and some things you have to fill in) or something like that ^^
    Infractions, reputation, reflection, the dark side of scripting, they are.

  13. #13
    Join Date
    Jun 2006
    Location
    USA
    Posts
    1,828
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by iloveit8 View Post
    you can have procedures return a value in there vars, isnt it, or is that functions only too

    like you have procedure bla(var x, y : integer, and some things you have to fill in) or something like that ^^
    You have to set values on these by yourself...

    Yea, but theres some procedures like this:
    SCAR Code:
    program New;
    var x,y:Integer;
    begin
    getmousepos(x,y)
    writeln('('+inttostr(x)+','+inttostr(y)+')')
    end.

    SCAR Code:
    program New;
    var x,y:Integer;
    begin
    GetClientDimensions(x,y)
    writeln('('+inttostr(x)+','+inttostr(y)+')')
    end.

  14. #14
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks fakawi and all other people who posted and trying to help me, but i still can't difure out the problem, if i make it a function = error
    if i put Result as var and as boolean = duplicate identifier
    i just don't get fixed
    i think i throw out the cooker procedure out of my script

  15. #15
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    i think i made it!
    var Resultt:Boolean (why? because when i use just 'Result' it says: 'Duplicated indentifier'
    and then:
    function NoFish:boolean;
    begin
    if(not((FindBitmapin(Sardine,x,y,MIX1,MIY1,MIX2,MI Y2)))or
    not(FindBitmapin(Herring,x,y,MIX1,MIY1,MIX2,MIY2)) )or
    not(FindBitmapin(Pike,x,y,MIX1,MIY1,MIX2,MIY2))or
    not(FindBitmapin(Trout,x,y,MIX1,MIY1,MIX2,MIY2))or
    not(FindBitmapin(Salmon,x,y,MIX1,MIY1,MIX2,MIY2))t hen
    Resultt:=True
    end;


    then in the cooking procedure:
    bla
    bla
    bla
    until(NoFish = True)

  16. #16
    Join Date
    Jun 2006
    Location
    USA
    Posts
    1,828
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by the scar noob View Post
    i think i made it!
    var Resultt:Boolean (why? because when i use just 'Result' it says: 'Duplicated indentifier'
    and then:
    function NoFish:boolean;
    begin
    if(not((FindBitmapin(Sardine,x,y,MIX1,MIY1,MIX2,MI Y2)))or
    not(FindBitmapin(Herring,x,y,MIX1,MIY1,MIX2,MIY2)) )or
    not(FindBitmapin(Pike,x,y,MIX1,MIY1,MIX2,MIY2))or
    not(FindBitmapin(Trout,x,y,MIX1,MIY1,MIX2,MIY2))or
    not(FindBitmapin(Salmon,x,y,MIX1,MIY1,MIX2,MIY2))t hen
    Resultt:=True
    end;


    then in the cooking procedure:
    bla
    bla
    bla
    until(NoFish = True)
    Your ResulTT wont work, you need to have Result, and you must NOT put it on variables.

  17. #17
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    but when i use Result and even when i don't put it as a var, it says duplicate identifier...

    EDIT: nvm it works now thanks to pentti, fakawi and all other people who posted and tried to help me! thanks for helping me when i was stuck!!!

  18. #18
    Join Date
    Jun 2006
    Location
    USA
    Posts
    1,828
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    No problems man.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. !Not AND =True?
    By Enchanted in forum OSR Help
    Replies: 1
    Last Post: 10-23-2008, 08:30 PM
  2. True or Not?
    By faster789 in forum OSR Help
    Replies: 8
    Last Post: 03-31-2008, 10:49 PM
  3. Make players True while running?
    By Mjordan in forum News and General
    Replies: 6
    Last Post: 03-22-2007, 01:19 AM
  4. make a procedure and run it
    By wasknijper in forum OSR Help
    Replies: 4
    Last Post: 02-01-2007, 04:22 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
  •