
-----------------------------------
firex2249
Sun Jan 27, 2008 10:24 pm

Need help with game
-----------------------------------
I am done programming my game but i dont know why the interface doesnt work and the checking part in my game to check for the order, here is my program:

import GUI
%need to finish sorting the names in alphabetical order
setscreen ("graphics:300;200,nobuttonbar")

put "   Alphabetical Game By:Hammad Raja"

var xpos, ypos, btn : int

var frame : int := GUI.CreateFrame (200, 70, 100, 170, GUI.LINE)

var x : flexible array 1 .. 1 of string

%get names
var fstream : int
open : fstream, "wordlist3.txt", get
loop
    exit when eof (fstream)
    get : fstream, x (upper (x))
    new x, upper (x) + 1
end loop
% The "Music.PlayFile" program.
process DoMusic
    loop
        Music.PlayFile ("The_Ballad_of_Black_Mesa_l.mp3")
    end loop
end DoMusic

fork DoMusic

var word : array 1 .. 5 of string
var exiT : int := 0

word (1) := x (Rand.Int (1, 26))
word (2) := x (Rand.Int (1, 26))
word (3) := x (Rand.Int (1, 26))
word (4) := x (Rand.Int (1, 26))
word (5) := x (Rand.Int (1, 26))

loop
    for one : 1 .. 5
        for two : 1 .. 5
            if word (one) = word (two) then
                word (1) := x (Rand.Int (1, 26))
                word (2) := x (Rand.Int (1, 26))
                word (3) := x (Rand.Int (1, 26))
                word (4) := x (Rand.Int (1, 26))
                word (5) := x (Rand.Int (1, 26))
            else
                exiT := 1
            end if
        end for
    end for
    exit when exiT = 1
end loop
var word2 : array 1 .. 5 of string
for k : 1 .. 5
    word2 (k) := word (k)
end for


var word1x : int := 3
var word2x : int := 3
var word3x : int := 3
var word4x : int := 3
var word5x : int := 3


var wordy : array 1 .. 5 of int
wordy (1) := 150
wordy (2) := 130
wordy (3) := 110
wordy (4) := 90
wordy (5) := 70
%junk
procedure aa
end aa
procedure bb
end bb
procedure dd
end dd
procedure ff
end ff
procedure gg
end gg
%/junk
var button : array 1 .. 5 of int
button (1) := GUI.CreateButton (word1x, wordy (1), 10, word (1), aa)
button (2) := GUI.CreateButton (word2x, wordy (2), 10, word (2), bb)
button (3) := GUI.CreateButton (word3x, wordy (3), 10, word (3), dd)
button (4) := GUI.CreateButton (word4x, wordy (4), 10, word (4), ff)
button (5) := GUI.CreateButton (word5x, wordy (5), 10, word (5), gg)

var width1 : int := GUI.GetWidth (button (1))
var width2 : int := GUI.GetWidth (button (2))
var width3 : int := GUI.GetWidth (button (3))
var width4 : int := GUI.GetWidth (button (4))
var width5 : int := GUI.GetWidth (button (5))

var height1 : int := GUI.GetHeight (button (1))
var height2 : int := GUI.GetHeight (button (2))
var height3 : int := GUI.GetHeight (button (3))
var height4 : int := GUI.GetHeight (button (4))
var height5 : int := GUI.GetHeight (button (5))

%sort
var counter : int := 1
var temp : string
for alpha : 97 .. 122
    for win : 1 .. 5
        if ord (word (win) (1)) = alpha then


            temp := word (counter)
            word (counter) := word (win)
            word (win) := temp
            counter := counter + 1
        end if
    end for
end for


var Skip : array 1 .. 5 of int
for SKIP : 1 .. 5
    Skip (SKIP) := SKIP
end for

procedure checkwin
    %win word(correct), word2(original), button,wordy(height)
    for check : 1 .. 5


        for check2 : 1 .. 5
            if word (check) = word2 (check2) then

                for checky : 1 .. 5

                    if check = 1 then
                        if wordy (check2) >= wordy (checky) then
                            Skip (1) := check2

                        else
                            exit
                        end if
                    end if
                    if check = 2 and checky not= Skip (1) then
                        if wordy (check2) >= wordy (checky) then
                            Skip (2) := check2

                        else
                            exit
                        end if
                    end if

                    if check = 3 and checky not= Skip (1) and checky not= Skip (2) then
                        if wordy (check2) >= wordy (checky) then
                            Skip (3) := check2

                        else
                            exit
                        end if
                    end if
                    if check = 4 and checky not= Skip (1) and checky not= Skip (2) and checky not= Skip (3) then
                        if wordy (check2) >= wordy (checky) then
                            Skip (4) := check2

                        else
                            exit
                        end if
                    end if
                    if check = 5 and checky not= Skip (1) and checky not= Skip (2) and checky not= Skip (3) and checky not= Skip (4) then
                        if wordy (check2) >= wordy (checky) then
                            %light up??
                            cls
                            put "Good Job You Win!!"
                            var x, y, button : int
                            loop
                                mousewhere (x, y, button)
                                drawbox (10, 10, 110, 110, black)
                                locatexy (48, 65)
                                put "Exit"
                                exit when 10 = wordy (checky) then
                            Skip (1) := check2

                        else
                            exit
                        end if
                    end if
                    if check = 2 and checky not= Skip (1) then
                        if wordy (check2) >= wordy (checky) then
                            Skip (2) := check2

                        else
                            exit
                        end if
                    end if

                    if check = 3 and checky not= Skip (1) and checky not= Skip (2) then
                        if wordy (check2) >= wordy (checky) then
                            Skip (3) := check2

                        else
                            exit
                        end if
                    end if
                    if check = 4 and checky not= Skip (1) and checky not= Skip (2) and checky not= Skip (3) then
                        if wordy (check2) >= wordy (checky) then
                            Skip (4) := check2

                        else
                            exit
                        end if
                    end if
                    if check = 5 and checky not= Skip (1) and checky not= Skip (2) and checky not= Skip (3) and checky not= Skip (4) then
                        if wordy (check2) >= wordy (checky) then
                            %light up??
                            cls
                            put "Good Job You Win!!"
                            var x, y, button : int
                            loop
                                mousewhere (x, y, button)
                                drawbox (10, 10, 110, 110, black)
                                locatexy (48, 65)
                                put "Exit"
                                exit when 10 