Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Random Number post to 3-d Text (http://www.alice.org/community/showthread.php?t=4267)

ljb716 04-20-2010 03:36 PM

Random Number post to 3-d Text
 
I am making a dice game, and I want to randomize two different numbers. I got that part, but I can't figure out how to then make the random number = to the 3-d text so that it will post onto the square dice I made.

Does anyone know how to do this? Or is there another way besides the 3-d text to put a label out on the screen?

bjia56 04-20-2010 05:32 PM

You could always use the "print" method to print text, but it isn't in the world (it's in a boring little text box that appears below the play screen when text is printed).

Also, you can do:

[COLOR="Blue"]<insert text object name here> set text to (<insert variable name here> as a string)>
[/COLOR]
Unfortunately, the number retains the decimal point after conversion to string. I have no idea how to make it not include the decimal.

Hope that helped! If it didn't, please say so. :D

Dameria 04-20-2010 10:20 PM

In case you didn't understand, you set the text of the 3-D Text in the method you want, and then where you are supposed to input the text, you put in a block from the [b]Properties[/b] tab of [b]world[/b] called "[what] as a string". You then put in the variable you want for the [what].

There is a way to get rid of the decimal that comes up, so if u want to know just ask and I will tell you, but i see no point in explaining the creation of the method if you don't really care.

flats 04-23-2010 09:45 AM

[QUOTE=Dameria;20062]There is a way to get rid of the decimal that comes up, so if u want to know just ask and I will tell you, but i see no point in explaining the creation of the method if you don't really care.[/QUOTE]

Do you have a better way than using random number (java: randomNextDouble)?

Dameria 04-23-2010 10:20 AM

Nope, random number is the way that I was talking about. I used it in the maze game for another person, you can look for that if you want.

x2495iiii 04-23-2010 01:31 PM

[QUOTE=Dameria;20199]Nope, random number is the way that I was talking about. I used it in the maze game for another person, you can look for that if you want.[/QUOTE]

My problem is that it seems to be a glitch, as it doesn't work for me and my copy of Alice is pretty stable.

Dameria 04-23-2010 01:35 PM

Did you see how I did it using the maze? Did it not work for you there?

x2495iiii 04-23-2010 01:39 PM

Not even sorta. I knew it wouldn't, though.

It's stuff like that that makes me wish I was better at editing complex raw code, so I could just go in, make a few tweaks, and have it change from doubles to integers (it's not a difficult thing, really).

Dameria 04-23-2010 03:41 PM

So random numbers don't work at all for you? Maybe its just your version then.

x2495iiii 04-23-2010 06:50 PM

No, random numbers work, but the decimal cutting method you used doesn't.

If random numbers didn't work for me, I wouldn't have been able to make RP.

Dameria 04-23-2010 07:27 PM

But it works perfectly on my computer. Is anyone else having this problem with the decimal cutting? What exactly do you see when you click on a lollipop in the maze? or does it just have a the number and decimal?


All times are GMT -5. The time now is 01:10 PM.

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