Hello I was making my 4k challange game and I was woundering how to code pick and prob procs. I looked at the ref and this is what I got.
pick(
prob(75)
walk(ball,SOUTH,speedofball)
)
Not too good you see but I wanted a 75 and 2 50 probs in the pick. This is the only code I will probley need for my game since every thing else is made so if you gladly give me an example of how to put these two procs together I would really Oppreciate it and give you credit for it.
ID:266974
Sep 20 2002, 12:38 pm
|
|
Sep 20 2002, 12:51 pm
|
|
Prob is probability, meaning something like prob(50) would give a 50% chance of "condition A" to happen, and a 50% chance of "condition B" to happen.
|
pick(
prob(42.8) usr << "You can afford an El Camino!" prob(28.6) usr << "You can afford a Mountaineer" prob(28.6) usr << "You can afford a Viper!" ) Thats the closest to 75,50,50 ratio I can get within 100. [EDIT] I think I'll explain pick while I'm at it, since Nadrew has already covered prob pick is like rand with multiple arguments and not necessarily using numbers (though it can) normally, pick and rand's args have equal probabilities of being chosen (for example, if there are 4 arguments, pick("Yes","No","Maybe","..."), each has a 25% chance of being chosen yet when they are edited, such as that above, the ratio is changed to whatever you wish |
In response to Nadrew
|
|
Why use if?? Cant u use pick() and if not what do you do use pick() for.
|
In response to Green Lime
|
|
Green Lime wrote:
Why use if?? Cant u use pick() and if not what do you do use pick() for. pick() will pick a random item from a list, or from its arguments. That doesn't sound like what you want at all. prob(n) has an n% chance of being 1; otherwise it's 0. Please tell me you're going to use shorter var names than "speedofball" in your actual code for the 4K. Lummox JR |
In response to Lummox JR
|
|
LOL yes I will Im just making an outline of the code. But also the ifs statment take up a lot of bytes dont they ?
& Ok thanks JR I will add you to the credits. |
In response to BobJr
|
|
Bob, you have it all wrong. They don't all have to add up to 100. Anyway, this is how you use the pick proc with probabilities, in the ratio you want:
pick(75;world << "A",50;world << "B",50;world<<"A") The first one has a 75% chance of being chosen over the norm, which is 100, and not used here. The other 2 have a 50% chance of being chosen over the norm. |
In response to Garthor
|
|
The first one has a 75% chance of being chosen over the norm, which is 100, and not used here. The other 2 have a 50% chance of being chosen over the norm. You say they have chance of being chosen over the normal, but you leave the possibility of none of them being chosen the way you explained it, so where do you say the "norm" is designated? |
In response to BobJr
|
|
The norm is hard-coded into the pick() proc. 200 100 100 is the same as 100 50 50. Ask Dan or Tom if you really want to know why they decided to even have a norm.
|