PDA

View Full Version : New random variable in batch


Sparky•The•Elf
06-10-04, 05:49 PM
In DOS, there is a variable command, %random% which will randomly generate a number between 0 and 30-something-thousand. I want to make a variable similar to that, which would only give me a number between 0 and 10, so I can have actions in my game which would only happen if the variable comes back as 5, or something to that effect. Is this possible? If not, is there any sort of command I can use as an OR command? There is no OR or ELSE in batch, but there must be something I can use in their place

Sparky•The•Elf
06-11-04, 11:54 PM
nvm everyone i've figured it out, it's quite simple really

set random2=%time:~-2%
if '%random2%' LEQ '49' goto wherever
goto wherever_else

the above gives you a 50% chance of whatever happening