Ejemplo n.º 1
0
int main( string param ) {
   string a, b;

   if( !param ) {
      notify_fail("Crack what?\n");
      return 0;
   }

   if( sscanf(param, "%s into %s", a, b) ) {
      object ob, *src_list, dest, *list;
      int action_ok;

      list = all_present( a, this_player() );
      if( !list ) list = all_present( a, environment(this_player()) );
      if( !list ) {
         notify_fail("I don't understand what you're trying to crack.\n");
         return 0;
      }
      src_list = list;

      list = all_present( b, this_player() );
      if( !list ) list = all_present( b, environment(this_player()) );
      if( !list ) {
         notify_fail("I don't understand what you're trying to crack it into.\n");
         return 0;
      }
      dest = list[0];

      // list of all the things that cracked...
      list = ({ });
Ejemplo n.º 2
0
int main( string param ) {
   object *list, ob;
   int amount = 0;
   string result;

   if ( !param )
      return notify_fail("What do you want to count the amount of?\n");

   if ( param[0..3] != "all " )
      param = "all " + param;

   list = all_present( param, this_player()/*, (: !$1->query_container() :)*/ );
   if ( !list ) {
      list = all_present( param, environment( this_player() )/*, (: !$1->query_container() :)*/ );
   }
   if ( !list )
      return notify_fail("Could not find that to count.\n");

   foreach( ob : list ) {
      // If there's an object, there *must* be a quantity of at least one
      // quantity 0 means that this obj does not inherit /obj/quantity
      if ( ob->query_quantity() == 0 )
         amount++;
      else
         amount += ob->query_quantity();
   }

   // see thread 2005 as to why these are diked out
   // see thread 2006 for a good idea for fixing
   if ( ob->query_units() )
      if ( amount == 1 )
         result = "You count " + amount + " " + ob->query_unit() + "."; // of " + ob->query_name() + ".";
      else
         result = "You count " + amount + " " + ob->query_units() + "."; // of " + ob->query_plural() + ".";
   else
      if ( amount == 1 )
         result = "You count " + amount + "."; // " + ob->query_name() + ".";
      else
         result = "You count " + amount + "."; // " + ob->query_plural() + ".";

   if ( amount <= this_player()->query_stat("int") )
      msg(result);
   else {
      msg("You begin counting.");
      // have to pass something for the delay, this player is as good as anything
      WALK_ACTION_PARAM(1000 + (to_int(amount - this_player()->query_stat("int")) % 1000), this_player(), result);
   }

   return 1;
}
Ejemplo n.º 3
0
int main(int argc, const char *argv[])
{
	int c;
	int i = 1;

	while ((c = getopt(argc, argv, "a:o:")) != -1) {
		i++;
		switch (c) {
			case 'a':
				return (all_present(i, optind, argv));
				break;
			case 'b':
				return (one_present(i, optind, argv));
				break;
			default:
				/*
				 * unknown option is error
				 */
				return (1);
		}
	}

	return (1);
}