Posts: 46
Threads: 18
Joined: Jan 2005
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?
o live is to die, to die is to expel, to expel is to exist is to live without knowing to be
Posts: 2,765
Threads: 138
Joined: Nov 2002
hmmmm let's see the code.
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Posts: 122
Threads: 6
Joined: Feb 2002
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.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Posts: 26
Threads: 0
Joined: Jul 2004
You should initialise your variables every time.
Posts: 1,272
Threads: 36
Joined: Feb 2003
Quote:CLEAR
Doesn't do the same thing in FB.
Posts: 3,279
Threads: 170
Joined: Nov 2003
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.
I'd knock on wood, but my desk is particle board.
Posts: 46
Threads: 18
Joined: Jan 2005
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
o live is to die, to die is to expel, to expel is to exist is to live without knowing to be