PDA

View Full Version : Variable


lexisisis
05-11-2009, 01:24 PM
Hi everyone,

I have a problem with variables and parameters.

I need some variables in the world I'm creating. In the program I need to let an object say the value, in a text balloon for example.

e.g. I make a variable, let's call it Hello and of the type number. When I play the world I will put the value 1 in it's memory. Now how can I also let an object say that "1" after I gave in the value. I has to work for every integer number I can give in.

Thanks a lot

Scott300
05-11-2009, 02:46 PM
Click on world than function

find the as a string function than drag the text bubble thing set it to say the default msg than drag as a string onto the Default msg than you can put the variable name in.

HisWorld
05-11-2009, 07:24 PM
Scott300 is right.

What you want to do requires you use a variable of type string. If however you were hoping to be able to manipulate some numbers you couldn't use a variable of type string to do things such as hello = hello + 5;
In order to be able to both display your number's in a string and to update the number's, typically in programming this is termed "casting".

I don't know of a way to do this other without causing a crash in Alice is utilizing a few functions.

The function ("what" as a string will) allow you to say or set 3D text to the value stored in an integer "number" variable.

I am attaching a program that should demonstrate this.

Hope this helps.

lexisisis
05-12-2009, 10:21 AM
Scott300 is right.

What you want to do requires you use a variable of type string. If however you were hoping to be able to manipulate some numbers you couldn't use a variable of type string to do things such as hello = hello + 5;
In order to be able to both display your number's in a string and to update the number's, typically in programming this is termed "casting".

I don't know of a way to do this other without causing a crash in Alice is utilizing a few functions.

The function ("what" as a string will) allow you to say or set 3D text to the value stored in an integer "number" variable.

I am attaching a program that should demonstrate this.

Hope this helps.

Thank you very much for your help. I tried what both of you said, and after a while of trying it worked.