Miscellaneous observations

Started by After, Fri 12/12/2003 05:09:31

Previous topic - Next topic

After

Not worth individual posts, but I haven't found a worthwhile reason to mention them elsewhere.

(General, Win2k)
1) Many AGS games do not unload properly on exit - at least, not on my system. i.e. they remain as active tasks that don't do anything or respond to system messages.
It may be the legacy of earlier versions, or a common (but unnoticed) scripting error/conflict in the games, or just Windows up to its old tricks.
Someone needs to figure out why so that it can be addressed at whatever level the fault lies.

(AGS v2.56d)
2) Arithmetic has unconventional parsing:
a-b-c-d = a-(b-(c-d)))
a/b/c/d = a/(b/(c/d)))
It took me ages to debug an occurrence of the first case (if it had been the second, a DIV0! might have clued me in).

3) I'm still experimenting with types. It seems that some illegal (or misleading) code is accepted by the compiler even though it doesn't work.
So here is what I believe. Feel free to clear up any misconceptions:

I haven't done much with char or short, so I'll assume they have the same uses as int.

struct may only contain int and int array
array may only contain int

string can be passed (by reference), but not returned by functions.

neither struct nor array can be passed as parameters, returned by functions, or assigned directly. (Passing them by reference would be nice, though).

4) Can't block-comment #defines, and /*/ appears to be interpreted as /**/.

That's all for now.

Scorpiorus

Quote from: After on Fri 12/12/2003 05:09:311) Many AGS games do not unload properly on exit - at least, not on my system. i.e. they remain as active tasks that don't do anything or respond to system messages.
Yeah, some people were reporting the same with the AGS test game feature. It's obviously related to Win2k but doesn't happen for everybody. :P

QuoteArithmetic has unconventional parsing:
a-b-c-d = a-(b-(c-d)))
a/b/c/d = a/(b/(c/d)))
It took me ages to debug an occurrence of the first case (if it had been the second, a DIV0! might have clued me in).
AGS uses right to left associativity with the operators having the same priority level. btw, the unary -/+ seem to have the same level - the next:

a = -1 + 5

treated as -6

Quotestruct may only contain int and int array
yeah, strings are not supported withing structs. a workaround is declaring an array of char:
struct STRUCT {
char String[200]; // 200 is AGS string length
};

Quotearray may only contain int
char, short and struct as well. to declare a string array:

STRUCT Array [10];

Quotestring can be passed (by reference), but not returned by functions.
hmm, I remember to make the function return a reference to the string.

string f;
string ReturnString() {
return f;
}

Quoteneither struct nor array can be passed as parameters, returned by functions, or assigned directly. (Passing them by reference would be nice, though).
I usually declarre an array of structs and pass thier IDs instead; :P

QuoteCan't block-comment #defines, and /*/ appears to be interpreted as /**/.
// #define ... works well though


~Cheers

James Kay

Quote from: Scorpiorus on Fri 12/12/2003 15:40:50
Quote from: After on Fri 12/12/2003 05:09:311) Many AGS games do not unload properly on exit - at least, not on my system. i.e. they remain as active tasks that don't do anything or respond to system messages.
Yeah, some people were reporting the same with the AGS test game feature. It's obviously related to Win2k but doesn't happen for everybody. :P

Ah, this is the same proiblem I have been having, but I thought it was to do with the Japanese version of Windows XP Professional, which I am running.
So it's not unique to Win2k!

After

#3
Thanks, Scorpiorus.
Now that I'm clear on the rt-lf associativity, I'll save hours of redoing calculations in search of a non-existent error.

I figured that I was probably getting the reference, but didn't expect there to be any way of type-casting it back to string.


James Kay. I think the point is that it is confined to the Win2k-type systems, including XP.

Pumaman

Quote1) Many AGS games do not unload properly on exit - at least, not on my system. i.e. they remain as active tasks that don't do anything or respond to system messages.
It may be the legacy of earlier versions, or a common (but unnoticed) scripting error/conflict in the games, or just Windows up to its old tricks.

Hmm that's strange - I'm using Win2k and I've never had that problem. But you're right, it could be the same issue that causes the Test feature to fail (since if the engine isn't terminating properly, the editor wouldn't realise that it had finished).

Is there any common pattern to people who have this problem? Have you all got an Nvidia graphics card, for instance? Does it happen both windowed and full-screen? Does it happen for all games, or just some? If just some, is it consistent which games it happens with and which it doesn't?

Quote2) Arithmetic has unconventional parsing:
a-b-c-d = a-(b-(c-d)))
a/b/c/d = a/(b/(c/d)))

Yeah, this has been brought up before. I'd advise always using parenthesis so you can be sure what you're getting. It's too late to change the default behaviour now though, because some people's games now rely on it working this way.

QuoteIt seems that some illegal (or misleading) code is accepted by the compiler even though it doesn't work.
struct may only contain int and int array
array may only contain int
string can be passed (by reference), but not returned by functions.
neither struct nor array can be passed as parameters, returned by functions, or assigned directly. (Passing them by reference would be nice, though).

On the whole, you're correct. These are the reasons why structs and arrays are unofficial, unsupported features - because as you note, the compiler doesn't handle the various ways you can try to use them.

QuoteCan't block-comment #defines, and /*/ appears to be interpreted as /**/.

Hmm yeah, this is a bug, well spotted.

After

Quote from: Pumaman on Sun 14/12/2003 15:24:21
Is there any common pattern to people who have this problem? Have you all got an Nvidia graphics card, for instance? Does it happen both windowed and full-screen? Does it happen for all games, or just some? If just some, is it consistent which games it happens with and which it doesn't?
Unfortunately, I hadn't thought to keep tabs on which games do this, or whether it's repeatable, sorry. I'll watch for it in future though.
My system Win2k on AMD Duron with Trio3D/2X graphics.

Pumaman

Ok, thanks anyway. I've done a possible fix to the 2.6 Pre-Final version, but I can't test it myself since I've never had the problem. If there's anyone here who gets the problem consistently, could you try out the new version and see if it helps.

marcus

hi chris.
2) does sound kinda urgent.
couldnt you have all operation go from left-to-right unless something is defined (like _RIGHTTOLEFT or something) and have it automatically added into the script header in a game converted from an earlier version with a comment saying what it does?

Pumaman

While it is a bit counter-intuitive, it's not something I want to dive in and change because it's just the way the compiler works - there's no magical switch I can use to change its behaviour. Therefore, I'd rather just leave it as is to avoid the possibility of messing anything up for little gain.

After

The best thing would be for the documentation to make the user aware of this, loudly, since no-one is going to think to look up something this basic, believing that they know the rules already.

It's actually quite easy to use if one is familiar with stacks and postfix notation.

SMF spam blocked by CleanTalk