Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Types or Structs 1

Status
Not open for further replies.

fugigoose

Programmer
Jun 20, 2001
241
US
Is there a way to declare a type or struct in director like you can in Visual Basic and C++. Like instead of a variable being a string or a integer, its a rabbit? Like in VB I can do something like this;

Public Type Rabbit()
weight as integer
speed as integer
name as string
coat as string
End Type

Right now I have to use property lists in Director so i have somethign messy like this:

animals = [#rabbit1:[#wieght:10, #speed:5], #rabbit2:[#wieght:12, #speed:4]

I kinda want to be able to create imaginary lists so like i can declare a variable as a list, without telling it whats in the list. ex:

rabbit1 = newRabbit

and rabbit1 will automatically have all the rabbit object's properties in it. If theres a way to do this in director, I will have even more respect for it than I already do.
 
u can create parent script objects: try the following

-- parent script rabbit
property weight
property speed
property name
property coat

on new (me)
-- initialize all properties here
weight = 10
return me
end
-- end parent script

u will have to call it like this

rabbit1 = script("rabbit").new()
put rabbit1.weight

 
OOOO, thats so awesome! You can't imagine the power this gives me. I can add as many bouncing balls as I want dynamically!!!! I love Director even more now! Thank you, Thank you SOOOOO much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top