Search the Community
Showing results for tags 'script properties'.
-
Currently to expose settings to the editor users have to use the format: Script.variable = value --Type "Label" I propose a breaking change to the way editor properties function. First the syntax/method would need to change. Script would become a table: Script = {} All entries would be become named variables holding tables: Script = { --variable = {value, "type as string","label as string"} ground_height = {100, "uinteger","Ground Height" }, jump_height = {4,"uinteger", "Jump Height"}, player_name = {"","string", "Player Name"} } What this would mean is the editor would need to actually load the script itself, which brings a few drawbacks. 1. the entire script would need to be able to load without any errors. 2. if the script fails there is a chance that the properties will fail to load. 3. if the script property section is malformed or wrong it will not show up. or just grab it from the debug info (i would assume it's rather hard) A solution for this would be: 1. To hold a copy of the properties in memory/cache and restore them when the properties returns. 2. add a small reset button to reset the value to default. (since the editor will always be remembering the last value). If this is implemented there is an additional benefit: function Script:test1() return {"Good","Neutral","Bad"} end Script = { --variable = {value, "type as string","label as string"} ground_height = {100, "uinteger","Ground Height" }, jump_height = {4,"uinteger", "Jump Height"}, player_name = {"","string", "Player Name"}, dynamic_list = {self:test1() ,"choice","Team"} } You can now dynamically populate lists!! 1 draw back is you would either need to forward declare functions or put the functions above the script declaration. Even if this is not implemented, it could be useful if editor plugins are ever added.
- 2 replies
-
- 1
-
- suggestions
- suggestion
-
(and 2 more)
Tagged with:
-
Playing around with a script that allows the user to pick a color from the object panel to be used with a shader. Setting the initial value of the color works as expected and fills out the property panel correctly: Script.MyColor = Vec4(1,0,0,1)--Color "MyColor" But if the color property is modified via the panel, then it will return a number based on the 0-255 scale which will fail in the shader. In an attempt to work around this, I changed my initial value to: Script.MyColor = Vec4(255,0,0,255)--Color "MyColor" which results in this: which gives weird property panel results and still would be unuseable in my shader without dividing each component by 255. Since I have no viable method to determine if the color is being set by default or by the color picker, the returned color needs to be on a 0-1 scale to work properly. example script: Script.MyColor = Vec4(1,0,0,1)--Color "MyColor" function Script:Start() local color = self.MyColor System:Print(color.r..", "..color.g..", "..color.b..", "..color.a) self.entity:SetColor(color) end
- 2 replies
-
- editor
- script properties
-
(and 1 more)
Tagged with: