Search found 6 matches
- 20 Jan 2018 03:10
- Forum: DOS Batch Forum
- Topic: Redirecting using if statements?
- Replies: 6
- Views: 4339
Re: Redirecting using if statements?
Okay, sorry for being such a noob, great little trick with the dummy variable! Will definitely have to use that more often! Thanks a lot!
- 19 Jan 2018 01:25
- Forum: DOS Batch Forum
- Topic: Redirecting using if statements?
- Replies: 6
- Views: 4339
Re: Redirecting using if statements?
Here I'll post my code for you. I didn't change anything really though. set health= 3 set maxhealth= 7 :Main cls if %health%+5 GEQ %maxhealth% ( set /a health= %maxhealth% goto Main2 ) if %health%+5 LSS %maxhealth% ( set /a health+= 5 goto Main2 ) echo Your health has been restored by 5! pause >nul ...
- 18 Jan 2018 20:47
- Forum: DOS Batch Forum
- Topic: Redirecting using if statements?
- Replies: 6
- Views: 4339
Re: Redirecting using if statements?
Thank you for that, rookie mistake. But after I change it to /a it prints out 8 health even though the if statement should set it to 7 because 3 + 5 is 8 which is greater/equal to 7 which then i command it to set it to max health. But it seems its reading the second if statement that says if Less th...
- 18 Jan 2018 12:16
- Forum: DOS Batch Forum
- Topic: Redirecting using if statements?
- Replies: 6
- Views: 4339
Redirecting using if statements?
Hello everyone, I got some, what was presumably, thought as simple code but refuses to work. I set two variables to two different numbers and based on the values redirects it to different code blocks. Any help is appreciated! Also if I delete the Main2 code block and get rid of the "goto" statements...
- 16 Jan 2018 07:52
- Forum: DOS Batch Forum
- Topic: Comparing two variables to a number?
- Replies: 3
- Views: 2934
Re: Comparing two variables to a number?
Thank you, I posted this question to a few other forums and a mix of their answers along with yours helped me solve my problem with this code:
So, thank you!
Code: Select all
if %bandages% GEQ 1 (
if %teeth% GEQ 1 (
goto :CraftHealth5Complete
)
)
- 14 Jan 2018 23:01
- Forum: DOS Batch Forum
- Topic: Comparing two variables to a number?
- Replies: 3
- Views: 2934
Comparing two variables to a number?
Hello everyone thank you for taking the time to read this! Anyways I've been working on a game in batch for awhile now and within this game you can craft things from mob drops. For example a bandage is crafted from 2x flesh. This is the code used to get that to work: :ItemBandage cls Echo. echo Are ...