
-----------------------------------
JB
Mon Dec 15, 2008 8:15 pm

How do you get a GUI to go to the next section on a game when you click a button?
-----------------------------------
Here is my RPG game that I'm making. Since I'm a beginner, the game isn`t that great. I`m also not finished it yet either. What I'm trying to do is get the GUI to start the game when I click start. Here is my game. If you can get the GUi to work for me that would be helpful. 
import GUI

View.Set ("graphics:360;400,nobuttonbar")

GUI.SetBackgroundColour (grey)

procedure Start  
end Start 

procedure Instructions 
end Instructions

procedure Load  
end Load  
% Place some buttons.

var b1 := GUI.CreateButton (10, 370, 100, "Start Game", Start )
var b2 := GUI.CreateButton (130, 370, 100, "Instructions", Instructions)
var b3 := GUI.CreateButton (250, 370, 100, "Load Game", Load ) 
loop
    exit when GUI.ProcessEvent
end loop 
cls 
setscreen ("graphics:900 ,650") % This adjusts your screen size, you can adjust it to whatever you like
% Game Options Variables 
put "Are you ready to play Cutthroat?"
var name : string               % You can ask the user to input their name 
var age : real                 % You can ask the user to input their age 
var User_Input : string 
var User_Level : int := 1 
var User_Race : string  
var User_Class : string
var User_Gender : string 
var User_CurrentLife : int 
var User_Strength : int 
var User_Intelligence : int 
var User_Experience : real 
var User_NextLevel : int  
var User_Gold : int 
var User_Weapon : string 
var User_WeapDam : int 
var User_Sheild : string 
var User_ShDef : int 
var User_Armor : string 
var User_ArDef : int 
var User_Defense : real 
var User_Damage : real
put "Enter your name." %This is where you create your character.%
get name
put "Enter you age."
get age 
put "what is your class?"
loop
put "Enter User_Race." 
put "Human - Can easily change its class. They are an excellent choice for beginners."
put "Elf - They are known for their poetry, song, and magical arts. THey also show great skil with weapons, and strategy." 
put "Dwarf - They are known for their skill in warefare, their ability to withstand physical and nagical punishment, and their hard work." 
put "Gnome - They are smaller than Dwaves, and make good alchenists, and technicians." 
put "Halfling - They are clever, capable, and resouceful suvivers." 
put "Half Elf - They get curiosity, and ambition from their human parent, and the love of poetry and song from their elf parent." 
put "Alien - They are skilled in magic. They use very powerful magic that is too complicated for even the most powerful wizards to learn." 
put "Half Orc - Half orc, half human. They like fighting more than argueing." 
put "Demon - Thye don't have a living body, and are more ghost like, than human like." 
get User_Race
exit when User_Race = "Human" or User_Race = "Elf" or 
                    User_Race = "Dwarf" or User_Race = "Gnome" or User_Race = "Halfling" or 
                    User_Race = "Half Elf" or User_Race = "Alien" or User_Race = "Half Orc" or 
                    User_Race = "Demon" 
end loop 
loop
cls 
            put "Enter Gender " 
            put "Male or Female ?" 
            get User_Gender 
            cls 
            exit when User_Gender = "Male" or User_Gender = "Female" 
        end loop 
loop
    exit when GUI.ProcessEvent
end loop


Mod Edit: Remember to use syntax tags! Thanks :) [syntax="Turing"]Code Here[/syntax]

-----------------------------------
pmads
Tue Dec 16, 2008 2:00 am

Re: How do you get a GUI to go to the next section on a game when you click a button?
-----------------------------------
Your almost there. One line.

procedure start
GUI.Quit
end start


This will get exit that first loop you have and move you onto the rest of the game

Cheers,
Pat
