knize002 Posted March 23, 2016 Posted March 23, 2016 (edited) Hello, i have a problem, im doing a little text-based game in command prompt, but i dont know how to make the text what was written before delete. Anybody knows how to do it? I attached the .txt file of the game, details in the file. And i need an command in style of "use this 100 times then go on with the next command" too. So if anybody knows, please tell me. Thanks Hra 2.0.txt Edited March 23, 2016 by knize002
NoelC Posted March 24, 2016 Posted March 24, 2016 I didn't look over your file but generally speaking, you delete text on a character display by writing over printing characters with blanks. -Noel
jaclaz Posted March 24, 2016 Posted March 24, 2016 What about CLS? http://ss64.com/nt/cls.html As a side note; I KNOW THAT I COULD DO IT LIKE : :b echo %random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random% goto b BUT IT WONT STOP IF I DO IT LIKE THAT, SO I HAD TO DO IT THAT STYLE. IF ANYBODY OF YOU KNOWS HOW TO DO LIKE "WRITE IT 100 TIMES THEN GO ON THE NEXT COMMAND" PLEASE TELL ME it is a simple FOR /L loop FOR /L %%A IN (1,1,100) DO ( ECHO something ) jaclaz
knize002 Posted March 24, 2016 Author Posted March 24, 2016 (edited) @jaclaz Thanks, i looked over the link you sent, and thats it. I tried it out and it works. Thanks! (sorry, i messed up, i thought NoelC sent me the link ) Edited March 24, 2016 by knize002
jaclaz Posted March 24, 2016 Posted March 24, 2016 Just now, knize002 said: @NoelC Thanks, i looked over the link you sent, and thats it. I tried it out and it works. Thanks! Hmmm. jaclaz
knize002 Posted March 24, 2016 Author Posted March 24, 2016 @jaclaz I dont know much about how the looping you described works, but i will find out, and ill try it. Thanks for help!
knize002 Posted March 24, 2016 Author Posted March 24, 2016 @jaclaz I´m trying to understand the FOR looping, but i dont know which parameter to use. It always writes me that the one i used wasnt expected
jaclaz Posted March 24, 2016 Posted March 24, 2016 http://ss64.com/nt/for_l.html http://www.robvanderwoude.com/ntfor.php jaclaz
knize002 Posted March 24, 2016 Author Posted March 24, 2016 @jaclaz i found myself the ss64.com and i looked in cmd for help too, but i still dont know which variable to use. I couldnt find any list of them.
knize002 Posted March 24, 2016 Author Posted March 24, 2016 @jaclaz Ok, so i used %%i for the parameter and it worked. But can i somehow change the speed of it? I wanted it for the "Matrix effect", but its too fast. When i used the infinite looping :a echo ... goto a it wasnt that fast and it created the "Matrix effect" better. But it was infinite. So if i could somehow decrease the speed....
knize002 Posted March 24, 2016 Author Posted March 24, 2016 Ok, so i managed the "Matrix effect". I used the FOR looping, but i used less times in the command, and i stack the command so it went a bit slower. Like this: FOR /L %%i IN(1,1,20) DO echo %random%.... FOR /L %%i IN(1,1,20) DO echo %random%.... FOR /L %%i IN(1,1,20) DO echo %random%.... FOR /L %%i IN(1,1,20) DO echo %random%.... etc. Thanks for helping guys!
jaclaz Posted March 24, 2016 Posted March 24, 2016 Well, you can introduce a delay between the execution of the commands, *any* command without a definite output to the console would do. Usually a "ping to to self" is used, but to just slow down a little bit a loop, you can also insert another FOR /L loop FOR /L %%A IN (1,1,100) DO ( echo %random% FOR /L %%B IN (1,1,10) DO ( echo %random%>NUL ) ) jaclaz
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now