Exemple #1
0
TRIGGER( use )(obj user)
{
  if(isAtHome(this))
  {
    systemMessage(user, "That ore belongs to someone else.");
    return(0x00);
  }
  if(hasObjVar(this, "inUse"))
  {
    systemMessage(user, "Someone is using that ore.");
    return(0x00);
  }
  else
  {
    setObjVar(this, "inUse", 0x01);
    attachscript(this, "removeinuse");
    callback(this, 0x1E, 0x1B);
  }
  int Q4Q1;
  int Q4YO;
  Q4Q1 = getResource(Q4YO, this, "metal", 0x03, 0x02);
  if(Q4YO > 0x04)
  {
    systemMessage(user, "Select the forge on which to smelt the ore, or another pile of ore with which to combine it.");
  }
  else
  {
    systemMessage(user, "Select another pile of ore with which to combine this.");
  }
  targetObj(user, this);
  return(0x00);
}
unsigned int DispenserControl::goToHome ()
{
    unsigned int stepsTaken = 0;
    while ( !isAtHome () )
    {
        stepsTaken += moveDispenserHead ( NUMBER_OF_STEPS_PER_REV, HOME );
    }
    return stepsTaken;
}
Exemple #3
0
FUNCTION void Q4E8(obj user, obj Q66M, int Q4QY, string name)
{
  if(isAtHome(this))
  {
    systemMessage(user, "You can't use that, it belongs to someone else.");
    return;
  }
  int Q66P = getObjType(Q66M);
  if(Q4Z2(Q66P))
  {
    if(!testSkill(user, 0x0D))
    {
      systemMessage(user, "You burn the food to a crisp! It's ruined.");
      destroyOne(this);
      return;
    }
    if(name != "default")
    {
      if(hasObjVar(this, "NAME"))
      {
        removeObjVar(this, "NAME");
        setObjVar(this, "NAME", name);
      }
    }
    if(random(0x00, 0x01))
    {
      barkTo(user, user, "Looks delicious.");
    }
    else
    {
      barkTo(user, user, "Mmmm, smells good.");
    }
    obj Q47F = getBackpack(user);
    int Q4TM;
    obj Q5CN = createGlobalObjectOn(this, Q4QY);
    if(!isInContainer(this))
    {
      if(canHold(Q47F, Q5CN))
      {
        Q4TM = putObjContainer(Q5CN, Q47F);
        systemMessage(user, "You put the cooked food into your backpack.");
      }
      else
      {
        Q4TM = teleport(Q5CN, getLocation(user));
        systemMessage(user, "You put the cooked food on the ground.");
      }
    }
    destroyOne(this);
  }
  else
  {
    systemMessage(user, "You can't cook on that.");
  }
  return;
}
Exemple #4
0
TRIGGER( use )(obj user)
{
  if(isAtHome(this))
  {
    systemMessage(user, "You can't use that, it belongs to someone else.");
    return(0x00);
  }
  int Q62A = getObjType(this);
  loc Q61U = loc( getLocation(this) );
  switch(Q62A)
  {
  case 0x1BD1:
    systemMessage(user, "Select the shafts you wish to use this on.");
    break;
  case 0x1BD4:
    systemMessage(user, "Select the feathers you wish to use this on.");
    break;
  }
  targetObj(user, this);
  return(0x00);
}
unsigned int DispenserControl::moveDispenserHead ( unsigned int steps, Direction direction )
{
    int delta = 1;
    if ( direction == HOME )
    {
        delta = -delta; // reduce steps moving towards Home
    }

    dispenserDirPin = direction;

    bool stopMotorMovement = false;
    unsigned int stepsTaken = 0;

    inMotion = true;
    while ( ( !stopMotorMovement ) && ( stepsTaken < steps ) )
    {
        testLimitSwitches ();

        if ( isAtHome () && ( direction == HOME ) )
        {
            stopMotorMovement = true;
        }
        else if ( isAtEnd () && ( direction == END ) )
        {
            stopMotorMovement = true;
        }

        if ( !stopMotorMovement )
        {
            dispenserStepPin = ON;
            dispenserStepPin = OFF;
            stepsTaken++;
            dispenserCurrentPosition += delta;
            wait_us ( STEPPER_MOTOR_DELAY_MICRO_SECS ); // To prevent motor from stalling
        }
    }
    inMotion = false;

    return stepsTaken;
}
Exemple #6
0
TRIGGER( targetobj )(obj user, obj usedon)
{
  if(usedon == NULL())
  {
    return(0x00);
  }
  if(isAtHome(usedon))
  {
    systemMessage(user, "That belongs to someone else.");
    return(0x00);
  }
  int Q62A = getObjType(this);
  int Q66P = getObjType(usedon);
  loc Q66U = loc( getLocation(user) );
  loc Q61U = loc( getLocation(this) );
  loc Q66N = loc( getLocation(usedon) );
  obj Q4EZ;
  list args;
  if(testAndLearnSkill(user, 0x08, 0x00, 0x50) > 0x00)
  {
    switch(Q62A)
    {
    case 0x1BD1:
      switch(Q66P)
      {
      case 0x1BD4:
        attachScript(user, "makingarrows");
        args = list( this, usedon );
        message(user, "makearrows", args);
        break;
      default:
        systemMessage(user, "Can't use feathers on that.");
        return(0x00);
        break;
      }
      break;
    case 0x1BD4:
      switch(Q66P)
      {
      case 0x1BD1:
        attachScript(user, "makingarrows");
        args = list( usedon, this );
        message(user, "makearrows", args);
        break;
      default:
        systemMessage(user, "Can't use shafts on that.");
        return(0x00);
        break;
      }
      break;
    default:
      return(0x00);
      break;
    }
  }
  else
  {
    systemMessage(user, "Fletching failed.");
    int Q5MT;
    int Q4Q1;
    if(!random(0x00, 0x03))
    {
      debugMessage("!rand");
      debugMessage("thistype = " + Q62A);
      if(Q62A == 0x1BD1)
      {
        systemMessage(user, "A feather was destroyed.");
        returnResourcesToBank(this, 0x01, "feathers");
        Q4Q1 = getResource(Q5MT, this, "feathers", 0x03, 0x02);
      }
      if(Q62A == 0x1BD4)
      {
        systemMessage(user, "A shaft was destroyed.");
        returnResourcesToBank(this, 0x01, "wood");
        Q4Q1 = getResource(Q5MT, this, "wood", 0x03, 0x02);
      }
      if(Q5MT < 0x01)
      {
        deleteObject(this);
      }
    }
  }
  return(0x01);
}