I'm givin up for a while

I am beginning to work on a Black Jack game and I was wondering if there was a way to generate a random number between 1-52 and send that integer as the subject of a message. My whole game depends on this. If anyone knows a way, preferrably without the use of python, then please tell me. Thank you.

there is no way without useing python, but i doubt if python has a *rnd function…

jacco;

import random

get a random number by using range() and the number in parentheses.

you’ll get 0-whatever yor number.

Could you elaborate a little more. I have no python experience at all. If it’s no trouble, could you tell me how to do this? Thanks.

[EDIT] I got the random number thing worked out, now I just need to know how to send a property as the subject of a message. I figured out how to send the property as the body of the message, but that doesn’t help because I don’t know how to take the body of the message as input to decide whether or not to do something like you can with the subject of the message. So if anyone can do either of these things, please let me know. THanks again.

add an sensor and python controller to an empty give it an integer prop called draw and set the python controller to run this script call it draw
every time the sensor sends a pulse a random number between 0 and 52
you will have to tweak it to stop it generating 0
cont=GameLogic.getCurrentController()
own=cont.getOwner()

draw=own.draw
draw=GameLogic.getRandomFloat()*52
own.draw=draw

Thanks. I think I found an easier way. To try to make this way even easier I have another question. Is there a way to set a sensor to see if a variable is equal to another variable. Well, property. Thanks again.

EDIT : Nope, nevermind. I’m back to square one.

I’m going to explain in detail what problem I need help solving. Once I solve this problem, I should be ok through rest of the game. I need to know how to take the information stored in a property and make it accessible by all of the objects in the scene. Is there a way to do this? If you know a solution to this in Python, please tell me how to use the code. I know absolutely nothing about Python. My background is in Visual Basic. But I might try learning Python. Anyway, please help if you can, preferably not in python, but if it works and I know how to use it and where to put it, then I’m fine with using Python. Thanks in advance.

It seems silly that blender’s random actuator is so useless. Would it be that hard to make it generate ACTUAL numbers, or maybe be able to set the seed value to the time or some other variable?

Pooba

I’m way past this problem now. I taught myself the basics of python. Now my problem is with collision detection. The first card deals and the collision is detected fine, but when the second card deals, it almost never detects the collision. If it doesn’t detect the second one I restart it over and over again until it does. It usually detects it 1 in 30 times. Why is this? What am I doing wrong. If you need me to post the Blend file just tell me. Thanks.

Maybe the bounds arent set right on the second card. I could probally find the problem if I had the blend.

Here’s the blend: http://dl12.rapidshare.de/files/8059060/269060791/Black_Jack2.blend.

The cards all have the same face right now. I didnt change it yet.

Until I solve the problem, the game creation is suspended until further notice. I’m now modeling a deer.

if the object was added theres an add object bug i think…

i havent checked out the blend but i think thats got to be the problem :stuck_out_tongue:

RonC

I dont see any problem. When I press Space the first card is dealt to me and the second to the computer (i suppose). No problem at all for me. Weird.

But if you listen, the second card doesn’t make a sound, and the card number thats floating in the middle of the screen doesn’t change.