Similar if statements, one works, one does not [SOLVED]

Started by cipberbloom, Fri 16/04/2021 00:36:25

Previous topic - Next topic

cipberbloom

Hiya, everyone--

I've been staring at this and tweaking it and referencing and re-referencing the manual, but haven't been able to sort out why it isn't working. On the first click, the character is meant to say his line and enter room 2, which works fine. On a subsequent click, if the character is holding inventory item iDinceyDollBrush, he's to walk to the X and Y coords given and change views (if he's not holding iDinceyDollBrush, he just says something else and goes into room two). For some (probably very simple) reason, he just keeps doing the first thing: he says his line and enters room 2.

Code: ags

function hDincey_AnyClick()
{
    if (dollsCounter == 0)
  {
  cMalcolm.SayBubble("Those are some of my friends. I like to play with them, but I'm not sure they like me overly much.");
  cMalcolm.ChangeRoom(2);
  }
    if (dollsCounter >= 1 && cMalcolm.ActiveInventory == iDinceyDollBrush)
  {
  cMalcolm.LoseInventory(iDinceyDollBrush);
  cMalcolm.Walk(650, 546, eBlock, eWalkableAreas);
  cMalcolm.SayBubble("Here you are, my pretties. Theodora, please forget what I said about you looking like my mum. Although as cruel as she was, she was legendarily beautiful. Ow!");
  cMalcolm.UnlockView(21);
  Wait(40);
  cMalcolm.LockView(1);
  }
    if (dollsCounter >= 1 && cMalcolm.ActiveInventory != iDinceyDollBrush)
  {
  cMalcolm.SayBubble("Time to check in on the well-being of my little friends again...");
  cMalcolm.ChangeRoom(2);
  }
}


Here's another if statement that's working fine, a simple, 'Say something else when you click the hotspot if you've already picked up the item' bit of business.

Code: ags

function oSpidergraph_Interact()
{
    if (spidergraphCounter == 0)
  {
  cMalcolm.Walk(505, 617, eBlock, eWalkableAreas);
  cMalcolm.SayBubble("Yes, I do love Spidergraph. Let's play! I'll take the jar.");
  cMalcolm.AddInventory(iSpidergraphJar);
  invenOverlay = Overlay.CreateGraphical(300, 300, 137, false);
  Wait(40);
  invenOverlay.Remove();

    }
    if (spidergraphCounter == 1)
  {
    cMalcolm.SayBubble("The box is now as empty as my existence.");
    }
    if (spidergraphCounter == 2)
  {
    cMalcolm.SayBubble("Es ist total leer.");
    }
    if (spidergraphCounter >= 3)
  {
    cMalcolm.SayBubble("...cough.");
    }
    if (spidergraphCounter < 4)
  {
    spidergraphCounter += 1;
    }
}


What have I f***** up? I try to figure stuff out on my own and not clutter the forum, and always really appreciate any help, hints, and suggestions given. Thanks very much in advance!

:)

EDIT: Gahhh... minutes after I posted this my partner pointed out that I missed out the line to increment.

Code: ags

  {
    dollsCounter += 1;
    }



I'll delete this post if I can.

:-[

SMF spam blocked by CleanTalk