xboxscene.org forums

Author Topic: Possible Bug In Case Or If  (Read 304 times)

Jezz_X

  • Archived User
  • Hero Member
  • *
  • Posts: 2893
Possible Bug In Case Or If
« on: February 17, 2004, 12:53:00 PM »

Playing around again and notice that this

CODE

CASE 201
 IF %dialogname% == step1dialog GOTO SETSECONDVALUE
 IF %dialogname% == step2dialog GOTO SETORIGINALVALUE
ENDCASE

Wont work in the event handler of a dialog
But this Will
CODE

CASE 201
 IF %dialogname% == step1dialog THEN
   GOTO SETSECONDVALUE
 ENDIF
 IF %dialogname% == step2dialog THEN
   GOTO SETORIGINALVALUE
 ENDIF
ENDCASE
Logged

flattspott

  • Archived User
  • Hero Member
  • *
  • Posts: 1220
Possible Bug In Case Or If
« Reply #1 on: February 17, 2004, 01:29:00 PM »

Why not just do this

CASE 201
IF %dialogname% == step1dialog THEN
  GOTO SETSECONDVALUE
ELSE
  GOTO SETORIGINALVALUE
ENDIF
ENDCASE
Logged

BenJeremy

  • Archived User
  • Hero Member
  • *
  • Posts: 5645
Possible Bug In Case Or If
« Reply #2 on: February 17, 2004, 01:36:00 PM »

ARRGGHH!!!

Please do NOT use GOTOs in CASE statements. That's like crossing the proton streams. Very bad.
Logged

Jezz_X

  • Archived User
  • Hero Member
  • *
  • Posts: 2893
Possible Bug In Case Or If
« Reply #3 on: February 17, 2004, 01:38:00 PM »

Because it acutally has 4 things it has to check really I just didn't want to post them all so its not just a 2 choice check
Logged

Jezz_X

  • Archived User
  • Hero Member
  • *
  • Posts: 2893
Possible Bug In Case Or If
« Reply #4 on: February 17, 2004, 01:38:00 PM »

QUOTE (BenJeremy @ Feb 17 2004, 11:29 PM)
ARRGGHH!!!

Please do NOT use GOTOs in CASE statements. That's like crossing the proton streams. Very bad.

Why not it works fine
Logged

BenJeremy

  • Archived User
  • Hero Member
  • *
  • Posts: 5645
Possible Bug In Case Or If
« Reply #5 on: February 17, 2004, 01:34:00 PM »

QUOTE (Jezz_X @ Feb 17 2004, 06:31 PM)
QUOTE (BenJeremy @ Feb 17 2004, 11:29 PM)
ARRGGHH!!!

Please do NOT use GOTOs in CASE statements. That's like crossing the proton streams. Very bad.

Why not it works fine

Probably.... just makes me shudder wink.gif In reality, SWITCH doesn't leave anything on the IP stack, so it's probably OK.

As to the problem with single line IFs, I'm not sure what's happening there.
Logged

Jezz_X

  • Archived User
  • Hero Member
  • *
  • Posts: 2893
Possible Bug In Case Or If
« Reply #6 on: February 17, 2004, 01:52:00 PM »

OK then I ask this how else are you supposed to process data and execute actions from a button press or action in a dialog box
Logged

BenJeremy

  • Archived User
  • Hero Member
  • *
  • Posts: 5645
Possible Bug In Case Or If
« Reply #7 on: February 17, 2004, 02:23:00 PM »

QUOTE (Jezz_X @ Feb 17 2004, 06:45 PM)
OK then I ask this how else are you supposed to process data and execute actions from a button press or action in a dialog box

you can use nested SWITCH statements.

If blocks should also work.
Logged

geniusalz

  • Archived User
  • Hero Member
  • *
  • Posts: 1635
Possible Bug In Case Or If
« Reply #8 on: February 17, 2004, 02:53:00 PM »

smile.gif

Anyway, I think GOSUB can work well too
Logged