Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - EnterTheStory (aka tolworthy)

#281
I call the first function, then change games twice using RunAGSGame, then call the second function. And I get this error message:
in misc code (line 1473)
Error: FileReadInt: File read back in wrong order
Any idea what's wrong?
And why line 1473 is any different from the others?

(Global.Get and Global.Gets are from the DeNGVaT module. They call an int or a string. None of them have been set before this code is run. If DeNGVaT calls a variable that does not exist, the variable is created.)

Code: ags

function write_between_games() 
{	File	*output;
	int	i;		int	status;		int myInt;
	String str;
	output = File.Open("between games.dat", eFileWrite);
	if (output==null)	status = false;			// Open file
	else 
	{	status = true;											// Write data
		str =Global.Gets("rightClickedObject");				output.WriteString(str);
		str =Global.Gets("rightClickedObjectRoom");		output.WriteString(str);
		str =Global.Gets("cutscene_waiting");					output.WriteString(str);
		myInt =Global.Get("rightClickedObjectPerson");output.WriteInt(myInt);
		myInt =Global.Get("rightClickedPerson");			output.WriteInt(myInt);
		myInt =Global.Get("rightClickedPersonRoom");	output.WriteInt(myInt);
		myInt =Global.Get("rightClickedPersonX");			output.WriteInt(myInt);
		str 	=Global.Gets("rightClickedPersonGame");	output.WriteString(str);
		output.Close();
	}
	return status;
}
function read_between_games() 
{	File	*input;
	int	i;		int	status;		int myInt;
	String str;
	input = File.Open("between games.dat", eFileRead);
	if (input==null)	status = false;			// open file
	else 																	// Read data				
	{	status = true;
		if(input.EOF)return; str	= input.ReadStringBack(); Global.Sets("rightClickedObject",str);			
		if(input.EOF)return; str	= input.ReadStringBack(); Global.Sets("rightClickedObjectRoom",str);	
		if(input.EOF)return; str	= input.ReadStringBack(); Global.Sets("cutscene_waiting",str);				
		if(input.EOF)return; str	= input.ReadStringBack();																				
		if(input.EOF)return; myInt = input.ReadInt();      Global.Set("rightClickedObjectPerson",myInt);				
		if(input.EOF)return; myInt = input.ReadInt();      Global.Set("rightClickedPerson",myInt);		
		if(input.EOF)return; myInt = input.ReadInt();      Global.Set("rightClickedPersonRoom",myInt);
		if(input.EOF)return; myInt = input.ReadInt();      Global.Set("rightClickedPersonX",myInt);		// line 1473
		if(input.EOF)return; str	= input.ReadStringBack(); Global.Sets("rightClickedPersonGame",str);
						if(testmode) Display("right clicked person is '%d', RightClickObject is '%s'",Global.Get("rightClickedPerson"),Global.Gets("rightClickedObject"));
		input.Close();	
	}
	return status;
}

Taking a cue from the error message, I tried reading back the lines in the opposite order, but got the same error message from the same line, 'rightClickedPersonX'. Any suggestions?
#282
Quote from: SSH on Tue 15/04/2008 17:20:48
27 hour response too slow for you, eh?
Last time you replied in 27 MINUTES! I thought you must be dead or in hospital or something. Really, I was beginning to wonder why I pay you that generous salary for 24/7 service.

Seriously though, thanks for the idea. I'm just being lazy. DeNGVaT is the by far the most useful thing to ever be added to AGS, and I am forever in your debt.
#283
Quote from: tolworthy on Mon 14/04/2008 14:50:15
Hi SSH! Is there a simple way to copy ALL the variables saved by Global.Gets() and Global.Get() ?
I'll take that as a "no" then. Oh well, guess I'll do it the long way.
#284
Hi SSH! Is there a simple way to copy ALL the variables saved by Global.Gets() and Global.Get() ?

I'm writing a function to save data to a file between games. I don't want to just use "savegame" because I only want specific things. But one of things I want is globals saved through DeNGVaT. I could just run through all the variables I might have made, but it would be MUCH easier to just globally save them all to an array, then read that array back when the game is loaded again.

