True or false:
If function1 calls function2, and function2 calls 'ChangeRoom,' then function2 ends, right?
And function1 will end as well? So adding 'return' is redundant?
(Edited for clarity)
No. The Room Change will occur after the script has completed.
Quote from: SSH on Thu 12/06/2008 12:16:49
No. The Room Change will occur after the script has completed.
So in this imaginary example:
function do_A()
{ Display("A1");
player.changeRoom(x);
Display("A2");
}
function do_B()
{ Display("B1");
do_A();
Display("B2");
}
Running do_B() I would expect to see displayed B1, A1,A2,B2, and THEN the room changes?
Yes, that's indeed what will happen. But wouldn't it be easier just trying it out (like I just did) than writing the code and then post it on the forum?
Quote from: GarageGothic on Thu 12/06/2008 19:11:03
Yes, that's indeed what will happen. But wouldn't it be easier just trying it out (like I just did) than writing the code and then post it on the forum?
Often my code SEEMS to be doing one thing, but it's ACTUALLY doing something else and the desired result was only a coincidence. So it's good to check with the experts.
True, but you COULD'VE tried your imaginary example first ;)