Weird problem restoring data

BlitzPlus Forums/BlitzPlus Programming/Weird problem restoring data

DrMartin(Posted 2003) [#1]
Hey everybody

In my code I have two labels, we can call them .Label1 and .Label2. After each label is a data statement. I first use restore label1, then read a bunch of data. Then I restore label2 and restore another bunch. The problem is I always get the data from the FIRST data statement. So I get the data from label1 both times. If I swap label1 and label2 I get the data from label2 both times. I just can't figure out what the heck this is?! Any ideas?

Happy holidays!
--
Martin Gunnarsson


GfK(Posted 2003) [#2]
Maybe its something you're doing wrong?

This works:
Restore label2
Read A$
DebugLog A$

Restore label1
Read B$
DebugLog B$
WaitKey
End


.label1
Data "Label1"

.label2
Data "Label2"



DrMartin(Posted 2003) [#3]
That code works for me as well, but if I do the same thing in my own code, I still get the same data both times. This is so weird!


GfK(Posted 2003) [#4]
Maybe you should post some/all of your code...


DrMartin(Posted 2003) [#5]
The code is huge. Here are the exact conditions:
The two labels are at the bottom of the code, one is named creditsdata, the other helpdata. They are both built in this format: n,string,string,string... where n is the number of strings.
I restore the labels from within two separate functions, but I get the same result if I restore them in the same function.
I guess that's all there is to say about that.


WolRon(Posted 2003) [#6]
You aren't making any sense.

You state you have two labels (named creditsdata and helpdata)

Then you state that they are both built in ...

What are you talking about? You don't 'build' a label
Labels' syntax is: .label (period, followed by alphanumeric identifier that must start with a letter)

It sounds like you are confusing labels with data statements.


DrMartin(Posted 2003) [#7]
Yes, of course I am. I mean the data statements consists of a number and then strings. Sorry.


WolRon(Posted 2003) [#8]
You really should post the relevant parts of your code. It's probably something obvious.


DrMartin(Posted 2003) [#9]
OK, sure.

In my function:
Restore .CreditData
Read credlines

Restore .HelpData
Read helplines


Labels:
.CreditData
Data 3,"Credittest","","Credittest"

.HelpData
Data 2,"Helptest","Helptest"


GfK(Posted 2003) [#10]
When you're using the Restore command, you don't put the "." with the label. You only do that when you're defining labels. Could that be the problem I wonder?

(I'm guessing here - don't have Blitzplus installed any more)


Mental Image(Posted 2003) [#11]
yep, that's the problem. Because it doesn't understand the label with the period in front of it, it just restores to the first set of data.


DrMartin(Posted 2003) [#12]
Oh really, I gotta try that right away.


DrMartin(Posted 2003) [#13]
Great, it worked!
Thanks a lot, and merry christmas!


Hansie(Posted 2003) [#14]
The forum again proves is excellent help :-D