Posted: Tue Jan 12, 2010 6:47 pm Post subject: Glitch help in my program!
What is it you are trying to achieve?
To make a program that resembles a text based game
What is the problem you are having?
That the text disappears before anyone can read it, the sound file also does not work, and only works at the first 3 seconds, then stops, or when you click the red X to close the window....
Describe what you have tried to solve this problem
Moving around the music, nothing yet for the text
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
import GUI
setscreen ("graphics:max,max,nobuttonbar,msdos")
colorback (255)
cls
color (12)
process BackgroundMusic
loop
Music.PlayFileLoop ("Guns N' Roses - Shackler's Revenge.mp3")
end loop
end BackgroundMusic
fork BackgroundMusic
var command : string
var key : string (1)
const PIC_ID := Pic.FileNew ("mentalroom.jpg")
const PIC_ID2 := Pic.FileNew ("headset.jpg")
const PIC_ID3 := Pic.FileNew ("bloodstains.jpg")
const PIC_ID4 := Pic.FileNew ("paper_ball.jpg")
const PIC_ID5 := Pic.FileNew ("knife.jpg")
const PIC_ID6 := Pic.FileNew ("Zombie.jpg")
var keyboardinput:int
var Health : int
var username : string
var knife_answer : string
var menu_choice : int
var chars :array char of boolean
var death :int
% put "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ESCAPE@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
% put "__________________________________MENU________________________________"
% put skip
% procedure Test
% locate (1,1)
% put "Welcome!"
% end Test
%
% procedure Test2
% locate (1,1)
% put "This might be the instructions"
% end Test2
%
% var button1:int:=GUI.CreateButton(200,200,12,"Start Game",Test)
% var button2:int:=GUI.CreateButton(200,400,12,"Instructions?",Test2)
% loop
% exit when GUI.ProcessEvent
% end loop
put "PLEASE ENTER YOUR USERNAME"
get username
cls
if username = "Pablo" then
loop
color (1)
put "PABLO IS A TREEE!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (2)
put "PABLO IS A TREEE!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (3)
put "PABLO IS A TREEE!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (4)
put "PABLO IS A TREEE!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (5)
put "PABLO IS A TREEE!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (6)
put "PABLO IS A TREEE!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (7)
put "PABLO IS A TREEE!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (8)
put "PABLO IS A TREEE!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (9)
put "PABLO IS A TREEE!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (10)
put "PABLO IS A TREEE!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (11)
put "PABLO IS A TREEE!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (12)
put "PABLO IS A TREEE!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (13)
put "PABLO IS A TREEE!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (14)
put "PABLO IS A TREEE!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (15)
put "PABLO IS A TREEE! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (1)
put "PABLO IS A TREEE!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (2)
put "PABLO IS A TREEE!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (3)
put "PABLO IS A TREEE!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (4)
put "PABLO IS A TREEE!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (5)
put "PABLO IS A TREEE!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (6)
put "PABLO IS A TREEE!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (7)
put "PABLO IS A TREEE!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (8)
put "PABLO IS A TREEE!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (9)
put "PABLO IS A TREEE!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (10)
put "PABLO IS A TREEE!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (11)
put "PABLO IS A TREEE!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (12)
put "PABLO IS A TREEE!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (13)
put "PABLO IS A TREEE!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
color (14)
put "PABLO IS A TREEE!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!"
end loop
end if
put ""
put "Please wait while the game loads"
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
put "Loading Screen."
delay (250)
cls
put "Loading Screen.."
delay (250)
cls
put "Loading Screen..."
delay (250)
cls
put "Loading Screen...."
delay (250)
cls
put "Loading Screen....."
delay (250)
cls
put "Loading Screen...."
delay (250)
cls
put "Loading Screen..."
delay (250)
cls
put "Loading Screen.."
delay (250)
cls
put "Loading Screen."
delay (250)
cls
put "Loading Screen.."
delay (250)
cls
put "Loading Screen..."
delay (250)
cls
put "Loading Screen...."
delay (250)
cls
put "Loading Screen....."
delay (250)
cls
put "Loading Screen...."
delay (250)
cls
put "Loading Screen..."
delay (250)
cls
put "Loading Screen.."
delay (250)
cls
put "Loading Screen."
delay (250)
cls
locate (25, 65)
put "*Where am I?*"
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
locate (25, 65)
put "*I can't see anything?*"
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
locate (25, 65)
put "Welcome?" ..
locate (25, 65)
put "My name is Friend."
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
locate (25, 65)
put "*What am I doing here?Friend?*"
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
locate (25, 65)
put "How about you reach upwards, there should be a string"
locate (26, 65)
put "**You reach and find the string**"
locate (27, 65)
put "Pull it?now"
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
locate (22, 65)
put "The following commands for this situation are..."
locate (23, 65)
put "Pull the string?PULL"
locate (24, 65)
put "Don't trust this *friend* guy, you can manage on your own?LEAVE"
locate (25, 65)
get command
case command of
label "PULL" :
cls
colorback (0)
cls
put "**A light flickers on, and you realize that the string was attached to the light**"
put "Well that wasn't so hard now was it?"
put "Why don't you have a look around where you are right now..."
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
Pic.Draw (PIC_ID, 0, 0, picCopy)
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
put ""
put "You see, right now, in this situation, I'm the best hope you have of surviving."
put "Look on the table, there should be a headset there...pick it up..."
put "**You go to pick it up, and find a note underneath**"
Pic.Draw (PIC_ID3, 0, 0, picCopy)
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
put "The commands for this situation are..."
put "Read the note...Read"
put "Leave the note alone...Leave"
get command
cls
if command = "Read" then
put ""
put "**It reads...'IF SOMEONE FINDS THIS NOTE, DO NOT TRUST THE PERSON NAMED 'FRIEND'..."
put "**It looks like the note goes on, but the rest is covered by blood**"
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
elsif command = "Leave" then
put ""
put "**You crumple the paper and throw it into a corner, your hand is briefly stained with fresh blood from the note**"
Pic.Draw (PIC_ID4, 0, 0, picCopy)
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
end if
put ""
put "Alright, there should be a door, to get out, go to it"
put "*Fine but you better tell me whats going on here, and what is happening?*"
put "**You hear laughing, all in good time ", username, "."
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
put ""
put "**As you approach the door, you stumble upon something, when you look closer you see its a knife**"
put "**Would you like to pick it up?**"
put "The commands for this situation are...."
put "Pick it up....................Yes"
put "Leave it......................Leave"
Pic.Draw (PIC_ID5, 0, 0, picCopy)
get command
cls
if command = "Yes" then
put ""
put "You pick up the knife..."
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
put ""
put "YOU HAVE JUST FOUND THE KNIFE!!!"
put "Stats!"
put "This weapon gives you 5 attack and 1 defense"
put "The code for this weapon is knife1"
put "Write it down somewhere!!!!!!!!!!!"
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
elsif command = "No" then
put ""
put "You decide to leave the knife thinking you are in no need of a knife whatsoever..."
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
else
colorback (255)
cls
loop
color (0)
put " EEEEEEEEEEEEEEEEEE RRRRRRRRRRRRR RRRRRRRRRRRRR OOOOOOOOOOOOOO RRRRRRRRRRRRR"
put " EEEEEEEEEEEEEEEEEE RRRRRRRRRR RR RRRRRRRRRR RR OOOOOOOOOOOOOO RRRRRRRRRR RR"
put " EE RR RRR RR RRR OO OO RR RRR"
put " EE RR RRR RR RRR OO OO RR RRR"
put " EE RR RRR RR RRR OO OO RR RRR "
put " EEEEEEEEEE RRRRRRRRRR RRRRRRRRRR OO OO RRRRRRRRRR "
put " EEEEEEEEEE RRRRRRR RRRRRRR OO OO RRRRRRR "
put " EE RRRRRRRR RRRRRRRR OO OO RRRRRRRR "
put " EE RR RRR RR RRR OO OO RR RRR "
put " EE RR RRR RR RRR OO OO RR RRR "
put " EEEEEEEEEEEEEEEEEE RR RRR RR RRR OOOOOOOOOOOOOO RR RRR "
put " EEEEEEEEEEEEEEEEEE RR RRR RR RRR OOOOOOOOOOOOOO RR RRR"
put " "
put " "
end loop
end if
put ""
put "Alright now ", username, " now go outside the door, you should find yourself in a hallway"
put "**As you step out the door, you try to get your bearings...**"
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
colorback (255)
cls
Pic.Draw (PIC_ID6, 0, 0, picCopy)
cls
put "YOU HAVE JUST ENCOUNTERED YOUR FIRST MONSTER!!!!!!"
put "NOW YOU MUST BATTLE TO SURVIVE!!!!!!!!!!!!!"
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
put "The stats for the 'head crab zombie' is...."
put "Attack...........................2"
put "Defense..........................1"
put "Would you like to battle this monster, or would you rather run away?"
put "You may gain some items from battling this monster, but if you run"
put "you may sustain damage..!"
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
put "The commands for this situation are........"
put "Battle.............................Attack"
put "Run away like a coward.............Run"
get command
if command = "Attack" then
put "Now that you have chosen to attack the monster, you must select a weapon..."
put "When you picked up the knife from earlier on, you should have gotten a code..."
put "USE THAT CODE NOW!!!!"
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
put "....Wait....You did pick up the knife didn't you?"
put "Well if you didn't I will give you the code...REMEMBER IT..."
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
end if
label "LEAVE" :
cls
put "What an unfortuanate desicion"
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
put "**You hear a huge crackle, and hear a spark.**"
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
put "**You stumble backwards and fall**"
put "**Unable to find the string again, you are forced to wander"
put "around the room aimlessly**"
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
put "**Because there is no food or water, you die of malnutrition in a few days"
put "atleast, you think its a few days...**"
put " "
put " "
locate (35, 126)
put "PRESS ANY KEY TO CONTINUE"
locate (35, 126)
getch (key)
cls
put "GAME OVER....YOUR INABILITY TO TRUST HAS LED TO YOUR DEATH"
locate (35, 126)
put "PRESS THE ESC KEY TO EXIT!"
locate (35, 126)
getch (key)
if chars (KEY_ESC) then
Window.Close(death)
end if
cls
end case
Turing:
<Add your code here>
Please specify what version of Turing you are using
Version....4.1.1
Sponsor Sponsor
xBalmungx
Posted: Tue Jan 12, 2010 6:50 pm Post subject: Re: Glitch help in my program!
Oh, shoot, I forgot it was so long, my bad....but an update on details...I am currently in the middle of working on it, it is not finished, and this is a repost from another section, did not realize I could put it there, again Im sorry, Im new on this site
Ktomislav
Posted: Wed Jan 13, 2010 9:37 am Post subject: Re: Glitch help in my program!
Posted: Wed Jan 13, 2010 5:26 pm Post subject: Re: Glitch help in my program!
Um, am I not supposed to use the getch command in this instance?
Ktomislav
Posted: Wed Jan 13, 2010 5:58 pm Post subject: Re: Glitch help in my program!
Everything is fine except one word. Think harder and take look at the documentation.
xBalmungx
Posted: Wed Jan 13, 2010 6:02 pm Post subject: Re: Glitch help in my program!
I think its the chars in the brackets, because i really can't think of anything else lol
Ktomislav
Posted: Wed Jan 13, 2010 6:13 pm Post subject: Re: Glitch help in my program!
OK I'll tell you what's the problem.
Well, you use chars variable to check if it is equal to ESC_KEY, but you should chect key variable..
I guess you just copied that from somewhere eh. Next time think harder.
xBalmungx
Posted: Wed Jan 13, 2010 6:17 pm Post subject: Re: Glitch help in my program!
Well I didnt copy it from somewhere, I just sorta put it together from the documentation that came with turing, and what does a "chect key variable" mean?
Sponsor Sponsor
Ktomislav
Posted: Wed Jan 13, 2010 6:21 pm Post subject: Re: Glitch help in my program!
It means check. It's a typo..
xBalmungx
Posted: Wed Jan 13, 2010 6:24 pm Post subject: Re: Glitch help in my program!
getch (key)
if chars (KEY_ESC) then
so, it should be
getch (key)
if chars (key) then????
or should it be
getch (KEY_ESC)
if chars (KEY_ESC) then
TheGuardian001
Posted: Wed Jan 13, 2010 6:29 pm Post subject: Re: Glitch help in my program!
Erm... Neither. You should be ignoring chars altogether, as array char of boolean is only useful with Input.KeyDown, which would be difficult to add in at this point.
Is there a reason you decided to check the value of chars(KEY_ESCAPE)(which is a boolean variable you never assigned to) instead of the value of key, which is where you actually stored the value?
xBalmungx
Posted: Wed Jan 13, 2010 6:32 pm Post subject: Re: Glitch help in my program!
Well, what I though basically was that in doing that code, when the user pressed the esc key, then the program would quit, but i think the documentation isnt that well detailed throughout
Ktomislav
Posted: Wed Jan 13, 2010 6:32 pm Post subject: Re: Glitch help in my program!
You could try every single pissibility and you would know the answer. Well you wouldn't because you didn't write the every possibility. But you know what I mean.
Why don't you just take some time and think it through?? You people are unbelievable, you want everything served.
If you learn by heart then you should better not learn at all. It's just a waste of time..
Think about what I've just said before you reply.
EDIT: Sorry my fault, I never used getchar. I thought it is the same as Input.KeyDown. But everything else I said is still fine.
So the wrong part is that getch should be replaced with Input.KeyDown and key should be array char of boolean.
xBalmungx
Posted: Wed Jan 13, 2010 6:59 pm Post subject: Re: Glitch help in my program!
getch (key)
if chars (KEY_ESC) then
okay so, if i understand you right, key should be an array char of boolean,
and getch should be replaced with input.keydown,
if i do that though, then what do i use with my other getch commands? because they all use the key command, btw i have only been doing turing for the past month....so yea
xBalmungx
Posted: Wed Jan 13, 2010 7:03 pm Post subject: Re: Glitch help in my program!