• Log in or sign up for an account here: https://www.sythe.org/login

Batch, How do you make a random out come?

NameGuy

Guru
Banned
Joined
Jul 22, 2012
Sythe Gold
0
Messages
1,007
Location
Canada
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
 
Runescape Gamblingrunescape gambling
Back
Top