0

I am trying to make a batch game but get the error,

Missing operator set was unexpected at this time

The code is:

set hp=100
set exp=0
set exptill=60
set gold=0
set lvl=1
set attack=4
set powergain=3
set weaponpower=2
set weaponprice=120
set pots=0
set armor=0
set weapon=0
set music=0
set class=0
Garrett Hyde
  • 5,409
  • 8
  • 49
  • 55
  • Wait it was operand NOT operator sry guys... still plz help –  Oct 07 '13 at 23:40
  • 1
    Your error message is not associated with the simple `set` command. You should show more code. – Endoro Oct 08 '13 at 00:00
  • That code doesn't return any error. Place a `pause` command here and there in your code and try to isolate where the error is being generated. – foxidrive Oct 08 '13 at 00:22

2 Answers2

1

This code is working perfectly for me, on Windows 7 CMD. you could try @henderso's answer, however it's likely not this particular part of the code which is causing the error. It would be helpful if you could include more of the code before.

You could also try enclosing the numbers with double quotes ("), as well as any of the if commands testing the variables.

Poyo
  • 554
  • 1
  • 9
  • 23
0

The script above worked for me (Windows 7 CMD).

Check for stray characters in your text file. Also the CR/LR line ending settings and encoding of any text editors.

Try adding the following command between each line: pause

This may help you debug:

set hp=100
pause
set exp=0
pause
set exptill=60
pause
set gold=0
pause
set lvl=1
pause
set attack=4
pause
set powergain=3
pause
set weaponpower=2
pause
set weaponprice=120
pause
set pots=0
pause
set armor=0
pause
set weapon=0
pause
set music=0
pause
set class=0
pause
henderso
  • 1,035
  • 8
  • 13
  • The error wasn't in part of the code I gave you it was hooked to it by the goto command here is the code that the error was in `set /a temp2=(%hp% * %lvl% + %exp% * %exptill% + %wepprice% + code %power% * %weppower%)/(%gold% + %pots% * %powergain%) code if not %temp1% equ %temp2% set temp3=1` –  Oct 08 '13 at 19:49