Results 1 to 6 of 6

Thread: Pascal Arrays

  1. #1
    Join Date
    Nov 2006
    Posts
    120
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Pascal Arrays

    I decided to waste my time by writing a script to solve minesweeper. I really have no intentions of this working or being of any use but i need to get my programming skills up again. I've ran into a few problems with my arrays.

    Ideally (I think...correct me if i'm wrong) I'll have a two-dimensional array to describe where each of the 64(on beginner) little 15x15 pixel square is. And i'll have an array of 10 elements to hold the information in the square (1..8, empty, filled).

    I will have the program look at the 2D array to look through the squares and then use bitmap recognition to decide what information is in the square.

    Eventually of course i will have to make some sort of variable system to handle the information in the surrounding 8 squares and act accordingly, but one bite at a time right?

    The part where i have trouble with is defining my 2D array. How can i have each element of that be a 15x15 pixel square? I can obviousy make an array by having ('a'..'h',1..8) but how can i define each element by a square? i'm pretty new to arrays (about 36 hours since i learned about them) so any info would be great.

    Thanks!

    Ransom

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

    Default

    if your using coordinates and arrays, you can try tpointarrays. a tpoint is a varialble with 2 sets of information

    var tp:tpoint;
    tp.x:=1
    tp.y:=2

    so if you have a 2 sets of tpoints, one for the top left, and one for the bottom right, just call to each set for the coordinates of the boxes. so tpointarraytopleft 1-15 has top left coords,and tpointarraybottomright 1-15 has the corresponding bottom right points.

    and if you using scar, i believe it is written in delphi, so a site i use is http://www.delphibasics.co.uk/index.html

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

    Default

    type square=record
    a,b,c,d,e,f,g,h:integer;
    empty, filled:boolean;
    end;

    var mysquare:square;

    begin
    mysquare.a:=blahblah;
    mysquare.empty:=true;
    end.

    ----------------------------------------------
    Edit: actually it would be
    var
    mysquare:array of square;

    begin
    mysquare[0].a

  4. #4
    Join Date
    Feb 2006
    Location
    London, England
    Posts
    2,045
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    If you wanna define a 2D array,

    PHP Code:
    This: Array of Array of Integer;
    This: Array[1..3of Array[1..6of Integer
    SRL Wiki | SRL Rules | SRL Stats
    Ultimate SCAR Scripting Tutorial | Starblaster100's Auth System | Join the official SRL IRC now!


    Help Keep SRL Alive! Please disable Advert Blockers on SRL! Help Keep SRL Alive!


  5. #5
    Join Date
    Nov 2006
    Posts
    120
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright i think I'm getting it a little bit better. I'm working on that script at work and school because it's a lot easier to test and get away with than runescape scripts. I don't really spend much time playing the game mostly just like finding ways to bend and shatter the rules While browsing the delphi stuff i ran across the TRect class and i think i'm going to use that one. I can put in the coords using an x,y formula type thing and it will give me the exact coods of the rectangles top, bottom, right and left. That way i can spit them back out when i'm doing FindBitmapToleranceIn() Or something else along those lines that takes 4 points to a rectangle.

    I'll post more as i test more but thanks for your help. I hope to have this functioning (probably not working..just finding and clicking) in the next few days so i'll post what i have when i get the chance. Thanks for the prompt help!

    Now just to get the coords spit out how i need them........hmmm..... h): any takers?

    Thanks!

    Ransom

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

    Default

    I don't see that in the supported classes section of SCAR's F1 help, you may need to make it yourself with type record.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Arrays, stuck on arrays
    By Camaro' in forum OSR Help
    Replies: 1
    Last Post: 03-08-2008, 02:02 AM
  2. pascal?
    By omgh4x0rz in forum General
    Replies: 12
    Last Post: 05-01-2007, 11:07 AM
  3. Pascal
    By WhoCares357 in forum General
    Replies: 9
    Last Post: 04-06-2007, 07:28 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
  •