A suggestion about GetProperty

Started by ilSilente, Wed 25/05/2005 15:43:10

Previous topic - Next topic

ilSilente

Hi to everybody  :)
I was scripting this morning, and (after a forum search) I was wondering why GetProperty/GetPropertyText functions have to be called according to the type of location related.

I mean: every type of object-game share the same property schema, so... since we have GetLocationName and GetLocationType, why can't we have GetLocationProperty instead of:

Code: ags
type = GetLocationType(mouse.x, mouse.y)
if (type == eLocationHotspot) {
  Hotspot* h Hotspot.GetAtScreenXY(x,  y);
  h.GetPropertyText("Desc",  buf);
} else if (type == eLocationObject) {
  Object* o = ...


And (curiosity) why properties are read-only at runtime?

Pumaman

I guess GetLocationProperty is a reasonable enough request -- would anyone else find that useful?

It would of course be possible to write your own custom function to do this, using code similar to what you've described.

Quote(curiosity) why properties are read-only at runtime?

It's to do with the memory and save game implications of storing the current value of all properties in all rooms. Currently they can just be unloaded and loaded along with the room.

fovmester

I always found the properties a bit too general. I mean you seldom need the same properties for rooms that you need for objects. Having a different set for rooms, objects, characters and hotspots as well as the general ones would be nice (though not neccessary for it to work).

Pumaman

An option to seperate Room properties from the rest is likely to happen in future, because it doesn't really make sense to share them. However, Objects, Hotspots and Characters are likely to share similar properties so that does make sense.

RickJ

Quote
However, Objects, Hotspots and Characters are likely to share similar properties so that does make sense.
I can agree that there may be much comonality, however, it seems to me that there may also be enough differences to discourage the use of properties.   So my vote would be for each to have their own schemas. 

I think it would also be useful, especially for template authors, to have a separate schema for the game (even though it would probably have only one record).   Configuration options could be made into properties rather than implemented as #defines. 

Anyway, just my 2 cents worth... 


fovmester

A reason to make editing properties available at runtime:

It's very object-oriented! It'd be like characters, objects and hotspots were actually objects of different classes with different attributes that you can read and change. Just like in any object-oriented language.

I know making properties editable is much work for you, but you might want to consider it for say maybe version 3 of AGS? ;)

SMF spam blocked by CleanTalk