Is that possible?
#285
Does anyone know what happened to minigame? It looks like exactly what I need, but none of the links on this page seem to work.

Edit: ah, it appears that the demoquest game has it all.
#286
A real live mod is still using 2.62? That makes me feel better. :) Thanks for all the replies!
#287
Now that 3.x has bedded in, how many of us are still using 2.7x with no immediate plans to change? I ask because I don't want to keep posting questions about a release that is no loger supported.

I wish I could upgrade, but for me, Linux compatibility is very important, so 3.0 is not an option. Even if a Linux port is made, I'll probably still be with 2.7x forever, since my game is being released in separate sections that link using RunAGSGame. Are any other developers committed to 2.7x?

Apologies if this is the wrong forum (or has been discussed before) but I couldn't find this particular question on recent threads.
#288
Quote from: Radiant on Thu 03/04/2008 10:07:31I've seen too many LucasArts fangames that simply rehash and copy/paste the plot of the original; so I'll reserve judgment on this until I've played it.
I haven't played it yet, but I've been in contact with the team leader for some time (I run the Zak McKracken archive) and this is will definitely be something special. Not just seven years in production, but the original talent came from the original Zak fan game (the one that's been in development since 1996 and still isn't ready). Marvel, who runs the new game, has put a LOT of work into this, including a major overhaul a few years back, a visit to the USA to meet the original creators, featuring the game on German TV, getting the developers to wear Zak T-Shirts, etc. I'm only guessing here, but I assume he's doing this as a way to get into the industry.

My only worry is that it's such a big deal it's bound to attract the attention of LucasArts. But hopefully they'll turn a blind eye since Zak is not a high profile brand like Monkey Island or Indiana Jones.
#289
Contains, eh? Now there's an idea. Thanks.

I take it there's no performance hit with adding another long string? I don't know how AGS compares strings, but I have a vague recollection that checking character by character can be CPU intensive. Of course, I'm maybe thinking back to the days of the 286 here... :)
#290
Thanks. My reason for asking is I have over 600 items that can be clicked on, and I'm writing the dialogue for each. Multiply those 600 by up to 200 different characters, and the task becomes a little crazy! So I'm grouping similar objects together, e.g.
Code: ags

if((what="house")||(what="big house")||(what="small house")||(what="home")||(what="apartment")||(what="hovel")||(what="yellow house")||(what="building with two bedrooms")||(what="cosy cottage")||etc., etc., etc.)
character[who].Say("What a nice house.");

From what you say it should not matter if my lists get a little but long. :)
Thanks again.
#291
If there a maximum number of && and || in an if statement? And what about using brackets? For example, if I was to write this, would it work? I'm not planning to (yet!) but I like to know how far I can push the envelope...
Code: ags

if((((A==1)&&(B==2))||((C!=3)&&(D!=-4))||E)||F||G||(H>I)||(J<=K)||((M&&N&&O&&!P)||(Q+1==R))||(S==null)||(bla(T))||U||V||(W&&X&&!Z)){Display("whew!");}
#292
Thanks - I'll do that.

Edit:
Now I understand! Modules come first, then the global script, then the rooms. This import and export malarky finally makes sense to me. :)

Thanks again
#293
Can someone clarify where variables can be imported and exported?

//this is declared near the top of the global script:
int name[300];
String name2[300];
int name3[300];

//this is at the bottom of the global script:
export name[300];
export name2[300];
export name3[300];

// this is imported in the script header
import int name[300];
import String name2[300];
import int name3[300];

// this is called in a module:
if(name2[n] == "bla bla bla"){}

This compiles happily. But when I run the game I get:
" Script link failed: Runtime error: unresolved import 'name2' "

So I imported it in the module header instead: same result.

I searched the forums, and found the following advice:
"You can only export a variable from the global script"
and
"You need to export the variable in the one place where it is declared, which should be the first script in the order in which scripts are listed. The global script is usually the last script."

Now I am more confused! Is the global script compiled after the other modules? Should variables be declared and exported earlier then? Am I getting rooms and modules confused? Or is my real problem that I'm trying to export an array of String? Any advice would be appreciated.
#294
Quote from: SSH on Thu 27/03/2008 09:57:36
Yes, arrays of Strings work. And they work by magic ;)

