Jump to content

Object properties


DarthRaff
 Share

Recommended Posts

Hi,

 

Can someone, please, put me an example of basic properties table to use in the editor because mine give me errors and i don't know how to solve it.

 

Here is my code:

require("scripts/class")

local class=CreateClass(...)

function class:CreateObject(model)
local object=self.super:CreateObject(model)
end

function class:InitDialog(grid)
self.super:InitDialog(grid)
group=grid:AddGroup("room")
group:AddProperty("Classname", PROPERTY_STRING ,"room")
group:AddProperty("tipo",PROPERTY_STRING ,"room")
group:Expand(1)	
end

 

give me :"table index is nil" in that line:

 

group:AddProperty("Classname", PROPERTY_STRING ,"room")

 

thankyou.

Link to comment
Share on other sites

yes. very true Aggror. I think people are confusing game scripts with scripted properties for an entity.

 

His code above worked just fine, except that the PROPERTY_STRING does not appear to have a default option, so you need to set the default property when you create the class.

require("scripts/class")

local class=CreateClass(...)

function class:CreateObject(model)
       local object=self.super:CreateObject(model)
object.model:SetKey("Classname","room")
object.model:SetKey("tipo","whatever")
end

function class:InitDialog(grid)
       self.super:InitDialog(grid)
       group=grid:AddGroup("room")
       group:AddProperty("Classname", PROPERTY_STRING )
       group:AddProperty("tipo",PROPERTY_STRING )
       group:Expand(1) 
end

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...