Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 My RPG game won't display stats.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
JB




PostPosted: Mon Jan 12, 2009 3:55 pm   Post subject: My RPG game won't display stats.

Here is my Rpg game called Cutthroat. It's not finished yet, and at the end of the code, it is supposed to display the stats of your character, and it does, but, the stats are flashing by on the screen real fast so you can't read them, and I can't figure out how to get it stop. Here is my code.

Turing:
% My game called....Cutthroat%
%Started on decenber 14 2008%

import GUI
View.Set ("graphics:600;400,nobuttonbar")
%Character info%
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 : real
var User_Strength : int
var User_Intelligence : int
var User_Gold : int
var User_Weapon : string
var User_WeapDam : int
var User_Sheild : string
var User_Armor : string
var User_Defence : real
var User_Damage : real
var User_Speed : int

var User_Experience : real
var User_NextLevel : int
%Weapons%



GUI.SetBackgroundColour (grey)

procedure Start
    GUI.Quit
end Start

procedure Instructions
end Instructions

procedure Load
end Load
var b1 := GUI.CreateButton (10, 250, 100, "Start Game", Start)
var b2 := GUI.CreateButton (130, 200, 100, "Instructions", Instructions)
var b3 := GUI.CreateButton (250, 250, 100, "Load Game", Load)
loop
    exit when GUI.ProcessEvent
end loop
proc Create_Character
 cls
    put "What is your characters name?"
    get name

    put "How old is your character?"
    get age
    loop
        put "Enter your Race."
        put "Human - Can easily change its class."
        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 - They 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
        if User_Race = "Human" then
            User_CurrentLife := 50
            User_Strength := 7
            User_Intelligence := 6
            User_Experience := 20
            User_NextLevel := 30
            User_Gold := 500
            User_Defence := 3
            User_Damage := 8
            User_Speed := 7
        end if
        if User_Race = "Elf" then
            User_CurrentLife := 90
            User_Strength := 4
            User_Intelligence := 9
            User_Experience := 20
            User_NextLevel := 30
            User_Gold := 500
            User_Defence := 5
            User_Damage := 4
            User_Speed := 8
        end if
        if User_Race = "Dwarf" then
            User_CurrentLife := 70
            User_Strength := 6
            User_Intelligence := 3
            User_Experience := 20
            User_NextLevel := 30
            User_Gold := 500
            User_Defence := 5
            User_Damage := 3
            User_Speed := 7
        end if
        if User_Race = "Gnome" then
            User_CurrentLife := 70
            User_Strength := 5
            User_Intelligence := 3
            User_Experience := 20
            User_NextLevel := 30
            User_Gold := 500
            User_Defence := 4
            User_Damage := 4
            User_Speed := 5
        end if
        if User_Race = "Halfling" then
            User_CurrentLife := 50
            User_Strength := 6
            User_Intelligence := 6
            User_Experience := 20
            User_NextLevel := 30
            User_Gold := 500
            User_Defence := 4
            User_Damage := 5
            User_Speed := 8
        end if
        if User_Race = "Half Elf" then
            User_CurrentLife := 70
            User_Strength := 6
            User_Intelligence := 8
            User_Experience := 20
            User_NextLevel := 30
            User_Gold := 500
            User_Defence := 7
            User_Damage := 7
            User_Speed := 9
        end if
        if User_Race = "Alien" then

            User_CurrentLife := 100
            User_Strength := 9
            User_Intelligence := 10
            User_Experience := 10
            User_NextLevel := 30
            User_Gold := 500
            User_Defence := 9
            User_Damage := 10
            User_Speed := 9
        end if
        if User_Race = "Half Orc" then
            User_CurrentLife := 60
            User_Strength := 10
            User_Intelligence := 2
            User_Experience := 20
            User_NextLevel := 30
            User_Gold := 500
            User_Defence := 6
            User_Damage := 10
            User_Speed := 5
        end if
        if User_Race = "Demon" then
            User_CurrentLife := 100
            User_Strength := 9
            User_Intelligence := 4
            User_Experience := 20
            User_NextLevel := 30
            User_Gold := 500
            User_Defence := 6
            User_Damage := 9
            User_Speed := 9
            end if
            loop
            put "Character Name: ", name
            put "Age: ", age
            put "Level: ", User_Level
            put "Race: ", User_Race
            put "Life: ", User_CurrentLife
            put "Strength: ", User_Strength
        end loop
        end loop
        end Create_Character
Create_Character




Mod Edit: Remember to use syntax tags! Thanks Smile
code:
[syntax="turing"]Code Here[/syntax]
Sponsor
Sponsor
Sponsor
sponsor
The_Bean




PostPosted: Mon Jan 12, 2009 4:00 pm   Post subject: Re: My RPG game won't display stats.

Turing automatically puts each new 'put' statement on a new line. Since you are looping the same put statements over and over again, they will continue to move down the screen. To fix this, either use a cls to clear the screen each time, or use Text.Locate to put the text where you want it.
andrew.




PostPosted: Mon Jan 12, 2009 4:14 pm   Post subject: RE:My RPG game won\'t display stats.

Why do you need the loops? All they're doing is doing the same thing over and over again even though it only has to be done once.
JB




PostPosted: Mon Jan 12, 2009 4:33 pm   Post subject: Re: My RPG game won't display stats.

Thanks that code helped me out alot. Also thanks for the info on the number of loops that I had in my game. I thought that they would help the problem that I had with the game. Not cause it or make it worse.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: