Hi there.
While developing my game, i wanted to give the player the possibility to choose between diferent characters.
So I didn't want to make things very hard, so i decided to use a Dialog to give the player that possibility.
Well, the problem is that when it apears the Dialog window ans I choose the main character, it works, but when i choose the secondo one the game cracks and telling me:
Error: NewRoom: two NewRoom/RunDialog/StopDialog requests within dialog.
The error takes place at line 565 in this part of the code.
557 function dialog_request(int parameter) {
558 if (parameter == 1){
559 character[TONI].SetAsPlayer();
560 player.ChangeRoom(4, 260, 141);
561 SetCursorMode(eModePointer);
562 }
563 if (parameter == 2){
564 character[ALV].SetAsPlayer();
565 player.ChangeRoom(4, 260, 141);
566 SetCursorMode(eModePointer);
567 }
568 }
Don't know what happens exactly. What's the difference, or how can I fix this.
I'm not sure if it helps, but you could try changing the latter if to an else if...
Character.setAsPlayer() also moves the game to the room they are in - immediately following this with player.ChangeRoom is likely what causes the error. (NOTE: I think this is still true if the 'new' player is in the same room as the old one.) Maybe changing the order the commands are run would help, e.g.:
563 if (parameter == 2){
564 cAlv.ChangeRoom(4, 260, 141);
565 cAlv.SetAsPlayer();
566 SetCursorMode(eModePointer);
567 }
Also, what version are you using? Character.ChangeRoom / SetAsPlayer are version 2.7+, while SetCursorMode is 2.62 and lower. You should be using mouse.Mode (e.g. mouse.Mode == eModePointer;) in 2.7+.
It worked, thank you Ashen.
Anyway, yhank you to Ishmael.