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

Username:   Password: 
 RegisterRegister   
 Role Playing Game Help: Gui + Input.keydown
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
d2bb




PostPosted: Tue Sep 04, 2007 11:24 pm   Post subject: Role Playing Game Help: Gui + Input.keydown

K, my problem is this i can get either :

a) The Gui section of my program working.

b) The Attack Move Selection

--------I need some help can some 1 modify this or help me out so both the Gui + Input Key Down Work.


Also Looking for some 1 to design map + characters (graphics) I cant draw im sorry ! Razz

Heres Code

code:

import GUI
%Part Two Gaming Console
var res : array 1 .. 6 of int
res (1) := 0        %poison res
res (2) := 0        %fire res
res (3) := 0        %cold res
res (4) := 0        %lightning res
res (5) := 0        %magic res
res (6) := 0        %block percent
%Advanced Attack Module | Item Bonus |
var faster_attack_rating : int := 0
var faster_cast_rating : int := 0
var faster_run_walk : int := 0
var faster_life_heal : int := 0
var faster_energy_heal := 0
var faster_experience := 0
%One or Two hand items.
var one_hand : int := 1
var two_hand : int := 2
var starting_stats : array 1 .. 9 of int
starting_stats (1) := 1    %Level Of Character
starting_stats (2) := 20   %Life Of Character
starting_stats (3) := 5    %Energy of character
starting_stats (4) := 50   %Stats That User Has
starting_stats (5) := 0    %Experience of character (starting exp)
starting_stats (6) := 50   %Stamina of character
starting_stats (7) := 5    %Dexterity of character
starting_stats (8) := 15   %strenght of character.
starting_stats (9) := 10   %Starting defence

var GameOver : boolean := false
procedure attackmove
end attackmove
procedure DoNothing (status : boolean)
end DoNothing

setscreen ("graphics:1260;900,title:Role Playing Module")
GUI.SetBackgroundColor (gray)

%Lables the framework above the GUI display boxes
var exdentFrame1 : int
var exdentLabel1 : int
exdentFrame1 := GUI.CreateFrame (0, 850, 130, 900, GUI.EXDENT) % Label the lines.
exdentLabel1 := GUI.CreateLabelFull (0, 850, "Character Stats", 120, 60,
    GUI.CENTER + GUI.MIDDLE, 0)
var exdentFrame2 : int
var exdentLabel2 : int
exdentFrame2 := GUI.CreateFrame (132, 900, 295, 850, GUI.EXDENT) % Label the lines.
exdentLabel2 := GUI.CreateLabelFull (115, 500, "Quest Log", 200, 750,
    GUI.CENTER + GUI.MIDDLE, 0)
var exdentFrame3 : int
var exdentLabel3 : int
exdentFrame3 := GUI.CreateFrame (0, 603, 312, 653, GUI.EXDENT) % Label the lines.
exdentLabel3 := GUI.CreateLabelFull (0, 0, "Attack Log - Item Log", 335, 1254,
    GUI.CENTER + GUI.MIDDLE, 0)

var Quit : int := GUI.CreateButton (1171, 3, 0, "Quit Game", GUI.Quit)
var box1 : int := GUI.CreateTextBox (0, 749, 130, 100) %Character Stats
GUI.AddText (box1, "Strenght: ")
GUI.AddText (box1, intstr (starting_stats (8)))
GUI.AddLine (box1, " ")
GUI.AddText (box1, "Dexterity: ")
GUI.AddText (box1, intstr (starting_stats (7)))
GUI.AddLine (box1, " ")
GUI.AddText (box1, "Defence: ")
GUI.AddText (box1, intstr (starting_stats (9)))
GUI.AddLine (box1, " ")
GUI.AddText (box1, "Fire Res: ")
GUI.AddText (box1, intstr (res (2)))
GUI.AddLine (box1, " ")
GUI.AddText (box1, "Cold Res: ")
GUI.AddText (box1, intstr (res (3)))
GUI.AddLine (box1, " ")
GUI.AddText (box1, "Lightning Res: ")
GUI.AddText (box1, intstr (res (4)))
GUI.AddLine (box1, " ")
GUI.AddText (box1, "Poison Res: ")
GUI.AddText (box1, intstr (res (1)))
GUI.AddLine (box1, " ")
GUI.AddText (box1, "Magic Res: ")
GUI.AddText (box1, intstr (res (5)))
GUI.AddLine (box1, " ")
GUI.AddText (box1, "Block Rate: ")
GUI.AddText (box1, intstr (res (6)))
var box2 : int := GUI.CreateTextBox (134, 749, 160, 100) %QuestLog!
GUI.AddText (box2, "Welcome To Training,")
GUI.AddLine (box2, " ")
GUI.AddText (box2, "Here comes your first enemy")
var box3 : int := GUI.CreateTextBox (2, 400, 310, 200) %Item//Attack Log
var AttackButton : int := GUI.CreateButton (50, 10, 0, "Attack", attackmove)
var player_screen : int := GUI.CreateCanvas (320, 60, 900, 675)

