SOLVED: Region and previous rooms with Has Inventory dillemas...

Started by barefoot, Fri 16/07/2010 20:09:29

Previous topic - Next topic

barefoot

Hi

I think I'm having a mind blowing time at the moment... could someone look at this for me and correct .. I think you should see what i am trying to do..  will explain more if asked.

Any tips with script appreciated..

Code: ags

function region2_WalksOnto()
{ 
  if (player.PreviousRoom==61)
   object[2].Move(42, 497, 4, eBlock, eAnywhere);
   
  if (player.PreviousRoom==61)
   cindy_bones.Say("We've done that task!");

  else
  
  if (player.HasInventory (irod)) {
  }
  if (player.PreviousRoom==59)
   
 Display("You enter into the next room cautiously");
    if (player.PreviousRoom==59)
   cprof_plum.ChangeRoom(60, 321, 355);
    if (player.PreviousRoom==59)
    cindy_bones.ChangeRoom(60, 331, 345);
}


cheers

-bareoot-

I May Not Be Perfect but I Have A Big Heart ..

Calin Leafshade

ok you need to break this up.. youre having some problem with your curly brackets (sounds painful)

lets take a look

Code: ags

function region2_WalksOnto()
{ 

  if (player.PreviousRoom==61){

       object[2].Move(42, 497, 4, eBlock, eAnywhere);
       cindy_bones.Say("We've done that task!");

  }
  else if (player.HasInventory (irod) && player.PreviousRoom ==59) {

       Display("You enter into the next room cautiously");
       cprof_plum.ChangeRoom(60, 321, 355);
       cindy_bones.ChangeRoom(60, 331, 345);

  }
}


Now that is not exactly what your code did but I think thats what it *should* do.

Do you see how I've grouped unnecessary if statements together?

If you dont understand I can go into more detail.

barefoot

Calin... once again you've saved my bacon.. many thanks...

I see endless possibilities and try to put them into practice... sometimes of course i trip over.

Thank you for showing me about putting those conditions together. Once learnt, always remembered.. And I really must keeep an eye on my braces ;)

And yes, it works perfick...

Cheers

-barefoot-
I May Not Be Perfect but I Have A Big Heart ..

SMF spam blocked by CleanTalk