Author Topic: AGS v2.7 Refresh 2 now released!  (Read 35384 times)  Share 

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    •  
  • SSH worked on a game that was nominated for an AGS Award!
Re: AGS v2.7 Refresh 2 now released!
« Reply #60 on: 10 Jun 2005, 09:25 »
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

Pumaman

  • Creator of AGS
  • Administrator
  • Mittens TRAITOR
  • I sense danger.
    • Lifetime Achievement Award Winner
    •  
Re: AGS v2.7 Refresh 2 now released!
« Reply #61 on: 11 Jun 2005, 18:38 »
Quote
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...

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.

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?

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

Quote
Edit:  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.

monkey_05_06

  • AGS Project Admins
  • Has left the building.
Re: AGS v2.7 Refresh 2 now released!
« Reply #62 on: 11 Jun 2005, 20:30 »
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.
Let's be honest. Most people suck at coding. I suck at coding, but at least my code is readable. To Hell with anyone too lazy to maintain consistent formatting in their code. I could deal with bad interfaces and structure if I could even read your horrible code. And that's putting it nicely. -monkey

Edmundito

  • Mittens Serf
  • That old Greek sailor formerly known as netmonkey.
    • I can help with AGS tutoring
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with web design
    •  
  • Edmundito worked on a game that was nominated for an AGS Award!
Re: AGS v2.7 Refresh 2 now released!
« Reply #63 on: 14 Jun 2005, 21:06 »
Hey, can I actually put those optional parameters into my own methods/functions? I couldn't find it in the manual.

Re: AGS v2.7 Refresh 2 now released!
« Reply #64 on: 15 Jun 2005, 13:54 »
Yes. In the function import definition, simply set a default value to the variable like this:

[code]
// main script

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

[code]
// script header

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

Edmundito

  • Mittens Serf
  • That old Greek sailor formerly known as netmonkey.
    • I can help with AGS tutoring
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with web design
    •  
  • Edmundito worked on a game that was nominated for an AGS Award!
Re: AGS v2.7 Refresh 2 now released!
« Reply #65 on: 16 Jun 2005, 22:38 »
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?

Re: AGS v2.7 Refresh 2 now released!
« Reply #66 on: 16 Jun 2005, 22:56 »
They must be imported into the module header to be accessible outside the module.

Edmundito

  • Mittens Serf
  • That old Greek sailor formerly known as netmonkey.
    • I can help with AGS tutoring
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with web design
    •  
  • Edmundito worked on a game that was nominated for an AGS Award!
Re: AGS v2.7 Refresh 2 now released!
« Reply #67 on: 17 Jun 2005, 00:39 »
Thanks!

I'm making sure that I don't try anything dumb first.  :=

Edmundito

  • Mittens Serf
  • That old Greek sailor formerly known as netmonkey.
    • I can help with AGS tutoring
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with web design
    •  
  • Edmundito worked on a game that was nominated for an AGS Award!
Re: AGS v2.7 Refresh 2 now released!
« Reply #68 on: 17 Jun 2005, 19:31 »
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.bigbluecup.com/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.

Re: AGS v2.7 Refresh 2 now released!
« Reply #69 on: 17 Jun 2005, 19:43 »
(...) structs (and therefore inheritance) are unofficial features and so are not documented.

Edmundito

  • Mittens Serf
  • That old Greek sailor formerly known as netmonkey.
    • I can help with AGS tutoring
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with web design
    •  
  • Edmundito worked on a game that was nominated for an AGS Award!
Re: AGS v2.7 Refresh 2 now released!
« Reply #70 on: 18 Jun 2005, 17:20 »
But structs are the best thing that happened to AGS since sliced bread!  :=

Re: AGS v2.7 Refresh 2 now released!
« Reply #71 on: 20 Jun 2005, 12:17 »
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.
« Last Edit: 24 Jun 2005, 09:04 by GarageGothic »