loop
    exit when GUI.ProcessEvent and GameOver = true
end loop

var ch : array char of boolean
Input.KeyDown (ch)

var user_move : int

if ch ('1') then
    GUI.AddLine (box3, " ")
    GUI.AddText (box3, "Slash has been Selected")
    user_move := 1
elsif ch ('2') then
    GUI.AddLine (box3, " ")
    GUI.AddText (box3, "Charge has been selected")
    user_move := 2
elsif ch ('3') then
    GUI.AddLine (box3, " ")
    GUI.AddText (box3, "Stab has been selected")
    user_move := 3
elsif ch ('4') then
    GUI.AddLine (box3, " ")
    GUI.AddText (box3, "Freeze has been selected")
    user_move := 4
elsif ch ('5') then
    GUI.AddLine (box3, " ")
    GUI.AddText (box3, "Fire Ball has been selected")
    user_move := 5
elsif ch ('6') then
    GUI.AddLine (box3, " ")
    GUI.AddText (box3, "Tornado has been selected")
    user_move := 6
elsif ch ('7') then
    GUI.AddLine (box3, " ")
    GUI.AddText (box3, "Hurricain has been selected")
    user_move := 7
elsif ch ('8') then
    GUI.AddLine (box3, " ")
    GUI.AddText (box3, "Lava has been selected")
    user_move := 8
elsif ch ('9') then
    GUI.AddLine (box3, " ")
    GUI.AddText (box3, "Summon Minion")
    user_move := 9
end if
Sponsor
Sponsor
Sponsor
sponsor
Bored




PostPosted: Thu Sep 06, 2007 8:44 pm   Post subject: Re: Role Playing Game Help: Gui + Input.keydown

The Input.KeyDown and the if statements need to be in the loop. Aswell you shouldn't be able to choose a move that's already selected to avoid repeat messages.
d2bb




PostPosted: Sat Sep 08, 2007 12:19 pm   Post subject: RE:Role Playing Game Help: Gui + Input.keydown

yes thx for tip Smile


but not working, ive pretty much tried 1-4 dif scripts to get it to run but im having 0 luck on getting both to Function properly.
Bored




PostPosted: Sat Sep 08, 2007 9:39 pm   Post subject: Re: Role Playing Game Help: Gui + Input.keydown

It shoul work if you do this at the bottom.
Turing:
var ch : array char of boolean

var user_move : int

loop
    exit when GUI.ProcessEvent and GameOver = true
    Input.KeyDown (ch)
    if ch ('1') then
        GUI.AddLine (box3, " ")
        GUI.AddText (box3, "Slash has been Selected")
        user_move := 1
    elsif ch ('2') then
        GUI.AddLine (box3, " ")
        GUI.AddText (box3, "Charge has been selected")
        user_move := 2
    elsif ch ('3') then
        GUI.AddLine (box3, " ")
        GUI.AddText (box3, "Stab has been selected")
        user_move := 3
    elsif ch ('4') then
        GUI.AddLine (box3, " ")
        GUI.AddText (box3, "Freeze has been selected")
        user_move := 4
    elsif ch ('5') then
        GUI.AddLine (box3, " ")
        GUI.AddText (box3, "Fire Ball has been selected")
        user_move := 5
    elsif ch ('6') then
        GUI.AddLine (box3, " ")
        GUI.AddText (box3, "Tornado has been selected")
        user_move := 6
    elsif ch ('7') then
        GUI.AddLine (box3, " ")
        GUI.AddText (box3, "Hurricain has been selected")
        user_move := 7
    elsif ch ('8') then
        GUI.AddLine (box3, " ")
        GUI.AddText (box3, "Lava has been selected")
        user_move := 8
    elsif ch ('9') then
        GUI.AddLine (box3, " ")
        GUI.AddText (box3, "Summon Minion")
        user_move := 9
    end if
end loop
At least that worked for me.[syntax=""][/syntax]
d2bb




PostPosted: Thu Sep 13, 2007 5:04 pm   Post subject: RE:Role Playing Game Help: Gui + Input.keydown

ver turing you using ? 4.0.3 here...

sadly didnt work. ! to bad eh ? yea... w.e ill find a dif way ! be nice to know y im getting this error though...
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  [ 5 Posts ]
Jump to:   


Style:  
Search: