Hasch problems.
Author |
Message |
d2bb
|
Posted: Sat Sep 01, 2007 2:10 pm Post subject: Hasch problems. |
|
|
K for my Rpg i got an annoying little error.
What :
What im trying to do is have user input a character from 1 to 9, when a number is picked (using your keyboard) the "ch" value is ereased if the user chooses another number after that.
Error : I dont even know ~_~ just jumps to the widgetmodule line # 100
Any 1 that cant understand what im trying to get at please post and ill explain more. Ive Left a Sample Code that sould work when started with the error.
code: | procedure Ms
setscreen ("graphics:1260;900,title:Role Playing Module")
var box3 : int := GUI.CreateTextBox (2, 400, 310, 200)
var ch : string (1)
loop
exit when not hasch
getch (ch) % Discard this character
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
end Ms
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
d2bb
|
Posted: Sun Sep 02, 2007 11:29 am Post subject: RE:Hasch problems. |
|
|
Never I Fixed it darn loops
Basic Fix.
loop
var ch : string (1)
loop
exit when not hasch
getch (ch) % Discard this character
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
end loop |
|
|
|
|
|
|
|