Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, DotBot, Bing

Members: 0
Guests: 11
Stats
Files
Topics
Posts
Members
Newest Member
481
3,740
19,396
629
DarrenPayn
Today's Birthdays
Noplex (33)
Related Links
» SmaugMuds.org » General » Smaug Snippets » samson's qbits
Forum Rules | Mark all | Recent Posts

samson's qbits
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Apr 14, 2018, 6:43 pm   Last edited Apr 14, 2018, 6:44 pm by joeyfogas
Go to the top of the page
Go to the bottom of the page

joeyfogas
Apprentice
GroupMembers
Posts77
JoinedAug 28, 2016

So, I installed samsons qbits code... It seems to be working fine on everything, except the mobs are not setting the abits or qbits with mpaset and mpqset. It is the one that was made for FUSS 1.7, and I am running FUSS 1.9.1

here are the two functions...
void do_mpaset( CHAR_DATA * ch, const char *argument )
{
   char arg1[MAX_INPUT_LENGTH];
   char arg2[MAX_INPUT_LENGTH];
   CHAR_DATA *victim;
   int number;

   if( !IS_NPC( ch ) || ch->desc || IS_AFFECTED( ch, AFF_CHARM ) )
   {
      send_to_char( "Huh?\n\r", ch );
      return;
   }

   argument = one_argument( argument, arg1 );
   argument = one_argument( argument, arg2 );

   if( arg1[0] == '\0' )
   {
      progbug( "Mpaset: missing victim", ch );
      return;
   }

   if( arg2[0] == '\0' )
   {
      progbug( "Mpaset: missing bit", ch );
      return;
   }

   if( !( victim = get_char_room( ch, arg1 ) ) )
   {
      progbug( "Mpaset: victim not in room", ch );
      return;
   }

   number = atoi( arg2 );
   if( get_abit( victim, number ) != NULL )
      remove_abit( victim, number );
   else
      set_abit( victim, number );
}

/* mpqset <char> */
/* Mob prog version of do_qbit */
/* Because this can be used on death_progs, be SURE your victim is correct or you could
 * end up setting a bit on the wrong person. Use 0.$n as your victim target in progs.
 */
void do_mpqset( CHAR_DATA * ch, const char *argument )
{
   char arg1[MAX_INPUT_LENGTH];
   char arg2[MAX_INPUT_LENGTH];
   CHAR_DATA *victim;
   int number;

   if( !IS_NPC( ch ) || ch->desc || IS_AFFECTED( ch, AFF_CHARM ) )
   {
      send_to_char( "Huh?\n\r", ch );
      return;
   }
   argument = one_argument( argument, arg1 );
   argument = one_argument( argument, arg2 );

   if( arg1[0] == '\0' )
   {
      progbug( "Mpqset: missing victim", ch );
      return;
   }

   if( arg2[0] == '\0' )
   {
      progbug( "Mpqset: missing bit", ch );
      return;
   }

   if( !( victim = get_char_world( ch, arg1 ) ) )
   {
      progbug( "Mpqset: victim not in game", ch );
   }

   if( IS_NPC( victim ) )
   {
      progbug( "Mpqset: setting Qbit on NPC", ch );
      return;
   }

   number = atoi( arg2 );
   if( get_qbit( victim, number ) != NULL )
      remove_qbit( victim, number );
   else
      set_qbit( victim, number );
}


and

void set_qbit( CHAR_DATA * ch, int number )
{
   BIT_DATA *bit;
   BIT_DATA *proto_bit;

   if( IS_NPC( ch ) )
      return;

   if( number < 0 || number > MAX_xBITS )
      return;

   for( proto_bit = first_qbit; proto_bit; proto_bit = proto_bit->next )
   {
      if( proto_bit->number == number )
         break;
   }

   if( proto_bit == NULL )
      return;

   if( ( bit = get_qbit( ch, number ) ) == NULL )
   {
      CREATE( bit, BIT_DATA, 1 );

      bit->number = proto_bit->number;
      mudstrlcpy( bit->desc, proto_bit->desc, MAX_STRING_LENGTH );
      LINK( bit, ch->pcdata->first_qbit, ch->pcdata->last_qbit, next, prev );
   }
}
/* Add an abit to a character */
void set_abit( CHAR_DATA * ch, int number )
{
   BIT_DATA *bit;
   BIT_DATA *proto_bit;

   if( number < 0 || number > MAX_xBITS )
      return;

   for( proto_bit = first_abit; proto_bit; proto_bit = proto_bit->next )
   {
      if( proto_bit->number == number )
         break;
   }

   if( proto_bit == NULL )
      return;

   if( ( bit = get_abit( ch, number ) ) == NULL )
   {
      CREATE( bit, BIT_DATA, 1 );

      bit->number = proto_bit->number;
      mudstrlcpy( bit->desc, proto_bit->desc, MAX_STRING_LENGTH );
      LINK( bit, ch->first_abit, ch->last_abit, next, prev );
   }
}



any clue as to why this isn't working? I am getting no progbug messages... showabit, showqbit, setabit, and setqbit all work just fine... it's just the mpaset and mpqset that isn't.

This is the program on the mob
speech_prog test
if hasqbit($n) == 2
say I see you have the bit set
else
say you do not have the bit set. let me set it for you.
mpqset($n) 2
endif


edit: qbit 2 has been created and a description set to it as well.

<22215/32000 HP 109/109 M 116/116 S >showqbit 2
QBIT: 2
 test



       
Post is unread #2 Apr 14, 2018, 11:53 pm   Last edited Apr 14, 2018, 11:55 pm by joeyfogas
Go to the top of the page
Go to the bottom of the page

joeyfogas
Apprentice
GroupMembers
Posts77
JoinedAug 28, 2016

okay, it was an issue with my mob program... when doing mpqset/mpaset, you do not want to put parenthesis "()" around the $n variable. For some reason, it doesn't work with them.

this alteration worked

if hasqbit ($n) == 2
say I see you have the bit set
else
say you do not have the bit set. let me set it for you.
mpqset 0.$n 2
endif
       
Post is unread #3 Apr 15, 2018, 6:30 pm
Go to the top of the page
Go to the bottom of the page

joeyfogas
Apprentice
GroupMembers
Posts77
JoinedAug 28, 2016

I just want to add that this code is great! I've already programmed a fast travel feature with no need for additional coding. Highly recommend this!
       
Pages:<< prev 1 next >>