AGS v2.7 Refresh 2 now released!

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

Previous topic - Next topic

Pumaman

Ok, Refresh 2 is now up which fixes the GUI Button bug that Ginny reported, as well as a couple of other things that came up.

Hopefully this should be really the final version this time.

QuoteAnyways, I have something of a bug to report.  It's very minor/trivial/not-really-that-important, but I figure I'll report it since it has been causing me some grief in trying to figure out what the problem was.  If the text displayed on a label has the exact width of the label, i.e. in the font I am using "Holy crap!  I can't believe it worked!  This is so friggin' awesome!" without the quotation marks has a width of 318 pixels.  This is also the width of my label.  The " awesome!" was flooded to a new line within the label which caused graphical errors.  Or perhaps this is considered a feature that when text has the exact width of the label the label floods the text.(?)..

Hmm, I kinda see your point -- but then, the label's wrapping behaviour is not specified and changing it now could have adverse affects on other people if their games expect this behaviour now.

monkey0506

#41
Okay. ;) I understand.  But I have a question:

Quote* Added simple inheritance support to structs, allowing you to create derived classes.

What inheritance is provided?  Other than basic types I don't seem to be able to include anything in a struct declaration unless the base struct is defined in one of the script headers preceeding the declaration of the derived struct...  I searched the manual for inheritance but it didn't return any topics...

Edit:  "I don't seem to be able to include anything in a struct declaration" -- Erm... I can include member function imports and protected data members and stuff as well, I meant that I can't use a custom defined data type within a struct (I know this has been discussed before, but the quote above raised some question in my mind and clarification as to its meaning would be appreciated). :)

Pumaman

Inheritance means this:

struct A {
  int a;
};

struct B extends A {
  int b;
};

It's not particularly useful since virtual functions aren't supported, but it might come in handy for the odd thing.

monkey0506

#43
I'll look into that.  I tried looking under inheritance but couldn't find anything in the manual.  And structs are only mentioned in one place (2.7 conversion thingy). :o



