AGS 2.71 Final 2 - Politically Correct Edition

Started by Pumaman, Sun 05/06/2005 23:32:14

Previous topic - Next topic

edmundito

Quote* Game now attempts to mute audio when alt+tabbing away to another application.

Hip, hip, hooray!

GarageGothic

#81
Another beta, awesome! Glad to see that the 90+ rotation is fixed - I've had to work around that one until now :) And thanks for fixing PgUp!

Quote from: Pumaman on Sun 17/07/2005 13:20:23
QuoteI was thinking whether it'd be possible to apply the transparent pixels from a similarly sized sprite as a mask when cropping the dynamic sprite from the background. I suppose it would actually work by copying the "pink pixels" from the existing sprite onto the dynamic one.
Can you clarify what you mean -- using the non-transparent area of another sprite as a mask to decide which pixels are copied from the background onto the new sprite?

Yes, that's basically what I meant, except I imagined that it would be done by first grabbing the dynamic sprite, then apply the transparency (which would also make it useful for sprites that aren't copied from backgrounds).

Here's an example. Let's say that you want to create a UV-flashlight effect, so you create one normal background (background frame 1) and another, ultraviolet lit version of it (background frame 2). Now you cut out a 64x64 area of frame 2 at (mouse.x, mouse.y), getting a square shaped dynamic sprite. However, we want a circular flashlight beam. So you take a pre-existing circular sprite, resize it to 64x64 and copy the transparent area of this (the pink, rounded corners around the circle itself) onto the dynamic sprite. Finally you either rawdraw this or assign it as an object at (mouse.x,mouse.y).


SSH

but, but, CJ: all the fun in AGS programming is working around things like the string handling. Fixing things will mean that ANYONE can do stuff.  :'(
12

HeirOfNorton

Quote from: Pumaman on Sun 05/06/2005 23:32:14
* Fixed compiler crash when declaring a large struct.

Sweet. This fixed my crash, and now everything I'm trying works perfectly.

Between the constant bug-fixes, the new sprite compression and String functions... CJ, has anyone told you lately that you are the coolest person in the world?

HoN

Fribbi AGDI joker

Is it possible to add "delete" button for dialog and characters playersÃ,  so I can delete unneeded dialogs and characters from the characters list?

Adamski

Is it possible to do away with having to label music and sound effects as generic "sound1.ogg" or "music23.mp3" and have unique names for these files yet? Perhaps the music, sound and speech sub-folders can be expanded too so us people using lots of audio assets would have an easier time managing and organising everyting.

monkey0506

Just wondering, I can create an array of Strings:

String strs[30];

But will this work properly?  It compiles, I'm just wondering if it works correctly because I'm too lazy to test it.  Also, is a String object a pointer to something, because I figured since I can put a Hotspot or a Character as a struct data member, I could use a String, but I get an error saying "member cannot be pointer" or something to that effect.  Which pretty much stinks.  I love the new String functionality...but...I think while you're working on it you should make them capable of being implemented in structs.  That would be nice.

That's my two cents at 12:08 in the morning...

Rui 'Trovatore' Pires

Stalkey - you can always ask NetMonkey about his media manager plugin.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

strazer

Yeah, after all, all the multimedia functions would have to be changed to accept file names instead of numbers which is a lot of work for relatively little gain in my opinion.

What I do is set up enums in the main script header like this:

Code: ags

// Main header script

enum Game_SoundEffects { // arbitrary name
  eSoundBirdChirpLow = 41, // arbitrary names
  eSoundSuccess = 20
  //...
};

enum Game_Music {
  eMusicEerie = 3
  //...
};


I can then use them like this:

Code: ags

  PlaySound(eSoundSuccess);
  PlayMusic(eMusicEerie);


You can name your enums whatever you want but I like to prefix them with "eSound", "eMusic" and so on so they are consistent with the AGS enum naming scheme and they are less likely to conflict with reserved (variable) names and so the auto-complete pops them all up when I begin typing "eso..." etc.

The same works great for GlobalInts as well.

(The media manager thread is here, btw.)

Gilbert

So far I see that nearly all the functions in the string functions (not other string property related fields, as mentioned) of the manual were converted already, except two of them:
StrSetCharAt() and GetMessageText()

It seems that the Chars[] property is currently read-only, maybe it's a good idea to make this writable, so to replace StrSetCharAt()? Like:
String blah="HAHAHAHA!";
blah.Chars[4]=0; //truncates it to "HAHA"

Also, maybe GetMessageText() can now be written like:
String tmpstr=String.GetMessage(10);



(not bug report, just suggestions)

strazer

