Qbasicnews.com
July 04, 2020, 08:55:36 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: starting over doesnt clear variables???  (Read 3171 times)
MNDRBNDR
Member
*
Posts: 46



« on: February 16, 2005, 12:47:09 PM »

in my program i have the option "new" so if the user selects this option i tell it to goto start: which is the veryfirst command in the program, when you veryfirst run the program everything works fine but when i tell it "new" to start over i get a semi blank page my game piece is there and the enemy piece is there but i dont have my walls or nothing but shouldnt it be there if essentially the program is starting over again?
Logged

o live is to die, to die is to expel, to expel is to exist is to live without knowing to be
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #1 on: February 16, 2005, 01:32:28 PM »

hmmmm let's see the code.
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
Joakim
Senior Member
**
Posts: 230



WWW
« Reply #2 on: February 16, 2005, 02:05:24 PM »

if your program looks anything like this:

start:
dim x as integer
dim y as integer
...
if something then goto start
...

Then no, it won't (and shouldn't) clear those variables. What you could do is to use run to restart the program (RUN "filename.bas") where filename.bas is the filename of your program, but it's a hack and you'd be better off just clearing the variables you need to clear manually.
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #3 on: February 16, 2005, 02:49:15 PM »

CLEAR
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Frenkel
Member
*
Posts: 26



WWW
« Reply #4 on: February 16, 2005, 03:37:40 PM »

You should initialise your variables every time.
Logged

roeten van Frenkel
Visit us at The Official S&F PROD. Homepage
Sterling Christensen
Na_th_an
*****
Posts: 1328


« Reply #5 on: February 16, 2005, 03:50:44 PM »

Quote from: "na_th_an"

Doesn't do the same thing in FB.
Logged
adosorken
*/-\*
*****
Posts: 3655



WWW
« Reply #6 on: February 16, 2005, 03:57:50 PM »

Just because you tell the program to go to a label at the beginning of a program doesn't mean it's going to automagically reset all its variables. All you're doing is redirecting program flow.
Logged

I'd knock on wood, but my desk is particle board.
MNDRBNDR
Member
*
Posts: 46



« Reply #7 on: February 16, 2005, 04:19:38 PM »

i did as joakim said and just simply ran the program over and it fixed my problem im still in the disign stage of my game but i will post my code if more wish to view it
Logged

o live is to die, to die is to expel, to expel is to exist is to live without knowing to be
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!