AGS v2.7 Refresh 2 now released!

Started by Pumaman, Mon 02/05/2005 18:56:18

Previous topic - Next topic

SSH

Quote from: monkey_05_06 on Tue 07/06/2005 17:46:00
Did you catch that?  I used the name of a previously declared struct as the name of a data member.  And it compiled.  Perhaps it's just me, but that doesn't seem right...

I think its normal that that is allowed. MyOtherStruct.MyStruct is unambiguously an int.

Quote
Also, has function always been an optional word instead of defining the return type (i.e., I was just thinking about it, in the manual the return types of functions like GetAtScreenXY are listed instead of "static function", and when testing it, I found out I can do it too!)?  Or is this something that slipped through the cracks by accident?

If you look through the AGS editor files with a text editor, you can find the sekrit builtin header, including the giveaway line:

#define function int
12

Pumaman

QuoteDid you catch that?  I used the name of a previously declared struct as the name of a data member.  And it compiled.  Perhaps it's just me, but that doesn't seem right...

Because struct members are always accessed with a dot, you'll probably get away with it. Interesting point though, I'm not sure whether that should be made illegal.

QuoteAlso, has function always been an optional word instead of defining the return type (i.e., I was just thinking about it, in the manual the return types of functions like GetAtScreenXY are listed instead of "static function", and when testing it, I found out I can do it too!)?  Or is this something that slipped through the cracks by accident?

As SSH says, function = int. It's the default return type.

QuoteEdit:  Also, when playing a video in WMP, I have found that I have a GUI background image which is partially replaced by the video (where ever the video is at behind a certain color in the GUI, it gets replaced by the video...

Yes, when playing a video overlay DirectX selects one particular colour as the overlay colour, and the graphics card overlays the video onto any parts of the screen with that colour. Nothing AGS can really do about it.

monkey0506

Thanks for the help.  As for the struct name as a data member, the reason that I thought it shouldn't work is because if struct within struct support is ever supported then the name of the struct that you're trying to use as the name of a data member would be interpreted as a variable type.

I figured it would be equivalent to me typing something like:

struct StructType {
  char int[200];
  };

Not ambiguous, but I don't think it should work.

edmundito

Hey, can I actually put those optional parameters into my own methods/functions? I couldn't find it in the manual.
The Tween Module now supports AGS 3.6.0!

strazer

Yes. In the function import definition, simply set a default value to the variable like this:

Code: ags

// main script

function DoSomething(int vara, int varb) {
  // do something
}


Code: ags

// script header

import function DoSomething(int vara, int varb=3); // varb will be optional

edmundito

Thanks!

Now, more questions:

How many modules can you have in a single game? And from the  global script can I access the functions inside the modules? Or must they be imported in the module header first?
The Tween Module now supports AGS 3.6.0!

strazer

They must be imported into the module header to be accessible outside the module.

edmundito

Thanks!

I'm making sure that I don't try anything dumb first.  :=
The Tween Module now supports AGS 3.6.0!

edmundito

Oh no! I found a typo on ags-help!

In the section "Upgrading AGS 2.7", under "Is there anything I should watch out for?", there is a link to a seperate page... (it should be spelled separate, btw  ;)). Same on this page: http://www.adventuregamestudio.co.uk/manual/UpgradingTo27.htm

And another thing, I can't find on the index or the search page for the section on structs, if there is one.
The Tween Module now supports AGS 3.6.0!

strazer

Quote from: Pumaman on Tue 24/05/2005 19:33:48
(...) structs (and therefore inheritance) are unofficial features and so are not documented.

edmundito

But structs are the best thing that happened to AGS since sliced bread!  :=
The Tween Module now supports AGS 3.6.0!

GarageGothic

#71
I agree with netmonkey that structs rock. How about an unofficial documentation? ;)

Edit: Actually, I would like a better documentation of some features. They may seem obvious to C++ programmers, but I don't believer neither "bool" nor "define" are listed in the manual. I don't know what other there are.

SMF spam blocked by CleanTalk