Quote from: monkey_05_06 on Tue 19/07/2005 06:08:14I think while you're working on it you should make [Strings] capable of being implemented in structs.  That would be nice.

I second that.

And a small thing:
Is there a reason why the room interactions are called "Player enters screen (before fadein)" and so on?
I imagine it would be a little less confusing for beginners if these would be called "Player enters room (before fadein)".

GarageGothic

Um, I wish I could give some feedback on the new beta, but I haven't even manage to compile my game with it yet. Could somebody please explain how to modify my current string-using functions to work with the new beta?

As far as I understood, you'd have to add "const" in front of the word "string" in your function headers, like this:

Code: ags
function AddText(const string inputtext)


but then when I compile, I get error messages that it can't convert const string to string or something like that, referring to lines within the function.
To fix it, I try to put "const" on the string declarations within the function, it tells me to use "readonly" instead, but that doesn't work either.

Also, a piece of code like this gave me similar error messages now:
Code: ags
string buffer;
if (GetSaveSlotDescription(101, buffer) == 0) {


How can I fix this, short of rewriting everything to use Strings with capital S?

Gilbert

Quote from: GarageGothic on Thu 21/07/2005 13:19:40
How can I fix this, short of rewriting everything to use Strings with capital S?
Unfortunately, it's the best way, unless you keep on using the old functions and old "string" type. The "replace" function of text editors helps.
My suggestion is, if you're too worry about the changes involved, don't upgrade the AGS version, stick to the version the game was already made for, unless you desperately need some new features (and also, don't rely on betas for real games, as things are still changing).


, (using new "String"s in an old function simply cannot be done) but since I didn't do much experiments, I'm not so sure about it.

GarageGothic

I need to upgrade the AGS version because the fix for the sprite rotation is vital to my dynamic shadows script. But all these weeks of scripting conversation longs, html-formatting, custom dialog modes - all of them using strings intensively... There must be some way of making it work.

I don't think I even need the new Strings for any of these functions, and now that it works I'd rather not mess with it again. I just want AGS to compile it without complaining about my perfectly good functions :)

Pumaman

QuoteYes, that's basically what I meant, except I imagined that it would be done by first grabbing the dynamic sprite, then apply the transparency (which would also make it useful for sprites that aren't copied from backgrounds).

Ah ok I see what you mean, yeah that could allow some cool effects.

Quotebut, but, CJ: all the fun in AGS programming is working around things like the string handling. Fixing things will mean that ANYONE can do stuff.

:P

QuoteSweet. This fixed my crash, and now everything I'm trying works perfectly.

Glad to hear it!

QuoteIs it possible to add "delete" button for dialog and characters players  so I can delete unneeded dialogs and characters from the characters list?

Yeah I've been meaning to do this for ages. In the meantime, just ignore them and re-use them when you need a new one.

QuoteIs it possible to do away with having to label music and sound effects as generic "sound1.ogg" or "music23.mp3" and have unique names for these files yet? Perhaps the music, sound and speech sub-folders can be expanded too so us people using lots of audio assets would have an easier time managing and organising everyting. 

netmonkey's media manager plugin should simplify this, but I'm not sure what its current status is.

I do see your point though, names are much nicer than numbers and especially now that we have sub-folders for music and speech to separate them from sounds, it should be simpler to implement.

strazer suggests a good workaround from a script point of view, but there is still the issue of having hundreds of "soundXXX.mp3" files in your game folder and trying to remember which is which, so I do understand the issue.

Quotesince I can put a Hotspot or a Character as a struct data member

Eeek well spotted that's a bug, you shouldn't be able to do that.

Yes a String is an object (the implementation of the new OO-style scripting is what has allowed this new String style to finally be added).

Quoteyou should make them capable of being implemented in structs.

I'd like to allow pointers in structs, we'll have to see what else comes up.

QuoteIt seems that the Chars[] property is currently read-only, maybe it's a good idea to make this writable, so to replace StrSetCharAt()?

I'm not sure what to do with this one. The standard practice of Java/C# is that strings are immutable (ie. you can't change them). This is because allowing it can create hard-to-track-down bugs, for example:

String a = "Hello there!";
...
String b = a;
...
a.Chars[4] = 'X';
...
Display("b: %s", b);   // displays  "HellX there!"

because strings are just pointers, allowing 'a' to be modified means that 'b' also gets changed, which can cause a lot of confusion and false bug reports.

Therefore I'm tempted to add some sort of String.AppendChar function to make it easier to build strings, and leave Chars[] read-only.

QuoteIs there a reason why the room interactions are called "Player enters screen (before fadein)" and so on?
I imagine it would be a little less confusing for beginners if these would be called "Player enters room (before fadein)".

