Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Parameters and variables (http://www.alice.org/community/showthread.php?t=3823)

REDOS 01-26-2010 11:36 AM

Parameters and variables
 
I cant understand 100% whats the diff between this option, can u tell me plz?

zonedabone 01-26-2010 05:32 PM

Answer!
 
Variables are values that can be changed and accessed. Object variables, like the world variables, can be accessed at any time, while event variables are only accessible from that event. Furthermore, if two instances of the same event are running, the variables are specific to each instance of the event.

Parameters are sort of like variables, however, they can only be made within events. These parameters are defined every time that an event is called. They can then be accessed as the event runs, and act as a sort of instruction for the event. The parameter values are deleted when an event stops. They allow you to make events more customizable.

Hope that this helps!

Nephtysis 01-27-2010 03:22 PM

[QUOTE=zonedabone;16104]Variables are values that can be changed and accessed. Object variables, like the world variables, can be accessed at any time, while event variables are only accessible from that event. Furthermore, if two instances of the same event are running, the variables are specific to each instance of the event.

Parameters are sort of like variables, however, they can only be made within events. These parameters are defined every time that an event is called. They can then be accessed as the event runs, and act as a sort of instruction for the event. The parameter values are deleted when an event stops. They allow you to make events more customizable.

Hope that this helps![/QUOTE]


I think I understand the variable-part, as I know it from my math-classes, but those parameters I still don't really get :S If they are like variables, but with an additional limit, then why not just use the variables and leave out the parameters?

zonedabone 01-27-2010 03:56 PM

[QUOTE=Nephtysis;16128]I think I understand the variable-part, as I know it from my math-classes, but those parameters I still don't really get :S If they are like variables, but with an additional limit, then why not just use the variables and leave out the parameters?[/QUOTE]

Parameters aren't completely necessary. Whenever you add a parameter to an event, you can define that parameter as anything of the type specified every time that you call the event. They make the events customizable. For example, when you tell an object to move forward a certain amount, the way it handles that distance is using parameters. Anything that is set when an event is called are parameters. It's basically just a way to make your events act more like the events that are already created for you. Anything tan that you use is an event.

Hope this helps!

Dameria 01-27-2010 05:39 PM

When he says everything tan is an event, he means that those tan codes you drag over from the object's "methods" tab, like move or turn or resize, is an event. And those white boxes that you can change to what you want, those are parameters for the event. The move event (I call them methods) can move any object you put into that box. The object is the parameter, and in the code for that move method, the object you pick will be put in for that parameter and the method will move that particular object. Also the distance is a number parameter that you can change. These are not just variables, because they are not definitively set yet. They can be changed.

Sorry if its too confusing.

Nephtysis 01-27-2010 06:32 PM

It seems really confusing and I'm afraid I still don't quite understand. When this week is over and my schedule is kinda back to normal I'll just go and have another look at those functions and maybe some practise will help me see it better, because now it's a bit abstract and I can't really see what the difference is between the two in regards to how you use them in a program.

(/me is no longer junior member :))

Dameria 01-27-2010 06:57 PM

I have only been taking programming class (java) for a few months now, but I completely understand parameters because of it. Maybe you should take a programming class (if you are in high school). It has really helped me understand a lot about Alice because of the things I learned in the class so far, and on the other end Alice has taught me a lot about programming in Java.

I am planning on taking more advanced programming classes later on in high school and into college.

But anyway, if you really want to know the difference between parameters and variables, I guess you could just google it ;)

Nephtysis 01-27-2010 07:08 PM

I'm in university and we don't have those kind of courses in high school as far as I know, but I found something of a course on Python on the net and I'm also going to learn JavaScript, whenever I can find the time for it next to my 'normal' studying :P

Thanks for the help and I'll try it a bit and put what you wrote here next to it, maybe it makes more sense then. Oh, and I did check google and on the internet it's even more abstract with 'mathematical function' stuff and 'analytical geometry' and what else..

ok, talking gibberish now, time for bed.

zonedabone 01-27-2010 07:28 PM

Thanks for the explanation, Dameria. It's a bit hard to explain.

REDOS 02-10-2010 08:42 PM

Thanx
 
Yeah now i can understand better the use of parameters, it was kind of confusing =) thank all of u who post something here.


All times are GMT -5. The time now is 10:03 AM.

Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.