Edit:  Oops... :-[ I forgot what inheritance was... Got it confused with something else (obviously).

Pumaman

That's because structs (and therefore inheritance) are unofficial features and are so not documented.

monkey0506

So are you saying that they aren't "officially" supported?  Kind of like the way defining a struct in a header file allows you to create an item of that type within another struct?

Ozzie

Well, I found a strange bug and I suppose it's caused only in AGS 2.7 because I never had it with AGS 2.62.

Well, it's actually a simple problem, I have 4 objects in my room, but only two show up! I can do what I want, delete all the script that is concerned about the objects, didn't work, deleted all the objects and created them again, it was still there. Even more strange is that it were always the same objects, more precisely, only the same pictures, because the objects numbers were different the next time.

Then I just created a new room with everything the same, the same background and objects, and it worked.

Oh, I forgot to say, "object is initially visible" is on.

I would just use the new room, but I don't want to draw the walkbehinds again....it was quite some work!
Robot Porno,   Uh   Uh!

Pumaman

Are you sure you don't have any script commands which are turning the objects off?

Ozzie

#48
Yes, I'm very sure because I deleted every possible command in that room!!

Edit: I'm going to draw a new walkbehind, don't know how to continue else with the game. At least you know of the problem!
Robot Porno,   Uh   Uh!

monkey0506

I found a problem in the manual...An entry appears to have been cut short:

QuoteCalling global functions from local scripts
You can now call your global script functions directly from your rooms. This means that if you have a common script that you want to use in response to various different events during the game, you can call it from your room scripts rather than duplicating code.
To use a global function, open up the main script header (the "Edit script header" option on the Game menu), and add a line similar to the following:

import function my_function_name (parameters);

Where my_function_name is the name of the global script function, and parameters is a list of the TYPES ONLY of the parameters it takes. For example, if you had in your global script:
function do_animation (int anim_number) {

then you would write:
import function do_animation (int);

To use the function, you just call it normally in your script, eg:
do_animation (3);

You can also return a value to the caller by using the "return" statement, and the local script picks this up the same way it does with built-in functions. For example, the end of your global script function could be:
return 51;

then the local script just does:

That's all it says.  I searched for "return value" because I was trying to figure out if returning a string is possible* when I came across this.

*I had previously thought this was possible, but I got an error when a member function of a struct tried to return "this.text" saying that you can't return a local string.  I was trying to protect the char[] (string) to prevent users from changing it as this particular struct is designed to return information about the dialog option currently shown on a label, but I don't appear able to do so.

Pumaman

Quote from: Ozzie on Fri 27/05/2005 21:52:43
Yes, I'm very sure because I deleted every possible command in that room!!

Edit: I'm going to draw a new walkbehind, don't know how to continue else with the game. At least you know of the problem!

Any chance you could upload the problem room so I can take a look at it?

QuoteThat's all it says.  I searched for "return value" because I was trying to figure out if returning a string is possible* when I came across this.

I just loaded that page in the help file and it ended with:

then the local script just does:
int value = do_animation(3);


as it's supposed to.

In answer to your other question, you cannot return strings from functions. This is because strings are not assigned with normal operators but must be copied with StrCopy etc, so functions should have a "string buffer" parameter if they need one, rather than returning it.

monkey0506

Well technically it wasn't a "string", it was a char[200].  I've returned a char[200] before and copied it to a temporary variable with StrFormat(temp, "%s", GetOptionText(optionbuffer)) (see Scrolling Dialog Template for reference).  It worked with 2.62...  Anyway, I'll probably add a buffer parameter so that I can protect the text (on the label) from being changed by the users.  Especially now that I have made the OptOnLabel object global...

And as to the apparent error, perhaps I should make sure that the window isn't bigger than the screen first...

Pumaman

Returning arrays from functions isn't supported, so it shouldn't work unfortunately.


Anyway, I think enough time has passed now to officially release 2.7. However, first I need people to update their mirrors with the latest ags_27.zip so that I can update the download page.

Anyone who has some webspace to mirror the file is welcome to do so. If you are mirroring the download, please make sure you have Refresh 2 (v2.70.601 in the editor About box).

monkey0506

Quote from: Pumaman on Thu 02/06/2005 19:38:23Returning arrays from functions isn't supported, so it shouldn't work unfortunately.

Hmm... But yet it did work.  Oh well.  I did away with that function a long time ago.  And I can add the buffer parameter to the member function.  Thanks for the help Chris.

simulacra

Umm... just to make things clear: the 2.7 Refresh 2 has no DOS support, right? And there will be no DOS support in the future unless there is a protesting crowd of streakers blocking your front door shouting give me a D... D!!! Give me an O... O!!! And a S! ... S!!!

Is that correct?

Pumaman

That's correct.

I'd prefer nude models to streakers, but either way would work.

simulacra

Right. All ARGsers send nude photos to me.

Rui 'Trovatore' Pires

Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Gilbert

* Gilbot V7000a takes off his clothes immediately...

The protestors' photos should be posted here.

monkey0506

#59
Quote from: Gilbot V7000a on Tue 07/06/2005 08:03:23
The protestors' photos should be posted here.

That is the most amazing thing I have ever seen. :'( :'( :'( :'( :'(  These are tears of joy my friend...tears of joy...

Edit:  I just noticed how bad that sounded... -- Edited the quote.

Edit:  I have discovered something of a problem, let's see if you see it:

Code: ags
/* Something header file */
struct MyStruct {
  import function doSomething();
  /* other stuff */
  };

struct MyOtherStruct {
  import function doSomethingElse();
  int MyStruct;
  /* other stuff */
  };


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...

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?

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...  And I guess that since it worked in 2.62, using the return type in place of function has been implemented for a while.  Actually I think the video thing has nothing to do with AGS as taking a screenshot and pasting it into Photoshop continues to display the streaming video (where possible) in place of one specific color...

SMF spam blocked by CleanTalk