Is possible to store a vector/array (not only 3x3) into a property?
If not, wouldn’t it be a nice/useful/simple add to the GE?
(please, don’t say “write it on a file” or any other similar workaround… I need to store it in a property (or a global variable readable by every script, if possible))
g = GameLogic
c =g.getCurrentController
o = c.owner
o["name i want"] = [A,B,A,A,A,B,A,B]
and from another object
g = GameLogic
c =g.getCurrentController
s = g.getCurrentScene
o = c.owner
ob = s.objects
object = ob["the object that own the property"]
if ob["name i want][2] == A:
#something
I’m not any expert in python, but if I were you, I’d try it out, it seems plausible! I assume you want to dynamically change the vector values, and it updates a property that can be read by other object!?
exact!
I have a sequence of events, and each event have 2 possible value (A or B)
I want to access them from another object and recostruct the sequence of responses given by the events.
So why do you choose a vector instead of a boolean? Since vectors indicate lenght, the outcome can be anything.
Having every event defined by a different property, which is in turn saved on change, from true to false, could maybe save you the hardships of converting a vector into a linear interval… [now I’m typing nonesense. I’ll leave it to the experts].
In your stead I’d use a boolean property per event and maybe send messages affecting concerned objects e.i. : event01=True => action 021= True… or some like that
my problem is a bit different/more complex. I asked so that i could know how to plan the development. Now i know how to do it, in a while i’ll post the blend so you can see how it works.
(it seams mysterious, i know… But english is not my mother language, so it’s a bit tricky for me to explain :), a good blend is more suited)
hey, can i get a simple example abaout how to use the global dict function?
assume i have 2 identical .blend simple shooter game file ; i.e a simple cube that has a property named “ammo”. then if i press SPACEBAR the ammo count will minus by 1. then i have an object that if collide with the cube will open the second .blend file. but the number of ammo in the property “ammo” also transferred to the new .blend file…
sorry, i bad in scripting so if the explanation in full and complex py script i cannot understand… i have tried the sample script in blendertutor, but it didn’t work. currently i use Blender 2.49b and sometimes 2.53