GetProperty...is there a "SetProperty"? **SOLVED**

Started by Knox, Tue 08/02/2011 18:02:29

Previous topic - Next topic

Knox

I created a custom property (a bool), and the default is "0". How do I change that value on the fly? I cant seem to find a "SetProperty"?

//pseudo code
Code: ags

bool bB = this.GetProperty("Hidden"); //should return false (default setting)

//later, in some block of script:
if (blah blah) 
{
  if (bB == false) bB = true;
}
--All that is necessary for evil to triumph is for good men to do nothing.

Calin Leafshade

I'm afraid custom properties are read-only.

This is something that is on my list to change when the engine is OSed though.

You'll have to use a normal variable (or an array for multiple hotspots or whatever) for now.

Dualnames

There is also a CustomProperties module by monkey_05_06, that allows changing properties at run-time. By cheating of course.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Knox

Wow, ok well I'll keep my eyes open for when the custom properties are no longer read-only...for now Ill create variables then I guess...

Ill look into that module btw, seems interesting... :D
--All that is necessary for evil to triumph is for good men to do nothing.

monkey0506

IIRC the latest version of the Properties module is actually horribly, horribly bugged. Actually I don't know that it's that bad, but I seem to recall there was something I was working on regarding the internal data storage..that may not have ever made it to a public release.

Possibly something regarding the fact that I switched to using dynamic arrays which have a maximum size of 1000000..but it should be functional depending how many properties you're implementing.

Ryan Timothy B

Quote from: Calin Elephantsittingonface on Tue 08/02/2011 18:05:01
This is something that is on my list to change when the engine is OSed though.
That would definitely be a great adjustment and I'd definitely welcome it. With this whole plan to go open source, I never once thought about the custom properties becoming no longer read-only.

Knox

QuoteThis is something that is on my list to change when the engine is OSed though.

@Calin: Just curious, (not implying anything or being a dick/impatient here, pure curiousity): when do you think the engine might/will go open-sourced, in your opinion? ...and uh...well, heh, is making custom properties writable really hard to do/long time to implement?

Just curious, cause if you think its like "x years", I'll stick with variables for the whole project until the end, but if you thinks its a matter of something like "x months", well...I'll put that part of my script on hold for now cause properties in this case is MUCH MUCH better and worth the "x months" wait!
--All that is necessary for evil to triumph is for good men to do nothing.

Calin Leafshade

It really depends when CJ releases it.

My impression was that he *is* going to release it but it needs some cleaning up before it's ready.

How long that will take only God(CJ) knows. I would guess its a matter of months rather than years.

I'm pretty sure that Monkey's CustomProperties module should suit your purposes though.

Knox

For sure Monkeys' module would be good, but *if* it's only a few months wait as you say (keep our fingers crossed) I think I'd rather not use the module at all...since if I did use it now I know that I'd have major re-work to do later once the custom properties are no longer read-only.

So, I guess I'll put that part on the shelf for now and move slowly onto another area...I'll probably finish my tech demo by the year 2034, just in time for superbowl IXXVVIIXXIIIV
--All that is necessary for evil to triumph is for good men to do nothing.

Calin Leafshade

Does your game actually have any *content* yet? :p

Knox

hehe, yah, itz got a ssAA-wwweet yellow key in my 1 room, and I recently added a cool feature where the player can clicks on it and shitz...its so swouit.

--All that is necessary for evil to triumph is for good men to do nothing.

helios123

QuoteThis is something that is on my list to change when the engine is OSed though.

For what it's worth, I have already done something of this nature through a plug-in. The result can be found here. Writing/Reading custom properties to/from save games is also supported.
That's all for now,
helios123

Knox

#12
QuoteThis DOES NOT APPLY to Character and InventoryItem objects
Looks really cool but unfortunately if I understand correctly the above line from your link I won't be able to use your plugin since I mostly use custom properties for inventoryItems! Did I understand correctly? ...or does that line mean that when the ResetRoom function is called, it doesn't apply to characters or inventoryItem objects?

Thanks for clearing that up for me because it looks cool!
--All that is necessary for evil to triumph is for good men to do nothing.

Calin Leafshade

No you misunderstood.

Read the paragraph before that line. *thats* what doesnt apply to characters and inv items.

Knox

--All that is necessary for evil to triumph is for good men to do nothing.

SMF spam blocked by CleanTalk