can't save - got myself in a pickle!

psymann
10 May 2013, 01:05
Not sure if this is possible to answer without me posting a ton of code - perhaps someone might know how I could go about finding the error here?

The game works ok, but when I try to "save", it gives me a Save As... dialogue box, and I enter a name for it, and then it gives me the following error message:


Unable to save the file due to the following error:
Invalid variable name '' in '='



Any idea where I should start with trying to locate that issue? Doubtless I've got too adventurous somewhere with trying to do things with code instead of GUI... I knew that was going to end in tears! :-(

psy

Liam315
10 May 2013, 03:26
I'd just go into code view for the whole game, press ctrl + F to bring up the search box and try to search for it. Since it's invalid it should hopefully be unique enough to locate easily.

jaynabonne
10 May 2013, 09:02
If you want another pair of eyes, feel free to send the game file(s) to me in a PM or email (as opposed to public posting).

psymann
10 May 2013, 11:55
I tried Code and Ctrl-F, but the problem is I don't really know what I'm looking for.

I seem to have a variable called '' (ie with no name - and I can't search on nothing)
In a object?function?template?command? called '=' (and I can't search on just an equals sign as there are hundreds of the things in the code)


If it said I have a problem with "variable 'Sheep'" in "room 'Ocean'", then I'd have something I can search on. But with nothing in an equals sign, it's a bit tricky!


My next plan is to save a backup copy of my file, and then delete rooms one-by-one until it lets me save it ... hopefully by doing that I can narrow down where I have to search ;-)

If that fails, I may have to take jay's offer up! :oops:

psy

guzmere
10 May 2013, 14:11
Hi Psy if you really want to go through that route of deleting rooms then why don't you delete one room then if that doesn't work then press control Z and it should bring back that room. (I think) And then try another till you find the correct room. At least you won't have that headache. Terry :D Happy Adventuring :D
P. S. Always save save save. Oh and by the way did I mention about saving lol. Best of luck.

jaynabonne
10 May 2013, 14:19
Some further thoughts. Keep in mind that I'm only guessing based on my experiences:

1) Is this saving in the desktop version or the web one?

2) You are able to load and run the game correctly, so it seems like it wouldn't be an improperly named object (as that would hit on load or run). So I *suspect* that something in code is causing the creation of an invalid state. (But I could be wrong. :) )

3) Does it fail if you try to save right away when you run it? Or does it only fail after a certain point? If it's the latter, then you can try to narrow down what code exactly is causing the problem.

4) At the point where a save would fail, bring up the debugger window and see if any object has an odd name.

HegemonKhan
11 May 2013, 04:24
if you don't have this already, DL this (notepad++, see below for the link), open it up and copy-n-paste your code into it, then at the top of it, select the "language" drop down choice, and choose "XML", this helps with reading code, as it's all color coded for you, making it so much easier to spot mistakes in your code.

http://notepad-plus-plus.org/download/v6.3.3.html

enjoy, this is really great for writing in your own quest code too, as well as good for anything else (non-quest stuff) too !!

-------------

P.S.

if you don't mind, you can also pm your code to me too, I'm pretty good at finding mistakes, due to being very meticuous and methodical. I've spotted some really obscenely obscure mistakes already in some other peoples' quest codes, so I've got some success stories, as well as having successfully trouble shoot my own combat code, into finally getting it to actually work, that was NOT easy, as I had so many mistakes, it was a very extensive trouble shooting, especially for me, who's still a noob with coding. Unless jaynebonne wants to do it all him/her-self, laughs. Two eyes are better than one, err, 4 eyes are better than 2, I should say, hehe.

------------

P.S.S.

Some mistakes that I make all the time, which screw up my code (uber small simple typo-forgetting mistakes, but trying to find them are ... ARGH! laughs):

<blah blah="blah" {missing the ">" mark}
(blah blah blah)
</blah>

<blah blah="blah">blah<blah> {missing the "/" mark on the ending blah}
~OR~
<blah blah="blah">
(blah blah blah)
<blah> {missing the "/" mark}

<blah blah=blah>blah</blah> {missing the " " marks after the = sign}

guzmere
11 May 2013, 07:32
Thanks HK that is a brilliant tip, I've never used notepad only edit pad. And I never knew about the XML, it even lets you know if you have a spelling mistooke lol. That's really handy. Once again many thanks :D Happy Adventuring :D Terry

psymann
13 May 2013, 12:45
Good ideas, thanks all - I was sort of hoping there was a magic "oh, it's obvious, just click there!" sort of answer, but since not, I've spent a bit of time going through and deleting things until it started saving again. (it was failing to save right at the start of the game)

jay:
1) desktop
2) you're right, it wasn't an object
3) right away
4) all objects named correctly


Turned out it was something I did a month ago and then didn't use, and left lying around in case I wanted it...

I'd made a 'timer' in the timers section, which I'd forgotten was there at all, and I'd half-filled it with code of what to do after a certain number of seconds. Since the timer isn't ever called by the adventure, it never causes a gameplay issue. But what I had was some lines, in GUI format, where I'd put:


Set Variable [ ] = expression [ ]


(Where [ ] was an empty box)

I never got round to deciding what variable I was going to set to what, and since I then never implemented it, I forgot all about it!

And although it looks like a nice line of half-way-through-writing-some-code on the GUI, the actual code for "Set Variable [ ] = expression [ ]" is just "=". ;-)

What a wally, eh!

psy

jaynabonne
13 May 2013, 13:31
Thanks for the update. Time to file that one away for any future similar problems... :)