Originally "room" and "screen" were used interchangably, but it would be more consistent to say "room" here I agree.

Quotebut then when I compile, I get error messages that it can't convert const string to string or something like that, referring to lines within the function.

Can you post one of your functions that is causing the problem, along with what the error message is and which line it's on, then we can hopefully show you how to change it.

Basically any string parameter that the function is going to modify needs to stay as just a "string" (for example, if you're going to StrCopy into it); if the string parameter is not going to be changed by the function, it becomes a "const string".

Quote
Also, a piece of code like this gave me similar error messages now:

Code:
string buffer;
if (GetSaveSlotDescription(101, buffer) == 0) {

That should still work fine, what error are you getting?


Adamski

Quotenetmonkey's media manager plugin should simplify this, but I'm not sure what its current status is.

I do see your point though, names are much nicer than numbers and especially now that we have sub-folders for music and speech to separate them from sounds, it should be simpler to implement.

strazer suggests a good workaround from a script point of view, but there is still the issue of having hundreds of "soundXXX.mp3" files in your game folder and trying to remember which is which, so I do understand the issue.

The reason why I brought this up is that it seems to be a relic left over from the dos editor. Netmonkey's plugin is very nice, but I have concerns about it using the .NET framework.

Strazer's suggestion is excellent though, very useful :)

edmundito

Quote from: Rui "Brisby" Pires on Tue 19/07/2005 07:16:35
Stalkey - you can always ask NetMonkey about his media manager plugin.

Uhh.... update coming soon! An update that actually works!

monkey0506

Pumaman:

So you're telling me I'm not supposed to be able to use Hotspots and Characters as struct data members? LOL.  Not that I ever actually used it except in testing...but it's kind of funny that I thought it was allowed when in all actuality it turns up to be a bug.  And BTW, I wasn't asking if a String was an object, I knew that much, I was asking if a String object was a pointer.  Which I'm presuming that it is based on your comments.

Gilbert

#98
Quote from: Pumaman on Thu 21/07/2005 20:06:12
QuoteIt seems that the Chars[] property is currently read-only, maybe it's a good idea to make this writable, so to replace StrSetCharAt()?

I'm not sure what to do with this one. The standard practice of Java/C# is that strings are immutable (ie. you can't change them). This is because allowing it can create hard-to-track-down bugs, for example:

String a = "Hello there!";
...
String b = a;
...
a.Chars[4] = 'X';
...
Display("b: %s", b);Ã,  Ã, // displaysÃ,  "HellX there!"

because strings are just pointers, allowing 'a' to be modified means that 'b' also gets changed, which can cause a lot of confusion and false bug reports.

Actually from the manual, I thought using the = assigment is a content copy rather than a pointer copy (but now it appears as pointer copy), simply because of the following line you wrote in String.Copy() of the manual:
"Returns a new copy of the specified string. You should not normally need to use this, since strings can be assigned using the = operator."
In that case that .Copy() function is VERY importantly needed, as you MUST use this to duplicate a fresh one for modifications, I found that description a bit misleading.
I know nothing about those modern programming conventions (OO/Java/C#, etc.), but if you can allow direct = assignment of Strings there're ambiguities already, this kind of assignments looks like high level language practice (like bAsIc :P ), so it'll be a bit confusing:
String a = "hahaha"; //initializes content of a
String b = a; //makes b a copy of the pointer a

In my opinion, since AGS is a game creation package for ease of use, maybe it's worth discussing whether = for Strings works as a content copy or a pointer copy.
Personally I favour content copy more, as it'll be more friendly for most users to have it work like oridinary types like int, short, etc. (it will not be consistent with other struct objects, but it can somehow be noted in the manual). If It's a content copy, things are easier to manage, and you can, say, setting the individual characters safely.

Quote
Therefore I'm tempted to add some sort of String.AppendChar function to make it easier to build strings, and leave Chars[] read-only.
But if it's just .AppendChar(), you can always just use:
a=String.Format("%s%c",a,'!');
and still, changing a character in the middle will become complex, compared to StrSetCharAt() we already have for old strings.

monkey0506

Okay...that clears some things up in my mind.  It's interesting though that:

String a = "this is some text";
String b = a;

Would make 'b' a pointer to the same object that is pointed at by 'a' instead of copying the contents.  I didn't really understand what the String.Copy() function was for until now, as to create String b as a copy of String a one would have to type something to the effect of:

String a = "this is some text";
String b = a.Copy();

And I have to go...there was more, but I'm busy with other things and I won't get around to finishing this tonight.

SMF spam blocked by CleanTalk