Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Help with editing mpoload.

Help with editing mpoload.

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Rob Harper   (108 posts)  Bio
Date Wed 10 Mar 2004 11:34 PM (UTC)
Message
I dont find my self lost too much anymore, but I found a case that stumped me, I was making a prog for one of my areas when I realised that mpoload worked on mob progs, and room progs, but it wouldnt work off of another object, could someone give me a hand with this one? (changing mpoload to work when used off an object). The mpoload code is below.





void do_mpoload( CHAR_DATA *ch, char *argument )
{
    char arg1[ MAX_INPUT_LENGTH ];
    char arg2[ MAX_INPUT_LENGTH ];
    OBJ_INDEX_DATA *pObjIndex;
    OBJ_DATA       *obj;
    int             level;
    int             timer = 0;

    if ( !IS_NPC( ch ) || 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' || !is_number( arg1 ) )
    {
        progbug( "Mpoload - Bad syntax", ch );
        return;
    }

    if ( arg2[0] == '\0' )
        level = get_trust( ch );
    else
    {
        /*
         * New feature from Alander.
         */
        if ( !is_number( arg2 ) )
        {
            progbug( "Mpoload - Bad level syntax", ch );
            return;
        }
        level = atoi( arg2 );
        if ( level < 0 || level > get_trust( ch ) )
        {
            progbug( "Mpoload - Bad level", ch );
            return;
        }

        /*
         * New feature from Thoric.
         */
        timer = atoi( argument );
        if ( timer < 0 )
        {
           progbug( "Mpoload - Bad timer", ch );
           return;
        }
    }

    if ( ( pObjIndex = get_obj_index( atoi( arg1 ) ) ) == NULL )
    {
        progbug( "Mpoload - Bad vnum arg", ch );
        return;
    }

    obj = create_object( pObjIndex, level );
    obj->timer = timer;
    if ( CAN_WEAR(obj, ITEM_TAKE) )
        obj_to_char( obj, ch );
    else
        obj_to_room( obj, ch->in_room );

    return;
}


Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 12 Mar 2004 02:21 AM (UTC)
Message
I tried this with variable results. Sometimes it seemed to work. What object did you try to load?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Rob Harper   (108 posts)  Bio
Date Reply #2 on Fri 12 Mar 2004 10:09 PM (UTC)
Message
A simple low level, non-prototype, no other flags shield shield.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 13 Mar 2004 02:09 AM (UTC)
Message
I ran gdb and put a breakpoint in do_mpoload, however I didn't pursue it too far when I realised the object was in fact loading.

I suggest you do the same, work out which test it is failing.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,915 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.