Do I have to create them one by one? or use some Lingo Script ?
It's your choice, really.
If you want to create them with Lingo, you could use something like the following in a #movie script:
on mCreateMembers aType, howMany, aNamePrefix -- insert error checking of parameters here repeat with n = 1 to howMany tMember = _movie.newMember(aType) tMember.name = aNamePrefix & n end repeat end
and call this by executing mCreateMembers(#text, 1000, "GoldCard") from your message window
So I searched for an old topic I started
I can't get this work....ahhhhhhh
Can someone type it put exactly how it would look? I'm getting errors :(
I am curious as to why you would need to create 1000 text cast members. I would hazard a guess that there is a more efficient means to accomplish your goal.
But in any case, you should at least post the error you are getting.
I'd welcome new ideas, of there's a better way than creating 1,000 cast members
But each member would be storing / keeping track of a users "points"
As far as the code here is what I wrote
On mCreateMember field, 1000, goldcard
Repeat with n = 1 to 1000
tMember = _movie.newmember(field)
tMember.name = goldcard & n
Also not sure about how to call it: re: "and call it excuting mCreateMembers(#field, 1000, goldcard) from your message window"
Basically I'm in authoring mode, was curious if I could wright code, press the play head so it would run the code....and bammm have 1000 created castmembers
Myself, I would be storing data in a single list variable.
OK, I see where you went wrong. The handler Sean gave you was more flexible than your modified one. I would suggest you stick with that one. It can do what you want it to. Yours would work if it as written correctly but it is far less flexible.
Take Seans code and put it in a movie script. Then open the Message Window and type this in, followed by ENTER.
mCreateMembers(#text, 1000, "GoldCard")
That's all you have to do, no need to run the movie. You should see all of the cast members get created.
Script error: Handler not defined
Did you add the handler mCreateMembers as a movie script (and not a parent script or behavior)?
Short of copy&paste, I wrote what he has word for word.... Am I doing something wrong?
Please confirm that it is a MOVIE script and not a behavior or parent script. Do you know how to tell the difference?
I do not... All I've done so far is scripts that run with the movie plays.....
Sent from my iPad
There are 3 types of script members in Director: movie, behavior, and parent. The type of script member that you create is extremly important. Handlers that are defined in a movie script are available globally. Handlers defined in a behavior script are available only to the sprite to which the behavior is attached. Handlers that are defined in a parent script are available to the child object that is instantiated from the parent script (a bit of an advanced topic).
So when you get the error "Handler not defined" trying to execute mCreateMembers (your handler, aka function or method) it is because you did NOT define the handler in a movie script. In all likelihood you put it in a behavior or possibly a parent script. BTW, is doesn't matter that you are calling the handler from the message window. You would get the exact same error if you were calling the handler from some code within your movie ("scripts that run with the movie plays" as you called it).
When you open the script window, look in the top left title bar area, what does it say? Movie Script? Parent Script? Behavior Script? If it is not the type you are wanting (movie script in this case) then click on the properties button (letter i) or press ctrl+i (assuming windows). When the Property Inspector displays you can change the scriptType by clicking the drop down button and choosing the one you want.
I guarantee you that if you create your handler in a movie script you will not get the "Handler not defined" error when you call it.
That was a very good, lengthy answer. Thank You
Got it working
Played around with it a little with the following ..... Just to understand it better
MovieScript: on keyDown ... Case 18... Beep..... Pretty cool no matter where in the movie I press the #1 key,, the PC makes a beep...using that simple MovieScript test
So do you think it would be more intuitive if the behavior type was identified when you wright the handler? Identified before.....