PDA

View Full Version : Function That doesn't work.


obsidian1292
09-18-2010, 08:49 AM
Hello Alice forums,

My class and I have found a function that are in some objects and not others.
One example is this: In the cat object, in functions, under other, there is a function named: (cat)'s variable named (variableName) of type (valueclass). We are trying to drag the function into the code and it does not seem to drop anywhere, regardless of the command that we try to use it in. What is the purpose of that function?



Thanks so much you guys,


obsidian1292

x2495iiii
09-18-2010, 10:18 AM
It's intended to allow you to reference customized variables for individual objects from a general context. The prime example would be something like having each cat have it's own custom number variable called height, then having a list method have each cat jump "cat's variable named height of type number" meters.

KsMomOf2
09-19-2010, 07:58 AM
But, when I create a variable for the cat named height and try to drag it into a method, it doesn't let me drop it anywhere ... so, does it not work or am I doing something incorrectly?

I add the cat, I create the cat's variable "Height" ... I add a line to myfirstmethod that says cat move up 1 meter and I try to drag the cat's function "variable named <variable name> of type <variable class> " it and drop it ... and it won't let me drop it.

I was hoping to be able to use this function to create an array of cats all with class variable "height" and then to be able to have them all jump different heights - but, I can't figure out how to access this variable ... if just doing individual objects (one cat) - then I can just drag the "Height" into the command, but if I want to use the array, I cannot.

I expected the function to work similarly to the "part named" function ... but I can't seem to get it to work.

x2495iiii
09-19-2010, 12:25 PM
My assumption was the same, since the partnamed function actually works. If it wouldn't drop, however, I may be wrong and may well be broken, as you said. Apologies.

Dameria
09-19-2010, 12:58 PM
Same here, that function does not work for me either. I really wish it did, as I have said in other posts also, because it would make enemy AI and other methods a lot easier when having multiple enemies in most games. Instead of making a separate method for each enemy, you would be able to use this function to have one method that is used for every enemy. This won't work though, because the function cannot be dropped anywhere like you said.