Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

Flashing color screens and random percentages for RPG help?

Hey Batch guys,

I'm on vacation right now with nothing to do but make a random batch RPG for educational purposes.


I can post the code if needed but it's kind of irrelevant to my question,
which is, how can I make it so after a scene of, lets say, a bear comes and attacks you,
Your CMD flashes black and white or black and purple etc. very fast, maybe 3 times a second?



•so far for this I'm thinking of something like this
Code
...
cls
Color 70
TIMEOUT /t 1
Color 7f
TIMEOUT /t 1
Color 70
...
cls
Goto next
Mind you, I'm a rookie, so it's pretty obvious that using timeout will only let me flash the screen in one second intervals. My hypothesis is that if I put a bunch of spaghetti code to make the program load and then change the color, then repeat, that maybe it'll take like a fraction of a second to load the next color. Haven't tested this yet.


So far for this I
Also, in a fight scene, how can I give the option to fight with a 30% win chance and a 60% chance of running away, and a 10% chance of using a trap?

I have no idea how to accomplish this, a reference for how to do this would be great.

(P.S. Sorry if this is random, I don't expect anybody to just write all the code for me, referencing me to a source is fine, or tips)
For sleep a lot use "pathping"

I can't undestand the second question...
(Jul 8, 2016 02:33 AM)einstein1969 Wrote:  For sleep a lot use "pathping"

I can't undestand the second question...

I guess I made that complicated, I'm asking how I can make something either happen or not happen based on a percentage like 50% or 75% for example

Code
*A monster suddenly appears*

(1) Run [50%]
(2) fight [75%]

Where pressing 2 gives a 75% chance of success and 25% chance of failure
You can use the %random% variable to simulate a probability.

Code
Set P1=25
Set P2=75

set /A "P=%random% %% (P1+P2)"

if %P% grt %P1% (echo event P2) else echo event P1
(Jul 8, 2016 05:30 AM)einstein1969 Wrote:  You can use the %random% variable to simulate a probability.

Code
Set P1=25
Set P2=75

set /A "P=%random% %% (P1+P2)"

if %P% grt %P1% (echo event P2) else echo event P1

Thanks a lot buddy, although I'm trying to figure out how to effectively implement this into my game

So here's my code
Code
:2nd_scene
echo The bump in the road causes your tire to fall off
Echo.
Echo.
echo (1) leave your car and try to find help [75%]
echo (2) sleep in your car for the night and leave tomorrow [35%]
Set /p var3="C:\ "

if var3 == 1 goto random
If var3 == 2 goto random
Goto 2nd_scene

:random
Your code goes here

So I need to make it so when I press 1 at that scene it will be successful or not, when I do that with your code it just closes the window


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by realsunjesterApr 28, 2019 06:46 AM 0 128 Apr 28, 2019 06:46 AM
Last Post: realsunjester
[Python] by -Matatan-Jun 13, 2018 03:58 AM 4 112 Jun 13, 2018 03:58 AM
Last Post: michalmonday
[C] by Lexxi.Dec 8, 2016 09:07 PM 12 596 Dec 8, 2016 09:07 PM
Last Post: Lexxi.