Hi, I'm having a problem with _useInv and ActivateInventory

Started by Enchart, Thu 25/06/2015 07:17:35

Previous topic - Next topic

Enchart

I've managed to get UseInv() working elsewhere. But now I made a little bit longer code which returns following error message:
"room6.asc(72): Error (line 72): buffer exceeded: you probably have a missing closing bracket on a previous line"

Now I've checked this code for atleast ten times and even slept on it but couldn't find what's wrong.
Code: ags

function oCyborgeadUp_UseInv(){
  if (cDoe.ActiveInventory == iHoe){
          if (SkullDown > 0){
          cDoe.Say("I need something bit longer");}
          else if (SkullDown == 0){
            cDoe.Walk(266, 550, eBlock, eWalkableAreas);
            Wait(20);
            cDoe.Say("This is too short to grab on anything");
            SkullDown = 1;}}
  else if (cDoe.ActiveInventory == iHockeystick){
          if (SkullDown == 2) {
          cDoe.Say("How can I find something little bit longer?");}
          else if (SkullDown != 2){
            cDoe.Walk(266, 550, eBlock, eWalkableAreas);
            Wait(20);
            cDoe.Say("Just an inch or so and I could grab that chain");
            SkullDown = 2;}}
  else if (cDoe.ActiveInventory == iGrablinghook){
          cDoe.Walk(266, 550, eBlock, eWalkableAreas);
          Wait(20);
          cDoe.Say("Ok let's grab that chain");
          Wait(20);
          cDoe.Say("It's working and something is coming down with that chain");
          oChainUp.Visible = false;
          oCyborgeadUp.Visible = false;
          oChainDown.Visible = true;
          oCyborgeadDwn.Visible = true;
  SkullDown = 3;}
else {}}


Thanks before hand for help

Gurok

There's nothing wrong with the brackets in the code snippet you provided. Try looking above this function (i.e. in functions prior to oCyborgeadUp_UseInv) for mismatched brackets.
[img]http://7d4iqnx.gif;rWRLUuw.gi

Snarky

This is a good example of why proper code formatting is important. Check it out after reformatting:

Code: ags

function oCyborgeadUp_UseInv()
{
  if (cDoe.ActiveInventory == iHoe)
  {
    if (SkullDown > 0)
    {
      cDoe.Say("I need something bit longer");
    }
    else if (SkullDown == 0)
    {
      cDoe.Walk(266, 550, eBlock, eWalkableAreas);
      Wait(20);
      cDoe.Say("This is too short to grab on anything");
      SkullDown = 1;
    }
  }
  else if (cDoe.ActiveInventory == iHockeystick)
  {
    if (SkullDown == 2)
    {
      cDoe.Say("How can I find something little bit longer?");
    }
    else if (SkullDown != 2)
    {
      cDoe.Walk(266, 550, eBlock, eWalkableAreas);
      Wait(20);
      cDoe.Say("Just an inch or so and I could grab that chain");
      SkullDown = 2;
    }
  }
  else if (cDoe.ActiveInventory == iGrablinghook)
  {
    cDoe.Walk(266, 550, eBlock, eWalkableAreas);
    Wait(20);
    cDoe.Say("Ok let's grab that chain");
    Wait(20);
    cDoe.Say("It's working and something is coming down with that chain");
    oChainUp.Visible = false;
    oCyborgeadUp.Visible = false;
    oChainDown.Visible = true;
    oCyborgeadDwn.Visible = true;
    SkullDown = 3;
  }
  else
  {}
}


It is now obvious that the brackets all match, so the error must be somewhere else. (Also, in general it would be helpful if you let us know where "line 72" is in the excerpt you posted, though it wouldn't have made a difference in this case.)

Enchart

Thanks a lot.
The problem was in one of the functions before this. (I thought I had checked those good as well).
72th was line 13. in my excerpt.

Also thank you Snarky for your examble.

SMF spam blocked by CleanTalk