Author Topic: User properties (key, value) ??  (Read 119 times)

Eyth

  • Newbie
  • *
  • Posts: 26
    • View Profile
User properties (key, value) ??
« on: October 15, 2018, 12:42:27 pm »
Hello again ^^

So lately, I was wondering about a section in the editor-windows of map entities. By double clicking, the edit window opens and at the bottom there is a point "user properties". By going on "+" I can enter a key and a value.

I didn't use this till now, so I dont know what this is for? And I didn't find it either.
Can someone explain, what benefits this holds? Maybe I'm missing a helpful tool all this time ^^

Thanks in advance ;)
« Last Edit: October 15, 2018, 12:44:19 pm by Eyth »

alexgleason

  • Jr. Member
  • **
  • Posts: 72
  • Vegan on a Desert Island
    • View Profile
    • Vegan on a Desert Island
Re: User properties (key, value) ??
« Reply #1 on: October 15, 2018, 07:15:26 pm »
Looks like a new feature in Solarus 1.6: http://www.solarus-games.org/doc/1.6/lua_api_entity.html#lua_api_entity_get_property
Quote
User-defined properties are arbitrary key-value pairs that you can set to any entity. The engine does nothing special with them, but you can use them in your scripts to store extra information.
RIP Aaron Swartz

Diarandor

  • Hero Member
  • *****
  • Posts: 1024
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: User properties (key, value) ??
« Reply #2 on: October 15, 2018, 08:48:24 pm »
Exactly, it is new stuff, and very useful.

This allows you to initialize as many variables as you want from the Editor (or from the scripts), and get or modify their values in your scripts with the corresponding getter/setter functions, all in a very clean way. Customization is the future!
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

Eyth

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: User properties (key, value) ??
« Reply #3 on: October 16, 2018, 09:29:08 am »
Nice  :) Looking forward to it, thanks.