hello... i have a problem with this code:
in ROOM1:
state=5
player.changeroom (2);
inROOM2
if player enters in room (after fade in){
if (state==5) dDialog.start();
}
i have exported the variable state... and... if i display its value... i see a 5... but... conversation dDialog not start... ¿what can i do?
thank you.
Are any of the options in that dialog enabled?
yes.
i am using 2.72 version.
it could be a bug fixed in newer versions?
i need to change version?
What if you do this?
if player enters in room (after fade in){
if (state==5)
{
Display("Starting dialog");
dDialog.Start();
}
}
do you see the message?
NO, i don't see nothing....
but if i put the display before the if... i see.
and... i see state's value is 5!!!!!!
if player enters in room (after fade in){
Display("state = %d", state);
if (state==5)
{
Display("Starting dialog");
dDialog.Start();
}
}
Does it display 5?
How have you declared the "state" variable? Is it an "import" in the script header or have you declared it separately in both rooms?
i have exported state at the end of the global script of the as help says...
state is declared at global header script.
i have tried not to export state ... and import in the room 2... but it doesn't execute.
in help i see this text:
In order to import the variable, it must have been exported from the global script with the export keyword.
But... if i export... (at the end of the script) with:
export state; (state have been declared at script header)
and in the room script i write:
import int state (as help says).
When i compile... i have this error:
variavle state is already defined;
what i do wrong?
welll i see i have a great problem with visibility of the variables... i have a similar new problem...
ROOM 1
when players enters (after fade in)i
if (state ==1){
state = 2;
Display (%d,state)
}
then i have an event when i look at player:
Display (%d,state)
first display appears as 2
but when i look at player... state appears as... 1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
as before... i have exported state variable at the end of global script, and state have been declared at global header.
i cannot import at room script because i have an error "already defined state" if i try it.
Quote from: lucasa on Mon 24/03/2008 22:41:46
state is declared at global header script.
If by "global header script" you're talking about the script header, then
this is the problem, as this way you're just making duplicated variables called
state which are
local to each room.
Instead, define the variable
state on top of the global script (
not the script header) and then export it at the end of the script, like:
int state;
...
export state;
Then, in the script header (yes, the header this time) import the variable:
import int state;
Haven't read your other posts but I suspect they're similar problems.
thank you very much, that was the problem.
thank you thank you tnank you
:)
And btw, you can export the variable as soon as you've declared it, you don't have to put the export line at the end:
// top of global script
int state;
export state;
It's a bit tidier IMO, but that's personal preference.