Alright I tried the other way you said to do it with the MoveTo, it sort of works. The problem is that the onMouseClicked thing in the while loop gets activated immediately since you are clicking the door, a solution to that would be to put in a wait but it causes the character to delay doing stuff which is annoying.
I did however get a way that works, and doesn't even block the global script. It doesnt seem very elegant so if there's a way I can make it cleaner or something just tell me.
Code: ags
That did it, and it works but seems like stuff is getting passed around to different scripts like crazy. Tell me what you think about it, it's a decent solution to the problem I think and manages to decoy the games on_call function.
I did however get a way that works, and doesn't even block the global script. It doesnt seem very elegant so if there's a way I can make it cleaner or something just tell me.
//in room script for interact with object
//this moves player to 290, 140 with item to run on 1 and command to run on item 1
queuedCommand(290, 140, 1, 1);
//global script
bool inQueue=false;
int qx;
int qy;
function queuedCommand(int x, int y,int itemNum, int commandNum){
inQueue=true;
player.Walk(x, y);
qx=x;
qy=y;
SetGlobalInt(20, itemNum);
SetGlobalInt(21, commandNum);
}
function repeatedly_execute() {
if (inQueue&&player.x==qx&&player.y==qy){
inQueue=false;
CallRoomScript(0);
}
//in on mouse click
inQueue=false;
//back to room script now
function on_call(int dummy){
int itemNum=GetGlobalInt(20);
int commandNum=GetGlobalInt(21);
//Display("ARRIVED");
if (itemNum==1&&commandNum==1){
cEgo.ChangeRoom(5,45,160);
}
}
That did it, and it works but seems like stuff is getting passed around to different scripts like crazy. Tell me what you think about it, it's a decent solution to the problem I think and manages to decoy the games on_call function.