Ask a Question related to Macromedia Director 3D, Design and Development.
-
Will Hogben webforumsuser@macromedia.com #1
calling a function from text.
simply, I am making a 3d game. You have a weapon. It shoots stuff, which reacts differently. I want a system where I can call a function based on some text, so if the object you hits name is "grassFloor" then how can I go from that to calling function grassFloor(). I can't use if statements because I want this engine to be really expandable, so I can add objects and functions for them and thats that, they should work. What I'm asking is how can you call a function based on text, so if I had the text "grassFootsteps" I could turn that into a function call to the function grassFootsteps(). Thanks, I hope I have been clear enough, Will Hogben.
Will Hogben webforumsuser@macromedia.com Guest
-
Calling a function within a function registered to an event
Hey, Just registered and tried to search through the forum for a solution to my problem, but I haven't found anything that could help me. I've... -
name of calling function
Hi folks, In the back of my mind I seem to think that you can find out where a function was called from. What I'm after is: my... -
Function calling from url
Good morning! I would like to call a function from a <FORM>'s ACTION attribute. This is what I'm trying to do: <FORM... -
Function/Global var to return name of calling function?
I'm sure I saw this somewhere but can't remember where and can't find it now... Is there a PHP function or global variable that will return name... -
calling c function from php app
Did you get vertex tax integrated? I am trying to implement that for a client right now. Any help would be great. Thanks, Chris ... -
Will Hogben webforumsuser@macromedia.com #2
calling a function from text.
simply, I am making a 3d game. You have a weapon. It shoots stuff, which reacts differently. I want a system where I can call a function based on some text, so if the object you hits name is "grassFloor" then how can I go from that to calling function grassFloor(). I can't use if statements because I want this engine to be really expandable, so I can add objects and functions for them and thats that, they should work. What I'm asking is how can you call a function based on text, so if I had the text "grassFootsteps" I could turn that into a function call to the function grassFootsteps(). Thanks, I hope I have been clear enough, Will Hogben.
Will Hogben webforumsuser@macromedia.com Guest
-
Desmond22 webforumsuser@macromedia.com #3
Re: calling a function from text.
I don?t know how to convert text to a function but I think there might be another way around your problem:
What about dynamic ancestors?
Make ?stuff you shoots? have a property list containing different ancestor scripts
(MyAncestors) which control ?stuff you shoot? accordingly.
Whenever ?stuff you shoot? hits something get a property from the thing its hit(reactionID).
Set ?stuff you shoot?s ancestor = MyAncestors(reactionID)
Des.
Desmond22 webforumsuser@macromedia.com Guest
-
xaplax webforumsuser@macromedia.com #4
Re: calling a function from text.
sorry to dissapoint you will but i just wanted to know if des had msn or aim, do you des.. its kinda hard to talk over this.. and you could probably help me loads with a 5 min chat
xaplax webforumsuser@macromedia.com Guest
-
MosseMilk webforumsuser@macromedia.com #5
Re: calling a function from text.
Hi
I do like this:
Obj1 = an Object like bullet
Obj1 = an object like Pig
if obj1 and obj2 collide then
obj1.CheckCollide(obj2)
obj2.CheckCollide(obj1)
In every object a have a CheckCollide(inObj) function and from there i can do different things in every object depending on what in object that comes in. And you can call on functions in the inObj.
---the Bullet
On CheckCollide me , InObj
InObj.DoStuffOnHit --Pig obj
inObj.Armour =inObj.Armour - Damage
if inObj.Armour<0 then inObj.Alive = 0
End
If its to some help?
I did like this in my last game and it did work out well.
/M
MosseMilk webforumsuser@macromedia.com Guest
-
Gretchen Macdowall #6
Re: calling a function from text.
In article <beuthi$8oo$1@forums.macromedia.com>, "Will Hogben"
[email]webforumsuser@macromedia.com[/email] wrote:
function >based on text, so if I had the text "grassFootsteps" I could>thats that, they should work. What I'm asking is how can you call a
turn that into a >function call to the function grassFootsteps().
-- assuming "on grassFootsteps" is a handler in a movie script
thestring = "grassFootsteps"
do thestring & "()"
Gretchen Macdowall
[url]http://www.updatestage.com/[/url]
Gretchen Macdowall Guest
-
Will Hogben webforumsuser@macromedia.com #7
Re: calling a function from text.
Er, no, actually I don't want to have to make a load of objects in code. What I want to do is just have the 3d models in my scene, and knowing ony what the name of the model is, ie: stoneBlock, determine what kind of shrapnel to blow from the bullet hole. Basicly I want to write functions with the names of the models, and have the code find them on its own knowing only the model names. I don't want to have a parent script for every object in the level, or a complex if statement system that checks to see if the model name contains stone and then calls a stoneBits() function. I want it to start with this data, a single string of characters, and call a function by the same name. is there no way to turn ("punchMe") into a call to function punchMe()?
Will Hogben webforumsuser@macromedia.com Guest
-
Aldo Hoeben #8
Re: calling a function from text.
look up the lingo command 'do'
'do ( ;-D )
Aldo Hoeben Guest
-
hairybobby webforumsuser@macromedia.com #9
Re: calling a function from text.
I think I know what you mean - I'm not sure I know the answer but I've seen people do something like this. I think it uses a "Do command" or "do code" . Check out everything under "do " in help.
sorry I can't be more specific but no one elses answered the question
HAIRYBOBBY - why didn't I choose a really cool name like the vulcanpimp
[url]http://www.geocities.com/hairybobby2000[/url]
see my photos of the sunrise eclipse
[url]http://www.geocities.com/hairybobby2000/ecllipse.html[/url]
hairybobby webforumsuser@macromedia.com Guest
-
flashjedi webforumsuser@macromedia.com #10
Re: calling a function from text.
As I understand it, you want to preprocess the scene so that your groups of models are kept in lists: terrainobjects, targetobjects, etc... This way when you do your ray casting the modelname that is returned can be compared to the lists to determine what "class" it belongs to and react accordingly. you don't have to use an if statement, but you will need some condition operator such as the case statement.
case (modeltype) of:
terrainobj:
grassfootsteps(modelname)
targetobj:
explodeobject(modelname)
otherwise:
nothing
end case
you will need to name the objects in your scene using some convention so that when you preprocess the scene you can use lingo's string comparison functions to extract some portion of the modelname to determine its type. i.e., prefix all terrain objects with "terrain", and store it in the terrainobj list.
flashjedi webforumsuser@macromedia.com Guest



Reply With Quote