Its actually an array of pointers to dynamically allocated areas on the heap. But that is made transparent to AGS scripters...

Ah, magic. Now it all makes sense. I am guessing that these "pointers" you speak of are pointing sticks, the "heap" is the heap of entrails, and "transparent" refers to the fact that only the initiated can see these invisible spirits. Obviously Pumaman is a shaman (story teller whose avatar goes on spirit adventures) who takes on the form of a puma, thus forcing the spirits of the computer to obey him. I always suspected it would be something like that.
#295
Update: this thread was inspired by the help file in 2.72, which says you cannot have global arrays of strings. So I spent all day finding a way around this problem. Then discovered that the help file was really for 2.70, and in 2.72 you CAN have global arrays of Strings (witha  capital S).

Can someone confirm that this is true? I've tried it and it seems to work, but I hope I'm not doing something naughty, memory-wise.

While on the subject, how does an array of Strings actually work? I can understand an array of ints or bools, because the computer just sets aside one byte per variable. But if I declare an array of type String, and only add the Strings at runtime, how does the computer know how much space to set aside?
#296
Thanks for the suggestion.  I'll have a look at that.
#297
Quote from: dkh on Wed 26/03/2008 13:44:42
You can use it in both scripts and headers, just not in functions (if I remember correctly)

Thanks. If it can't be used in functions then I may have to dfind another solution to my particular need - the whole point was to create aliases automatically so I can refer meaningfully to strings in global arrays. But it might be useful for later, so it's worth remembering.

Thanks again.
#298
YES!

Can I use "define" at any place in the code, or just in a header?
Don't tell me, It's in the manual. :)
#299
Code: ags
[code]Character names are sometimes interpreted as integers, e.g.
[code] int i =EGO; 

will compile. Is it possible to manually define other strings as equal to integer values?

E.g. now:
Code: ags

runCutscene(278)
runCutscene(279)


Desired:
Code: ags

runCutscene(EGO_ENTERS)
runCutscene(STRANGE_THINGS_HAPPEN)


The 'runScene' code would convert to an integer, and other code would convert back, so I could happily type names, but know that I could pass them to global integer arrays. I've tried workarounds - such as writing hundreds of seperate functions, or adding extra arguments, but they end up ugly and awkward. I'd prefer to just use integers with meaningful names. Is it possible?[/code][/code]
#300
Thanks for the suggestion regarding moving rooms when testing. I'll have to try that.


Quote from: Radiant on Wed 26/03/2008 11:38:55
you may be able to work around the limits by re-using characters, or making more use out of the fact that a view can have 16 loops.
That's how I got into the mess in the first place! :)
I anticipated the need for extra views, so hid views in unused loops, and often renamed generic characters. But it made the code very hard to maintain. I could never find the character or view I wanted, and would accidentally leave "generic character 1" with the wrong loop, scaling, etc. I guess I'm just not good at multi-tasking. I finally discovered that I code much more quickly if every character has its own name, and every change has its own view.  So when I want a character I just refer to that character and know it will look right.

The one cost is that I have added new characters throughout the project, and have to scroll up and down to find the exact character or view that I want. For the next sub-game I'm going to put all the strangers together, all the bystanders together, all the soldiers together, and so on.

Quote from: Radiant on Wed 26/03/2008 11:38:55I wonder how large a percentage of people actually use dialup these days
My story consultant (and principle beta tester) does. My game is aimed at people who like books more than they like computers. These people are the last to want (or care for) broadband. True, they are a minority, but I am aiming at minorities.

Also, I plan to release a new story every six months for at least ten years. And encourage other people to add their own modded versions. I just don't see this as feasible unless it's modular.

Quote from: Radiant on Wed 26/03/2008 11:38:55
the several games you suggest creating would have overlapping parts (i.e. any shared rooms and characters) which would then have to be downloaded twice
True, but the common parts are much less than one quarter of the whole. And there will be slight variations between each game. No rooms are shared, and the avatar is invisible. I'm always open to new ideas (I'm still learning!) but for a project this size, modular seems to be the only way to go.
SMF spam blocked by CleanTalk