[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Help with editing mpoload.

Help with editing mpoload.

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


Posted by Rob Harper   (108 posts)  [Biography] 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;
}


[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] 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
[Go to top] top

Posted by Rob Harper   (108 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] 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
[Go to top] 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.


10,625 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]