Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Vel on Sun 12/09/2004 21:43:13

Title: A few suggestions for AGS
Post by: Vel on Sun 12/09/2004 21:43:13
Hey there. I'd like to propose a few suggestions for AGS:

GetObjectTransparecy and GetCharacterTransparecy - You'd need those to make a cycle like an object or a character gradually appearing/disappearing etc
DisplaySpeechBackgroundAt and DisplayQueuedSpeechBackgroundAt - pretty self-explanitory, useful if you have a subtitle line at the bottom.

I hope that these are coherent.
Title: Re: A few suggestions for AGS
Post by: Kweepa on Sun 12/09/2004 22:07:39
Quote from: Vel on Sun 12/09/2004 21:43:13
GetObjectTransparecy and GetCharacterTransparecy - You'd need those to make a cycle like an object or a character gradually appearing/disappearing etc
Well, strictly speaking you don't need these. You can just keep track of the current transparency in a variable. If you wanted to cycle the transparency you'd need to have a variable saying whether it was fading out or in anyway. And if you wanted to fade out or in at any speed other than a multiple of the game speed you'd need a variable storing the current transparency in a higher precision.

P.S. I know English isn't your first language, so I thought you might appreciate someone pointing out that transparency has two 'n's and explanatory has two 'a's.
Title: Re: A few suggestions for AGS
Post by: Kinoko on Mon 13/09/2004 03:44:43
Quote from: Vel on Sun 12/09/2004 21:43:13
DisplaySpeechBackgroundAt and DisplayQueuedSpeechBackgroundAt - pretty self-explanitory, useful if you have a subtitle line at the bottom.

-Just- suggested DisplaySpeechBackgroundAt myself ^_^
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=16645.0
Title: Re: A few suggestions for AGS
Post by: Pumaman on Wed 15/09/2004 20:34:55
Quote from: Vel on Sun 12/09/2004 21:43:13
GetObjectTransparecy and GetCharacterTransparecy - You'd need those to make a cycle like an object or a character gradually appearing/disappearing etc

Would anyone else find these useful?
Title: Re: A few suggestions for AGS
Post by: Gfunkera on Thu 16/09/2004 07:33:13
Yes this would be a great addition. I think space games or games with ghosts might benefit from it greatly.
Title: Re: A few suggestions for AGS
Post by: Gilbert on Thu 16/09/2004 08:31:58
But what's the problem keeping track of them with variables? If you use such functions you're text-scripting already.
Title: Re: A few suggestions for AGS
Post by: TerranRich on Thu 16/09/2004 14:24:12
I for one do not find those functions useful, CJ. You can do it quite eaily without them. I just use "a" as a variable and a "while" statement to keep track of it.

//Fade a character out gradually
int a=0;
while (a<100) {
  SetCharacterTransparency(EGO, a);
  a++;
  Wait(1);
}


That's it. Who needs the Get... variables?
Title: Re: A few suggestions for AGS
Post by: Ginny on Thu 16/09/2004 16:13:20
Well, supposing you can't be sure you're starting with 100 or 0 transparency, you won't know what value a should start at.
Since you almost always have control over the actual setting of the transparency, this may seem unimportant, but suppose you wanted to create the following functions: ReduceCharacterTransparency(int charID, int by_amount, int rate, int pause) and IncreaseCharacterTransparency, you would have to do something like this:

function ReduceCharacterTransparency(int charID, int by_amount, int rate, int pause) {

SetCharacterTransparency(charID, GetCharacterTransparency(charID) - by_amount); // for an instant transition
// OR
int init_trans = GetCharacterTransparency(charID);
while (GetCharacterTransparency(charID) > init_trans - by_amount) {
SetCharacterTransparency(charID, GetCharacterTransparency(charID) - rate);
Wait(pause);
}

I left out the part where I needed to check wether it went too low, if by_amount is 10 for example, and rate is 7. But that's me being lazy right now ;).

Situations in which you don't know what the initial transparency is could be when you randomly changed it or when it keeps changing in repeatedly execute as and animation (f.e. a ghost is floating while changing transparency, until you spray something on it (root beer? :D), when it loses 10 transparency each time).

So, yeah, if it's easy to implement, these functions would be a nice addition. :)
Title: Re: A few suggestions for AGS
Post by: Scorpiorus on Thu 16/09/2004 21:58:12
Yeah, Get* is quite useful if we don't know a start value, as Ginny says or if that value is initially set via the AGS editor - in that case we'd like to refer to it. Transparencies aren't set in the editor but it would still be handy to get the value for writing some functionsÃ,  as Ginny demonstrated. Currently, we'd need to have an additional array to store transparency values but since the engine keeps track of them anyway it would be handy to get that info. :)
Title: Re: A few suggestions for AGS
Post by: Gilbert on Fri 17/09/2004 02:26:23
But isn't that easy, still? Example:

int chartrans[30];
...
function ReduceCharacterTransparency(int charID, int by_amount, int rate, int pause) {
  chartrans[charID]-=by_amount;
  if (chartrans[charID]<0) chartrans[charID]=0;
  SetCharacterTransparency(charID, chartrans[charID]);
}


(I originally wanted to use GetGameParameter() for the character coutn in the array declaration, but changed my mind, as I think the compiler probably only accept fixed values at compiled time.)
Title: Re: A few suggestions for AGS
Post by: strazer on Fri 17/09/2004 02:35:41
Quote(I originally wanted to use GetGameParameter() for the character coutn in the array declaration, but changed my mind, as I think the compiler probably only accept fixed values at compiled time.)

True. I was hoping to use it for arrays as well. :-\
Title: Re: A few suggestions for AGS
Post by: Kweepa on Fri 17/09/2004 03:11:00
I think it makes sense to have the Get/Set functionality.
Gilbot's code, while simple, is not as obvious as Ginny's...
Title: Re: A few suggestions for AGS
Post by: Pumaman on Fri 17/09/2004 19:52:53
Ok then, I've seen enough people in favour, I'll add it to my list.