Batch, How do you make a random out come?

Discussion in 'Programming General' started by NameGuy, Oct 1, 2012.

Batch, How do you make a random out come?
  1. Unread #1 - Oct 1, 2012 at 3:40 PM
  2. NameGuy
    Joined:
    Jul 22, 2012
    Posts:
    1,007
    Referrals:
    1
    Sythe Gold:
    0

    NameGuy Guru
    Banned

    Batch, How do you make a random out come?

    I'm currently working on a text virson off RS using batch files. I need to find out thought how to make it pick a random out come for cutting logs, fishing ect..
    Example I would have something like this

    Code:
    :oaklog
    :fail
    :fail
    :fail
    :fail
    :chop
    So I need some way of it picking a random outcome for failing on chopping the log if you have any idea on how I would do this please let me know! :D
    EDIT: I found out how to do this mod please close all so heres the code on how to do this:
    Code:
    @echo off
    title Oak Tree Test
    :top
    cls
    echo Hello would you like to chop down a oak tree?
    echo (Y/N)
    set /p test=:
    
    if %test%==y goto yes
    if %test%==Y goto yes
    if %test%==n exit
    if %test%==N exit
    
    :yes
    set /a valrange= (5-1) + 1
    set /a rando1= ( %random% %% %valrange% )
    
    if %rando1%==1 goto chop
    if %rando1%==2 goto fail
    if %rando1%==3 goto fail
    if %rando1%==4 goto fail
    if %rando1%==5 goto chop
    
    :fail
    cls
    echo You failed to chop the tree.
    echo press any key to go back
    pause
    goto top
    
    :chop
    cls
    echo congratz you choped a one oak log.
    echo press any key to go back
    pause
    goto top
     
< My First Bot | Rsps >

Users viewing this thread
1 guest


 
 
Adblock breaks this site