Results 1 to 17 of 17

Thread: array to function

  1. #1
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default array to function

    heey

    i need a little help with my function.
    i am maken a bejeweled solver, but i need to give the array to a function, but i don't know how i can give the whole array at once.
    so, maybe that one of you can help me:P
    We merely play "against the rules". We cheat. Thats what we are good at, thats what we do.
    http://www.frement.net/srl/simba_user4.png

  2. #2
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Could you explain what you mean?

    Do you mean this?

    SCAR Code:
    Function Stuff(ArrayHere : Array Of Integer) : Boolean

    ~Sandstorm

  3. #3
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    no help needed anymore:P
    got help on the irc from Tootoot222
    but thanks anyway
    We merely play "against the rules". We cheat. Thats what we are good at, thats what we do.
    http://www.frement.net/srl/simba_user4.png

  4. #4
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    tootoot222 thought he could help me, he did alot, but i just have to know the last thing, he recommended me to talk with wizzup but he's busy so i am back here.

    i am making a bejeweled solver.
    i have to make a function that gets a array like:
    function zoek(array of array of integer)
    now is my problem, i got 64 diffrent combinations in that array and i need them to be all sent to teh function.
    my question: how can i send a whole array of array to a function.
    hope i explained it well enough now:P

    //edit
    i know not to post twice, but i thought that poeple who already saw my last post would not know that i wasn't there yet
    We merely play "against the rules". We cheat. Thats what we are good at, thats what we do.
    http://www.frement.net/srl/simba_user4.png

  5. #5
    Join Date
    Mar 2007
    Posts
    1,700
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    function zoek(array of array of integer)
    will work fine..

  6. #6
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Function Zeok([ArrayName[0]])

    Is that doesn't work, try this:

    SCAR Code:
    Function Zeok([ArrayName[0][0], ArrayName[0][1]]);

    I believe.

    ~Sandstorm

  7. #7
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sandstorm View Post

    SCAR Code:
    Function Zeok([ArrayName[0][0], ArrayName[0][1]]);

    I believe.

    ~Sandstorm
    that is the problem, i have 64 values to give to the function, i don't want to put them all like:
    SCAR Code:
    Function Zeok([ArrayName[0][0], ArrayName[0][1] ArrayName[1][0] ArrayName[1][1]..etc]
    We merely play "against the rules". We cheat. Thats what we are good at, thats what we do.
    http://www.frement.net/srl/simba_user4.png

  8. #8
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR Code:
    procedure zeok(I: Array of Array of Integer);
    And then just pass the whole array?

  9. #9
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yea
    i am asking al day on irc but no one knew how to do it
    3 poeple tryed:S:P
    this is what i got:
    SCAR Code:
    function zoek(new: array of array of string; lvl,hoogst:Integer):Integer;
    var
    zet : Integer;
    begin
     writeln(new[1][1]);

    end;
    begin
    index;
    zoek(bej,0,0);// line 105

    end.

    bej is an array filled with values, 64 values.
    i need to pass them all to the function
    We merely play "against the rules". We cheat. Thats what we are good at, thats what we do.
    http://www.frement.net/srl/simba_user4.png

  10. #10
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Try Zeok(Bej[0],0,0);.

    ~Sandstorm

  11. #11
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  12. #12
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    @Smarter Child
    bej is short for bejeweld
    @Sandstorm
    already tryed that
    We merely play "against the rules". We cheat. Thats what we are good at, thats what we do.
    http://www.frement.net/srl/simba_user4.png

  13. #13
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    That should work. Can you post how you define "bej"?
    And what's the error?

  14. #14
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hoog = 8
    breed = 8
    SCAR Code:
    bej: array[0..hoog] of array[0..breed] of String;   //bej[x][y]

    but it must not only send bej[0][watever]
    also:
    bej[1][0]
    bej[1][1]
    bej[1][2]
    bej[2][0]
    bej[2][1] etc etc
    We merely play "against the rules". We cheat. Thats what we are good at, thats what we do.
    http://www.frement.net/srl/simba_user4.png

  15. #15
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Define it all to Bej[0][0....64], so that mine works.

    ~Sandstorm

  16. #16
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Finaly fixed.
    mixster helped me out on irc.
    my problem was that is made the array static at the top
    and static can not be passed to the function
    We merely play "against the rules". We cheat. Thats what we are good at, thats what we do.
    http://www.frement.net/srl/simba_user4.png

  17. #17
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Sandstorm View Post
    Define it all to Bej[0][0....64], so that mine works.

    ~Sandstorm
    That would be pointless. That would defeat the purpose of a 2d array.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Using an array as a function result
    By Distort in forum OSR Intermediate Scripting Tutorials
    Replies: 23
    Last Post: 03-26-2011, 08:25 AM
  2. Replies: 3
    Last Post: 10-12-2007, 01:40 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
  •