Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: barefoot on Thu 28/10/2010 19:26:14

Title: Script appears in another Room!
Post by: barefoot on Thu 28/10/2010 19:26:14
Hi

Im very curious to know why some script from a Room appears in a later Room!

The earlier Room used Hotspots that now reside in the later Room script!

Any ideas??

bareoot



Title: Re: Script appears in another Room!
Post by: Pumaman on Thu 28/10/2010 23:08:38
You'll need to be much more specific about what exactly has happened and what you did...
Title: Re: Script appears in another Room!
Post by: barefoot on Fri 29/10/2010 09:12:20
Quote from: Pumaman on Thu 28/10/2010 23:08:38
You'll need to be much more specific about what exactly has happened and what you did...

This has appeared for some strange reason in Room 58, i don't even think I coded it originally as I used 'UseInv on mino' which is in room 53, Instead of below code!

Without deleting Hotspot(s) i am having to use new ones in Room 58.


function hHotspot1_UseInv()
{

  if (player.ActiveInventory == iacid) {
  Display("You throw the acid into the Minotaurs Face");
  cmino2.ChangeView(57);
  Display("You see a Key that has fallen from the Minotaur's pocket so you pick it up");
  cmino2.ChangeView(56);
  cindy_bones.AddInventory(iKey2);
  cmino2.FollowCharacter(null);
   cmino2.StopMoving();
 
 StopAmbientSound(1);
 Display("You need to finish the job and kill it!!!");
 cindy_bones.Say("I can't kill it, I'm not a murderer!! Professor! Come on we need to move on quick!!");
 cprof_plum.Say("I'm coming Indy!");
 
 cprof_plum.Transparency=0;
 cindy_bones.Say("Keep well away from him Professor, he may wake at any time!");
 cprof_plum.FollowCharacter(cindy_bones, 10, 90);
 
}

if (player.ActiveInventory == imatches) {
  Display("No good using matches!!");
 
}

if (player.ActiveInventory == itorch2) {
  Display("No good using a torch!!");
 
}

if (player.ActiveInventory == isword) {
  Display("You dare not go to close even with the sword!!");

}
}


barefoot
Title: Re: Script appears in another Room!
Post by: SSH on Fri 29/10/2010 10:40:35
Did you perhaps accidentally save the old room as a room template?

by the way, why is it OK to throw acid on someone's face but not to kill them! :)
Title: Re: Script appears in another Room!
Post by: Atelier on Fri 29/10/2010 10:47:47
Barefoot, if there's just one line of code after the if statement, brackets aren't necessary. So

if (player.ActiveInventory == imatches) {
  Display("No good using matches!!");
 
}

if (player.ActiveInventory == itorch2) {
  Display("No good using a torch!!");
 
}

if (player.ActiveInventory == isword) {
  Display("You dare not go to close even with the sword!!");

}


can become


if (player.ActiveInventory == imatches) Display("No good using matches!!");
if (player.ActiveInventory == itorch2) Display("No good using a torch!!");
if (player.ActiveInventory == isword) Display("You dare not go to close even with the sword!!");


It doesn't make any difference to how it works in the long run, it just makes your script easier to read.
Title: Re: Script appears in another Room!
Post by: barefoot on Fri 29/10/2010 10:52:37
Quote from: SSH on Fri 29/10/2010 10:40:35
Did you perhaps accidentally save the old room as a room template?

by the way, why is it OK to throw acid on someone's face but not to kill them! :)

Acid will injure but not nessessarily kill someone.. Room was saved as normal.

Yes, about the code, false of habit i need to change... lol

barefoot.