Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Phemar on Sat 22/05/2004 06:35:12

Title: Script Gone...
Post by: Phemar on Sat 22/05/2004 06:35:12

Please...help me. This be my last desperate plea for help...

Today...I opened up my game. I wanted to edit the GUI. So I pressed [ctrl]+[G] to open the Global Script. I looked.

I looked again.

I looked again.

I looked yet again.

My script was not there. Gone. Wiped off the face of the Earth.

Be there not a way to revive the Script?

Anyone? You must understand how desperate I am...That is alot of work to rewrite...

PLEASE! I AM FLIPPIN TELLIN YOU THERE BETTER BE A WAY OR ELSE!

I am using AGS Beta...So maybe?
Title: Re: Script Gone...
Post by: Hollister Man on Sat 22/05/2004 17:43:32
You mentioned you were using a beta version?  Well, then restore from your backup. ;)  If you didn't back it up, then you'll have to wait for another bright idea from someone else.  (sorry for the sarcasm, it does really suck, but everyone's been warned)
Title: Re: Script Gone...
Post by: Pumaman on Sat 22/05/2004 19:07:16
When you say "gone", do you mean the script window was totally empty, or had it been replaced by the default global script?

Does your editor.dat file look intact and ok?
How much free disk space do you have?
Is your script header still working?
Title: Re: Script Gone...
Post by: Phemar on Sat 22/05/2004 19:35:18
Quote from: Pumaman on Sat 22/05/2004 19:07:16
When you say "gone", do you mean the script window was totally empty, or had it been replaced by the default global script?

Does your editor.dat file look intact and ok?
How much free disk space do you have?
Is your script header still working?


Totally wiped. Gone. Not a // left. The monster.

225 MB free...

I don't what the editor.dat file is supposed to look like, but it's still there, standing at a mere 5.80 KBs...

I don't know what you mean by script header...I can still type in more stuff, if that's what you mean...

Quote from: Hollister Man on Sat 22/05/2004 17:43:32
You mentioned you were using a beta version?  Well, then restore from your backup. ;)  If you didn't back it up, then you'll have to wait for another bright idea from someone else.  (sorry for the sarcasm, it does really suck, but everyone's been warned)

Call me what you may, but I am still deeply traumatised and upset by this incident. At night I fall alseep to the sound of my own screams, do you think I'm unhappy? Hm?

I did make a backup...but last week...so much has happened since then...Oh the pain. Don't make me think about it any more...please...
Title: Re: Script Gone...
Post by: Pumaman on Sat 22/05/2004 19:44:14
Did you get any errors or problems the last time you saved your game?

The global script shouldn't just suddenly disappear like that - are all your sprite folders intact? (they are also stored in the editor.dat)
Title: Re: Script Gone...
Post by: Phemar on Sun 23/05/2004 11:47:27
Quote from: Pumaman on Sat 22/05/2004 19:44:14
Did you get any errors or problems the last time you saved your game?

The global script shouldn't just suddenly disappear like that - are all your sprite folders intact? (they are also stored in the editor.dat)

All my sprites and folders and basically everything else is still intact...
Title: Re: Script Gone...
Post by: Pumaman on Sun 23/05/2004 17:32:26
I take it there's no possibility you accidentally did a Select All -> Delete in the script editor?

I've never had a report of this before, has anyone else ever had this happen?
Title: Re: Script Gone...
Post by: fred on Tue 11/01/2005 01:57:30
I've experienced loss of data from the global script (AGS version 2.62 final) too on several occasions, but never the whole thing. The script is about 6500 lines, and when this has happened, the script seems to have been simply cut at a random position (say, line 4912) - everything after that is gone, and sometimes there have been some strange characters instead. This has only happened when I used the Ctrl+T (Test game) option after exiting and saving the global script where I had just added new content. The game would try to compile, and I would get an error (do you want to fix this..?) and when the script re-opened for me to fix it, a huge chunk would be gone - always at the end of the script.
I haven't reported this earlier as I didn't see any pattern in the data-losses and I figured it had someting to do with me adding so much custom content to the global script (more than 200 custom functions and 720 arrayed custom ints so far). Its probably my own fault - but strange that part of the script is suddenly replaced by nonsense characters. I'll give a more thorough bug report if something similar happens again. But I'm sure limited disk space can be ruled out as a factor.
Title: Re: Script Gone...
Post by: Pumaman on Tue 11/01/2005 20:11:38
That's very odd. It shouldn't be anything to do with the size of the script -- AGS games like KQ2VGA have been produced with global scripts over 30000 lines and I haven't had any reports of this corruption happening.

Does it seem to be if you add a large chunk of code in one go? Does it only happen if a compile error occurs?
Title: Re: Script Gone...
Post by: fred on Tue 11/01/2005 20:53:07
I'm glad to hear long scripts aren't the problem, I was starting to think there may be some limit to script-sizes.
Btw, is there a limit to how many custom global variables you can use in a script? Or to the length of arrays?
I currently have:Ã, 
1 array of 80 ints
1 of 360 ints
3 of 100 ints
2 of 40 ints
They're all made globals with the header-/global script import-export statements.

Quote from: PumamanDoes it seem to be if you add a large chunk of code in one go?

I do believe that the script-corruption happened after I had addedÃ,  at least some code (don't remember how much), and possibly also after I had added new custom arrays of ints to be imported and exported.

Quote from: PumamanDoes it only happen if a compile error occurs?

Yes. Or maybe the compile error occured because a big chunk of the script was missing.
Title: Re: Script Gone...
Post by: Pumaman on Tue 11/01/2005 22:43:56
I'm rather concerned by this corruption... but it's very strange that nobody else has seen it. Do you remember if you switched away from the script editor and did some work in the main AGS Editor while the script editor was still open? If so, any ideas what you might have been doing?

QuoteBtw, is there a limit to how many custom global variables you can use in a script? Or to the length of arrays?

In 2.62, a single array cannot be bigger than 32 KB (that would be an int array of 8000). This limit will be removed in the next version.

Other than that, no, there's no limit on the amount of global data in the script.

QuoteYes. Or maybe the compile error occured because a big chunk of the script was missing.

Do you remember whether the compile error was on the line where the script was corrupt, or was it something earlier on in the script and unrelated?
Title: Re: Script Gone...
Post by: fred on Tue 11/01/2005 23:32:58
Quote from: PumamanI'm rather concerned by this corruption... but it's very strange that nobody else has seen it.

You shouldn't be too worried - the reason I haven't posted these corruptions is that I haven't been able to make sure they weren't just my own stupid mistakes - so don't be too concerned. If anything like it happens again I'll be sure to take note of everything I was doing and report it.

Quote from: PumamanDo you remember if you switched away from the script editor and did some work in the main AGS Editor while the script editor was still open? If so, any ideas what you might have been doing?

I don't remember if I switched away from the script while it was open, but it is likely. My game doesn't use Inventory Items, Global Messages, Dialogs, Text Parser or Lip sync - but I could've been working in any of the remaining branches of the Editor.

Quote from: PumamanDo you remember whether the compile error was on the line where the script was corrupt, or was it something earlier on in the script and unrelated?

I remember one occasion where the error pointed to the line where the corruption started, but I'm not sure where it pointed the other times.
Title: Re: Script Gone...
Post by: Pumaman on Wed 12/01/2005 19:18:59
Thanks for the info. Do let me know if it happens again.
Title: Re: Script Gone...
Post by: fred on Thu 27/01/2005 14:55:15
It happened again - I had been working on my script, closed and saved it, and when I triedÃ,  to "Test game", I got an error pointing to a certain line, where, as I discovered upon opening the script to edit it,Ã,  the script had been cut off, the last 3000 lines or so having been replaced by a few characters.

I had been going through the whole script, providing new ints for 104 calls to the DisplayAt()-function, using the Ctrl+F (subsequently F3) to find the cases: DisplayAt(135,75,118,"different messages"); and replacing them with DisplayAt(82,55,300,"same different messages"); The changes spanned app. 5000 script lines, and took place in maybe 30 different functions.
Note: I used Ctrl+v to paste the new integers (82,55,300) into the function after having deleted the old ones with <backspace>.

I found that if I closed down ags without saving changes, the script could be restored - so luckily there was no actual loss of code - only the changes weren't made. Still kinda scary to see my script gone like that. Do you think it's because of the "amount" of code changed, or could it be due to using Ctrl+v or Ctrl+f?
Title: Re: Script Gone...
Post by: Pumaman on Thu 27/01/2005 20:30:44
I'm stumped by this, I have to say. It's obvious that there's some memory corruption going on, but I've never experienced it and neither has anyone else reported it here before.

The Find and Paste features are both standard features of the Scintilla control that AGS uses, so I doubt there's a problem with them or it'd have been picked up very quickly.

I'm wondering if it's somehow linked to your game -- or have you seen the problem while editing different games? I don't really know what to suggest.

Slightly off topic, you could use a #define for those numbers so you don't have to repeat them hundreds of times around your script; but that doesn't change the fact that something strange is going on here.

Out of interest, did you use the Save And Exit command in the script editor, or did you close the window and select "Yes" from the "Do you want to save" dialog?
Title: Re: Script Gone...
Post by: fred on Fri 28/01/2005 08:05:04
QuoteOut of interest, did you use the Save And Exit command in the script editor, or did you close the window and select "Yes" from the "Do you want to save" dialog?

I used the Save And Exit command.

Quote...have you seen the problem while editing different games?

I've only seen theÃ,  problem while editing the current game.

Quoteyou could use a #define for those numbers so you don't have to repeat them hundreds of times

I'll try that now, although they only need to be changed once :-)

Guess we'll just have to wait and see if anyone else reports something like it. Also, it's not so important, because the script isn't really deleted if you don't save the corrupted script or game. (Of course I didn't know the first couple of times it happened).

Additional info: I'm running Windows XP (Professional Edition) with a Kerio Personal Firewall installed.
Title: Re: Script Gone...
Post by: Pumaman on Fri 28/01/2005 08:36:36
Are you writing your game in English, or might there be extended characters in the script? I'm clutching at straws now, but it's possible that attempting to use unicode characters of some sort could cause a problem.
Title: Re: Script Gone...
Post by: Radiant on Fri 28/01/2005 10:02:22
Actually the symptoms of files being cut off half-way through may be caused by a faulty hard drive, or simple logical errors in your file system. Have you run scandisk lately?
Title: Re: Script Gone...
Post by: Gilbert on Fri 28/01/2005 10:46:42
Also, faulty RAM can affect this, too. Try to config your BIOS so it doesn't do a "quick" test on the startup RAM test (if not already).
Title: Re: Script Gone...
Post by: fred on Fri 28/01/2005 12:10:24
Quote from: PumamanAre you writing your game in English, or might there be extended characters in the script? I'm clutching at straws now, but it's possible that attempting to use unicode characters of some sort could cause a problem.
The only characters I'm using that aren't listed in the ASCII-table in the Help-file , are the '+' and '-' characters (keycodes 43 and 45). They work just like they were intended to (catching keypresses from different GUIs).

Btw. I redid the replacement of the 104 DisplayAt()-function calls already mentioned, doing only 5-10 at a time between saving and testing the script, and now the game works fine - only doing them all in one go seemed to cause the corruption.

Quote from:  radiantActually the symptoms of files being cut off half-way through may be caused by a faulty hard drive, or simple logical errors in your file system. Have you run scandisk lately?
I think you might be right about this - I'll try running scandisk as soon as I'm done working.

Quote from: GilbotAlso, faulty RAM can affect this, too. Try to config your BIOS so it doesn't do a "quick" test on the startup RAM test (if not already).
I'm not sure how it's done, but I'll try it also.
Title: Re: Script Gone...
Post by: Pumaman on Fri 28/01/2005 20:05:57
QuoteAlso, faulty RAM can affect this, too. Try to config your BIOS so it doesn't do a "quick" test on the startup RAM test (if not already).

That's a possibility, actually. I've read reports of strange memory corruption happening if the RAM is faulty or if the CAS latency is set too low.

However, if this was the case I'd expect you to see other effects, not just in AGS.
Title: Re: Script Gone...
Post by: fred on Sun 30/01/2005 09:27:46
Sorry for the delay. I'm no shark at dealing with RAM, the BIOS or CAS latencies.

My computer has been generally unstable for some time, but I thought it natural because I use a lot of open source and not 100 % bug free programs. All crashes I've had, were related to those. (GIMP, VLC Media Player, faulty Photoshop).

I ran chkdsk several times with little result, and did a virus-scan that found nothing. I can't access the BIOS (Windows Help says BIOSÃ,  is now called EFI, and that it's invisible to the user). If the RAM or File System is faulty, would there be any way of fixing it without having to do a complete reinstall of Windows? (Hm... I guess this thread is going off topic).

Thank you guys for helping out, I think the problem can be isolated to my computer, and not AGS. Just weird that my computer functions normally in most situations, and then has these sudden caprices. At least I'm becoming a veteran at making back-ups of everything I work on ;-)
Title: Re: Script Gone...
Post by: Rui 'Trovatore' Pires on Sun 30/01/2005 11:33:37
BLAM!

I just lost a lot of code. It included a new property, for God's sake.

HOWEVER, when I did all this, my computer was particularly unstable, so it's more than likely that memory and whatnot is to blame.

Just thought I'd share.
Title: Re: Script Gone...
Post by: Pumaman on Sun 30/01/2005 14:57:28
redrum, care to elaborate on what happened more than just "BLAM"?

QuoteThank you guys for helping out, I think the problem can be isolated to my computer, and not AGS. Just weird that my computer functions normally in most situations, and then has these sudden caprices

It is strange though, and I'm not comfortable with just blaming your computer. However, I'm at a loss to suggest what else it could be.
Title: Re: Script Gone...
Post by: Rui 'Trovatore' Pires on Sun 30/01/2005 15:04:13
Heh. Sorry. But that's just it - BLAM. When I left it yesterday, I thought it was OK. Maybe even back then it was gone. But today when I thought to check it out, some more recently added code was gone, along with a new property I'd created and filled out for every object. And yes, it DID save them. I have some compiles to show it.

It might have to do with 2 things:

1) My PC was, as I've said, EXTREMELY faulty yesterday;

2) I decided, in my own the-devil-may-care fashion, to delete the Compiled folder and recompile. I don't remember why. This caused a problem when AGS started looking for a GAMEFILE.001 file, and soon enough AGS crashed on me. I have no idea whether the code was still there or already gone when I rebooted, though.

2) may very well be the cause of the problem... but it was my own stupidity, and I know it. If it's 1), then it's also kinda my fault. I guess that's why I didn't bother to really elaborate.
Title: Re: Script Gone...
Post by: Pumaman on Sun 30/01/2005 15:14:22
Ok, well let us know if you have any problems in future.
Title: Re: Script Gone...
Post by: Rui 'Trovatore' Pires on Sun 30/01/2005 15:50:45
Will do.