Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / grr ahh help text based game problem lol why me

Author
Message
Atari88
19
Years of Service
User Offline
Joined: 6th Aug 2005
Location:
Posted: 6th Aug 2005 12:48
my problem is no the text based game. my problem is that i have diolouge in my game to play out the story

example
..................................................................
load bitmap "door\bitmap1.bmp"
sync
print "you are standing in a musty room facing a door"
wait 5000
cls
print "you hear a feral growl coming from behind the door"
wait 5000
cls
input "what do you wish to do",a$
center text 320,290 "open door"
center text 320,320 "duh stay here"
if a$="open door" then gosub door
if a$="duh stay here" then go sub panzy
................................................................
how can i get that pic to stay though the dialog phase and have the the previous text disapear like i had used the cls comand pleas help me it is anoying because the problem is so trivial i feel like a total noob. ie i am lol

"A lesson in life is to always surpass what is thought impossible.Never hesitate. up it another notch push back the boundries that hem you and refuse to fail."
-Clay Gilmer
Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 6th Aug 2005 18:09 Edited at: 6th Aug 2005 18:13
heres some tips to get you sorted

load an image rather than a bitmap, then before you rewrite the screen do a paste image and it will clear the screen with the door image, then print over that

start your code

sync on
sync rate 40

then when you have finished printing to the screen etc just do a sync so that the user see`s the alterations you made (as in when you print over the door picture)

NEVER use wait inside code, it just wastes CPU time that you could use to add some extra polish to your program, plus 5 seconds to read those options would be annoyingly long for some people and too fast for others, if you want the program to continue anyway, but still give the player a chance to exit it before the timeout then do something like

t=timer()+5000
blah!!!
print "space to continue"
repeat
untill ((timer()>t)or(spacekey()))

thats busy waiting but it will exit after 5 seconds even if the player does nothing, you could stick a call to some subroutine to animate the door shaking slightly or something inside that loop so that time isn`t wasted with the cpu busy doing nothing..eg

repeat
shake_door()
untill ((timer()>t)or(spacekey()))

when asking for input don`t ask people to type in huge replies, in a long game they get very annoying, and it irritates people when they type "opem door" by accident and then have to type it all over again because the program can`t understand they meant "open door", there are two common ways to make a program more useable

(a) use lines like
press 1 to open door
press 2 to hide under sofa
press 3 to run away screaming

then all you have to do is check for a string that contains "1","2" or "3", no chance of typing errors and the game can run a lot faster, wrong keypresses can get a random message like "you can`t do that!" or "wrong key...please press 1,2 or 3"

(b) use cut down words, tell the user that only have to type the first two letters of every reply, this means you will have to take some care when you chose the replies so that there is no confusion, then you need to use a simple string function to get the rightmost two letters of each reply, so

open door becomes op
hide under sofa becomes hi
run away screaming becomes ru

the commands you would use are
reply$=left$(reply$,2)
reply$=upper$(reply$)

this would give you the first two letters of replystring and make sure they where uppercase, so even if they typed the whole reply as long as they go the first two letters right the program will understand em.

if you want typed replies then you should make sure they are all upper or lower case since you have no way of knowing if the user has pressed caps lock or held shift down or used a capital 1st letter etc, this make it easier to decode the replies since you only have to check if the reply was

OP

rather than all the possible combinations

Op
oP
op
OP


waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 6th Aug 2005 18:12 Edited at: 6th Aug 2005 18:14
try structuring your code better, and then everything will just click. Here is an example of what I mean:



that should give you lots of ideas.
Atari88
19
Years of Service
User Offline
Joined: 6th Aug 2005
Location:
Posted: 7th Aug 2005 07:59
this will help alot but a problem with the first post.my door image is just that a small bitmap of a door it doesnt fill screen so it wont paste over the old text...or will it and that also means that the image wont be present while the first dialog is printing
example
sync on
sync rate 40
load image "door1.gif"

paste image "door1.gif"
print "you wake cold and stiff facing a door"
wait key
cls
sync
paste image "doorcloser.gif"
print "you get up and move closer to the door"
cls
sync
paste image "doorcloser.gif"
print "you notice stange markings and an etched face on the door"
cls
sync
paste image "weirdsym.gif"
print you look closely at markings

.................................................................
ect

should i just exclude the cls comand what if my image doesnt cover whole page what if the image doesnt cover the old text
ill try each of your solutions but typing paste image "whole freaking file name" would realy get old but if its the only way ill do it ive also thought of making all my image comands in to subs like go sub pic1
pic1:
paste image blah

then from there make it return to were it left off.
im still not sur what to do i want the solution that involves the least typing

"A lesson in life is to always surpass what is thought impossible.Never hesitate. up it another notch push back the boundries that hem you and refuse to fail."
-Clay Gilmer

Login to post a reply

Server time is: 2025-05-23 04:38:54
Your offset time is: 2025-05-23 04:38:54