Okay, this here function performed very nicely in version before - I think - say - version 2.50, 2.52, somewhere around that. Then it became really, really slow, although it works. What has caused this great slowing down? I haven't changed anything in my script!
What this does:
I have an open electronic lock in the game, and the character uses inventory item "wires" to connect them to different nodes of the lock to find the proper combination and unlock it.
"pointa" is the starting point, the node at which player clicked first with mode 4, useinv (wires)
"pointb" is the ending point, the node at which player clicked after he chose the first node to attach the wire to.
function room_a() {
// script for room: Repeatedly execute
if (pointa>0) {
if (pointb<1) {
if ((GetCursorMode()==4)&&(character[EGO].activeinv==46)) {
if (pointa==10) {
RawRestoreScreen ();
RawDrawLine (139, 52, mouse.x, mouse.y);}
if (pointa==1) {
RawRestoreScreen ();
RawDrawLine (140, 57, mouse.x, mouse.y);}
if (pointa==2) {
RawRestoreScreen ();
RawDrawLine (141, 62, mouse.x, mouse.y);}
if (pointa==3) {
RawRestoreScreen ();
RawDrawLine (141, 67, mouse.x, mouse.y);}
if (pointa==4) {
RawRestoreScreen ();
RawDrawLine (141, 73, mouse.x, mouse.y);}
if (pointa==5) {
RawRestoreScreen ();
RawDrawLine (142, 78, mouse.x, mouse.y);}
if (pointa==6) {
RawRestoreScreen ();
RawDrawLine (142, 83, mouse.x, mouse.y);}
if (pointa==7) {
RawRestoreScreen ();
RawDrawLine (142, 89, mouse.x, mouse.y);}
if (pointa==8) {
RawRestoreScreen ();
RawDrawLine (142, 94, mouse.x, mouse.y);}
if (pointa==9) {
RawRestoreScreen ();
RawDrawLine (142, 99, mouse.x, mouse.y);}
if (pointa==11) {
RawRestoreScreen ();
RawDrawLine (152, 101, mouse.x, mouse.y);}
if (pointa==12) {
RawRestoreScreen ();
RawDrawLine (153, 69, mouse.x, mouse.y);}
if (pointa==13) {
RawRestoreScreen ();
RawDrawLine (171, 72, mouse.x, mouse.y);}
}
}
else {//pointb juz podlaczone
if (((pointa==7)&&(pointb==13))||((pointb==7)&&(pointa==13))) {
invwires=invwires-1;PlaySound(1);ObjectOn(3);RawRestoreScreen ();
if (invwires==0) {SetPlayerCharacter(EGO);LoseInventory(46);}
Display("Beep! Seems this connection is right.");
pointa=0;pointb=0;cona=1;}
else if (((pointa==4)&&(pointb==11))||((pointa==11)&&(pointb==4))) {
invwires=invwires-1;PlaySound(1);ObjectOn(4);RawRestoreScreen ();
if (invwires==0) {SetPlayerCharacter(EGO);LoseInventory(46);}
Display("Beep! Seems this connection is right.");
pointa=0;pointb=0;conb=1;}
else if (((pointa==10)&&(pointb==3))||((pointa==3)&&(pointb==10))) {
invwires=invwires-1;PlaySound(1);
ObjectOn(5);RawRestoreScreen ();
if (invwires==0) {SetPlayerCharacter(EGO);LoseInventory(46);}
Display("Beep! Seems this connection is right.");
pointa=0;pointb=0;conc=1;}
else {Display("Nope. No sound. I remove the wire, let's try one more time.");
pointa=0;pointb=0;RawRestoreScreen ();}
}
}
What this does:
I have an open electronic lock in the game, and the character uses inventory item "wires" to connect them to different nodes of the lock to find the proper combination and unlock it.
"pointa" is the starting point, the node at which player clicked first with mode 4, useinv (wires)
"pointb" is the ending point, the node at which player clicked after he chose the first node to attach the wire to.
function room_a() {
// script for room: Repeatedly execute
if (pointa>0) {
if (pointb<1) {
if ((GetCursorMode()==4)&&(character[EGO].activeinv==46)) {
if (pointa==10) {
RawRestoreScreen ();
RawDrawLine (139, 52, mouse.x, mouse.y);}
if (pointa==1) {
RawRestoreScreen ();
RawDrawLine (140, 57, mouse.x, mouse.y);}
if (pointa==2) {
RawRestoreScreen ();
RawDrawLine (141, 62, mouse.x, mouse.y);}
if (pointa==3) {
RawRestoreScreen ();
RawDrawLine (141, 67, mouse.x, mouse.y);}
if (pointa==4) {
RawRestoreScreen ();
RawDrawLine (141, 73, mouse.x, mouse.y);}
if (pointa==5) {
RawRestoreScreen ();
RawDrawLine (142, 78, mouse.x, mouse.y);}
if (pointa==6) {
RawRestoreScreen ();
RawDrawLine (142, 83, mouse.x, mouse.y);}
if (pointa==7) {
RawRestoreScreen ();
RawDrawLine (142, 89, mouse.x, mouse.y);}
if (pointa==8) {
RawRestoreScreen ();
RawDrawLine (142, 94, mouse.x, mouse.y);}
if (pointa==9) {
RawRestoreScreen ();
RawDrawLine (142, 99, mouse.x, mouse.y);}
if (pointa==11) {
RawRestoreScreen ();
RawDrawLine (152, 101, mouse.x, mouse.y);}
if (pointa==12) {
RawRestoreScreen ();
RawDrawLine (153, 69, mouse.x, mouse.y);}
if (pointa==13) {
RawRestoreScreen ();
RawDrawLine (171, 72, mouse.x, mouse.y);}
}
}
else {//pointb juz podlaczone
if (((pointa==7)&&(pointb==13))||((pointb==7)&&(pointa==13))) {
invwires=invwires-1;PlaySound(1);ObjectOn(3);RawRestoreScreen ();
if (invwires==0) {SetPlayerCharacter(EGO);LoseInventory(46);}
Display("Beep! Seems this connection is right.");
pointa=0;pointb=0;cona=1;}
else if (((pointa==4)&&(pointb==11))||((pointa==11)&&(pointb==4))) {
invwires=invwires-1;PlaySound(1);ObjectOn(4);RawRestoreScreen ();
if (invwires==0) {SetPlayerCharacter(EGO);LoseInventory(46);}
Display("Beep! Seems this connection is right.");
pointa=0;pointb=0;conb=1;}
else if (((pointa==10)&&(pointb==3))||((pointa==3)&&(pointb==10))) {
invwires=invwires-1;PlaySound(1);
ObjectOn(5);RawRestoreScreen ();
if (invwires==0) {SetPlayerCharacter(EGO);LoseInventory(46);}
Display("Beep! Seems this connection is right.");
pointa=0;pointb=0;conc=1;}
else {Display("Nope. No sound. I remove the wire, let's try one more time.");
pointa=0;pointb=0;RawRestoreScreen ();}
}
}