Changing Object properties (SOLVED)

Started by aerguin, Sat 23/06/2007 16:11:57

Previous topic - Next topic

aerguin

Hi,
I can't find a way to change the custom Object (or Hotspot, Character or Inventory item, for that matter) properties. I mean, the ones that can be defined from the Room Objects page, clicking on "Properties...". I would like to change them in the middle of the game, from script.
There are these "GetProperty" and "GetTextProperty" functions, but how about Setting them?? I hope there is a way, cause if not all the hours I've put into this since the first day have been in vain  :(

Khris

#1
Uh-oh, I've got bad news for you.

Quote from: manualCustom property values cannot currently be set from within the game script - they are read-only at runtime.

However, there's a module by monkey_05_06 which allows to set up properties that can be changed during the game.
I think it can even read in AGS's properties, so maybe it wasn't all in vain. Edit: No, it can't. Sorry.

Edit: added link

Buckethead

What are you planning to do with it anyway? Maybe there's a way around it.

aerguin

oh that hurt  :'(

I'll probably try to write my own little customized module to read the AGS properties, store them somewhere and be able to change them, as the names of the properties I'm using are fixed.
Just a question, a real noobie one, can I make a global array of Strings? Like, "String my_properties[100]".

aerguin

@ buckethead.

All my Items (hotspot, object, everything....) have a String property saying what interactions can be made upon them. For example if there's a key on the table I could only "LookAt" and "PickUp" it, not "Push" or "Open" it. Depending on these values I create a different GUI with the corresponding Interaction choices for the user.

The thing is that for example in a door, at first I would like to have only "LookAT" and "Open", but when I open this I would like to change this Property to tell the program that now I can only "Close" it.

Khris

Quote from: aerguin on Sat 23/06/2007 16:45:48I'll probably try to write my own little customized module to read the AGS properties, store them somewhere and be able to change them, as the names of the properties I'm using are fixed.
Just a question, a real noobie one, can I make a global array of Strings? Like, "String my_properties[100]".

FYI, you'll need Room.ObjectCount, Game.CharacterCount and Game.InventoryItemCount.
Hotspots have index numbers from 0 to 29.

A global String array is declared like that, yes.
Code: ags
// global script / module script
String my_properties[100];
export my_properties;

// accordant header
import String my_properties[100];

aerguin

Oh I did it, it wasn't that hard after all  :)

I created another Property for the Items that only said if that Item could change of possible Interactions during the game. If it did (this property > 0) then this variable points to the location in that global array of Strings that will correspond to this Item. The Property that defined the interactions for this object are copied into this global String and this string is used from now on in the game for this Item, so the the old Property itself is used only as initialization.

Well thanks!

SMF spam blocked by CleanTalk