Computer Science Canada

I need help, someone please help me.....

Author:  G-lant [ Thu May 20, 2004 3:13 pm ]
Post subject:  I need help, someone please help me.....

Are YOU THAT PRO?


Ok I cant seem to get my Player process to work without my Playsel process. The just dont work with out each other. Can some one see whats wrong and maby, kinda, fix it for me. Confused please?
code:
% The "GUI.CreateMenu" program.
import GUI
%Pic.ScreenLoad ("C:/game/Map1.jpg", 0, 0, picCopy)
View.Set ("graphics 640, 480")
View.Set ("nocursor")
var first, second : int                 % The menus.
var item : array 1 .. 4 of int         % The menu items.
var name : array 1 .. 4 of string (20) :=
    init ("Quit", "Map", "Player", "Player select")
%(, "B", "---", "C", "D",
%"Disable B Menu Item", "Enable B Menu Item", "---",
%"Disable Second Menu", "Enable Second Menu")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

procedure MenuSelected
    for i : 1 .. 4
        if item (i) = GUI.GetEventWidgetID then
            Text.Locate (maxrow, 1)
            put name (i) + " selected option              " ..
        end if
    end for
end MenuSelected

procedure Map
    for i : 1 .. 4
        if item (i) = GUI.GetEventWidgetID then
            Text.Locate (maxrow, 1)
            put name (i) + " selected option              " ..
        end if
    end for
end Map

procedure Playsel
    for i : 1 .. 4
        if item (i) = GUI.GetEventWidgetID then
            cls
            Text.Locate (maxrow, 1)
            put name (i) + " Test                          " ..
        end if
    end for
end Playsel

procedure Player
    for i : 1 .. 4
        if item (i) = GUI.GetEventWidgetID then
            Text.Locate (maxrow, 1)
            put name (i) + "s selected option              " ..
            delay (200)
            Playsel
        end if
    end for
end Player



% Create the menus
first := GUI.CreateMenu ("Game")
item (1) := GUI.CreateMenuItem (name (1), GUI.Quit)
item (2) := GUI.CreateMenuItem (name (2), Map)
item (3) := GUI.CreateMenuItem (name (3), Player)
%item (4) := GUI.CreateMenuItem (name (4), Playsel)

loop
    exit when GUI.ProcessEvent
end loop


Author:  Dan [ Thu May 20, 2004 6:23 pm ]
Post subject: 

you have to chage the number of indexs your are looking throw in your item array.

like so:

code:

% The "GUI.CreateMenu" program.
import GUI
%Pic.ScreenLoad ("C:/game/Map1.jpg", 0, 0, picCopy)
View.Set ("graphics 640, 480")
View.Set ("nocursor")
var first, second : int                 % The menus.
var item : array 1 .. 3 of int         % The menu items.
var name : array 1 .. 4 of string (20) :=
    init ("Quit", "Map", "Player", "Player select")
%(, "B", "---", "C", "D",
%"Disable B Menu Item", "Enable B Menu Item", "---",
%"Disable Second Menu", "Enable Second Menu")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

procedure MenuSelected
    for i : 1 .. 3
        if item (i) = GUI.GetEventWidgetID then
            Text.Locate (maxrow, 1)
            put name (i) + " selected option              " ..
        end if
    end for
end MenuSelected

procedure Map
    for i : 1 .. 3
        if item (i) = GUI.GetEventWidgetID then
            Text.Locate (maxrow, 1)
            put name (i) + " selected option              " ..
        end if
    end for
end Map

procedure Playsel
    for i : 1 .. 3
        if item (i) = GUI.GetEventWidgetID then
            cls
            Text.Locate (maxrow, 1)
            put name (i) + " Test                          " ..
        end if
    end for
end Playsel

procedure Player
    for i : 1 .. 3
       if item (i) = GUI.GetEventWidgetID then
            Text.Locate (maxrow, 1)
            put name (i) + "s selected option              " ..
            delay (200)
            Playsel
        end if
    end for
end Player



% Create the menus
first := GUI.CreateMenu ("Game")
item (1) := GUI.CreateMenuItem (name (1), GUI.Quit)
item (2) := GUI.CreateMenuItem (name (2), Map)
item (3) := GUI.CreateMenuItem (name (3), Player)
%item (4) := GUI.CreateMenuItem (name (4), Playsel)

loop
    exit when GUI.ProcessEvent
end loop

Author:  G-lant [ Fri May 21, 2004 3:24 pm ]
Post subject: 

Ok thanks man, that helps alot. ^^


: