Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 parse description bug
Yesterday, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Sogou

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Coding » CalareyMud Coding Help
Forum Rules | Mark all | Recent Posts

CalareyMud Coding Help
< Newer Topic :: Older Topic >

Pages:<< prev 1, 2, 3, 4, 5 next >>
Post is unread #81 Sep 9, 2013, 8:53 pm
Go to the top of the page
Go to the bottom of the page

mystickdreamer
Magician
GroupMembers
Posts128
JoinedApr 9, 2010

please explain about the format

I mean I understand what the word format means, but I fail to see what I did wrong in the format
       
Post is unread #82 Sep 10, 2013, 2:43 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

You have
void do_invoke( CHAR_DATA * ch, char *argument )
{
	OBJ_DATA *fire, *shard;
	bool found;
	int mana;
	 
	 
if( !can_use_skill( ch, 0, gsn_invoke ) )
   {
      send_to_char( "A skill such as this requires more magical ability than you have.\n\r", ch );
      return;
   }
if( argument[0] == '\0' )
	{
		send_to_char( "Invoke which element?\n\r", ch);
		return;
	}
   
		mana = (ch->max_mana / 5);
	if( !str_cmp( argument, "fireshard" ) )
	{
			found = FALSE;
			for( fire = ch->in_room->first_content; fire; fire = fire->next_content )
				{
					if( fire->item_type == ITEM_FIRE )
					{
					found = TRUE;
					break;
					}
				}
			if( !found )
			{
				send_to_char(" There must be a fire here to invoke a FireShard.\n\r", ch);
				return;
			}
		   if( !can_use_skill( ch, number_percent(  ), gsn_invoke ) )
			{
				set_char_color( AT_MAGIC, ch );
				send_to_char( "You failed to make a FireShard.\n\r", ch );
				// Decided against PCs learning from failure
				//learn_from_failure( ch, gsn_invoke );
				ch->mana -= ( mana );
				return;
			}

					//SUCCESS
					
					shard = create_object( get_obj_index( OBJ_VNUM_SM_FIRESHARD ), 0 );
					learn_from_success(ch, gsn_invoke);
					ch->mana -= (ch->mana / 10);
					act( AT_MAGIC, "$n invokes the fire and creates a FireShard.", ch, NULL, NULL, TO_ROOM );
					act( AT_MAGIC, "You invoke the fire and create a FireShard.", ch, NULL, NULL, TO_CHAR );
					obj_to_char( shard, ch);
					learn_noncombat( ch, SK_CHANNEL);
			
	}

when this is so much easier to follow and look at :)
void do_invoke( CHAR_DATA * ch, char *argument )
{
   OBJ_DATA *fire, *shard;
   bool found;
   int mana;

   if( !can_use_skill( ch, 0, gsn_invoke ) )
   {
      send_to_char( "A skill such as this requires more magical ability than you have.\n\r", ch );
      return;
   }
   if( argument[0] == '\0' )
   {
      send_to_char( "Invoke which element?\n\r", ch);
      return;
   }

   mana = (ch->max_mana / 5);

   if( !str_cmp( argument, "fireshard" ) )
   {
      found = FALSE;

      for( fire = ch->in_room->first_content; fire; fire = fire->next_content )
      {
         if( fire->item_type == ITEM_FIRE )
         {
            found = TRUE;
            break;
         }
      }
      if( !found )
      {
         send_to_char(" There must be a fire here to invoke a FireShard.\n\r", ch);
         return;
      }

      if( !can_use_skill( ch, number_percent(  ), gsn_invoke ) )
      {
         set_char_color( AT_MAGIC, ch );
         send_to_char( "You failed to make a FireShard.\n\r", ch );
         // Decided against PCs learning from failure
         // learn_from_failure( ch, gsn_invoke );
         ch->mana -= ( mana );
         return;
      }

      // SUCCESS
      shard = create_object( get_obj_index( OBJ_VNUM_SM_FIRESHARD ), 0 );
      learn_from_success(ch, gsn_invoke);
      ch->mana -= (ch->mana / 10);
      act( AT_MAGIC, "$n invokes the fire and creates a FireShard.", ch, NULL, NULL, TO_ROOM );
      act( AT_MAGIC, "You invoke the fire and create a FireShard.", ch, NULL, NULL, TO_CHAR );
      obj_to_char( shard, ch);
      learn_noncombat( ch, SK_CHANNEL);
   }

You would be amazed by how much faster an issue can be found and fixed in a nicely formated code compared to one where you spend time trying to figure out what is going on first.
       
Post is unread #83 Sep 10, 2013, 7:40 am
Go to the top of the page
Go to the bottom of the page

mystickdreamer
Magician
GroupMembers
Posts128
JoinedApr 9, 2010

Ah so just make sure everything lines up

I will definitely keep that in mind and try to format it correctly

thank you
       
Post is unread #84 Sep 13, 2013, 6:57 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

yw and thanks :)
       
Post is unread #85 Sep 18, 2013, 9:19 am
Go to the top of the page
Go to the bottom of the page

mystickdreamer
Magician
GroupMembers
Posts128
JoinedApr 9, 2010

I once again need some help from the most excellent coders here.


I'm importing the istagged and isflagged with variables to be able to assign variables to players

I'm getting this error when compiling

variables.c:585: warning: passing arg 1 of `free' discards qualifiers from pointer target type



this is the section of code

        case 'E':
            if( !str_cmp( word, "End" ) )
            {
               switch ( pvd->type )
               {
                  default:
                  {
                     bug( "%s: invalid/incomplete variable: %s", __FUNCTION__, pvd->tag );
                     DISPOSE( pvd->tag );
                     DISPOSE( pvd );
                     break;
                  }
                  case vtSTR:
                  case vtXBIT:
                     if( !pvd->data )
                     {
                        bug( "%s: invalid/incomplete variable: %s", __FUNCTION__, pvd->tag );
  line 585 ->                      DISPOSE( pvd->tag );
                        DISPOSE( pvd );
                        break;
                     }
                  case vtINT:
                     tag_char( ch, pvd, 1 );
                     break;
               }
               return;
            }
            break;



in fact I have a bunch of these same errors all over, but I figure I can fix all the same errors from this one example
       
Post is unread #86 Sep 18, 2013, 9:49 am   Last edited Sep 18, 2013, 11:34 am by mystickdreamer
Go to the top of the page
Go to the bottom of the page

mystickdreamer
Magician
GroupMembers
Posts128
JoinedApr 9, 2010

Ah answered my own question

I was passing is a const char when it took just a char




ah and my last warning I have

variables.c:66: warning: passing arg 1 of `free' discards qualifiers from pointer target type



in the code

void delete_variable( VARIABLE_DATA * var )
{
   delete_vdata( var );
line 66 ->   DISPOSE( var->tag );
   DISPOSE( var );
}
       
Post is unread #87 Sep 18, 2013, 3:24 pm   Last edited Sep 18, 2013, 3:29 pm by mystickdreamer
Go to the top of the page
Go to the bottom of the page

mystickdreamer
Magician
GroupMembers
Posts128
JoinedApr 9, 2010

Ok so I'm having a couple of problems with istagged

the first problem I'm having is it just doesn't do anything it stops the prog right where the istagged if check is

The test prog is

>speech_prog test
if istagged($n, test) >= 1
say Your test tag is not 0.
else
say Your test tag is ZERO.
endif



here is the code for istagged in mudprog.c

if( !str_cmp( chck, "istagged" ) )
      {
         VARIABLE_DATA *vd;
         int vnum = mob->pIndexData->vnum;

         if( argc < 3 )
            return BERR;

         if( argc > 3 )
            vnum = atoi( argv[3] );
         if( ( p = strchr( argv[2], ':' ) ) != NULL )
         {
            *p++ = '\0';
            vnum = atoi( p );
         }
         if( ( vd = get_tag( chkchar, argv[2], vnum ) ) == NULL )
            return FALSE;

         if( !*opr && !*rval )
            return TRUE;

         switch ( vd->type )
         {
            case vtSTR:
               return mprog_seval( ( char * )vd->data, opr, rval, mob );

            case vtINT:
               return mprog_veval( ( long )vd->data, opr, atoi( rval ), mob );

            case vtXBIT:
               return FALSE;  /* for now */
         }
         return FALSE;
      }



I am able to successfully tag a player with a variable.






The second problem I'm having is the variable isn't actually saving to the player file.... I'm definitely going to need some help with that
       
Pages:<< prev 1, 2, 3, 4, 5 next >>