04 Aug, 2009, Zeno wrote in the 1st comment:
Votes: 0
We just discovered that there is no difference between doing say a mpsleep 2 and a mpsleep 6, they both sleep for the same amount of time.

I don't remember this being like this. I recently moved to a new VPS. Could that be the cause? I haven't made any code changes to mpsleep in years.

Here's mpsleep_update just in case:
/* See if there's any mud programs waiting to be continued -rkb */
void mpsleep_update()
{
MPSLEEP_DATA *mpsleep;
MPSLEEP_DATA *tmpMpsleep;
bool delete_it;

mpsleep = first_mpsleep;
while (mpsleep)
{
delete_it = FALSE;

if (mpsleep->mob)
delete_it = char_died(mpsleep->mob);

if (mpsleep->actor && !delete_it)
delete_it = char_died(mpsleep->actor);

if (mpsleep->obj && !delete_it)
delete_it = obj_extracted(mpsleep->obj);

if (delete_it)
{
log_string("mpsleep_update - Deleting expired prog.");

tmpMpsleep = mpsleep;
mpsleep = mpsleep->next;
STRFREE(tmpMpsleep->com_list);
UNLINK(tmpMpsleep, first_mpsleep, last_mpsleep, next, prev);
DISPOSE(tmpMpsleep);

continue;
}

mpsleep = mpsleep->next;
}

mpsleep = first_mpsleep;
while (mpsleep) /* Find progs to continue */
{
if (–mpsleep->timer <= 0)
{
current_mpsleep = mpsleep;

if (mpsleep->type == MP_ROOM)
rset_supermob(mpsleep->room);
else if (mpsleep->type == MP_OBJ)
set_supermob(mpsleep->obj);

mprog_driver(mpsleep->com_list, mpsleep->mob, mpsleep->actor,
mpsleep->obj, mpsleep->vo, mpsleep->single_step);

release_supermob();

tmpMpsleep = mpsleep;
mpsleep = mpsleep->next;
STRFREE(tmpMpsleep->com_list);
UNLINK(tmpMpsleep, first_mpsleep, last_mpsleep, next, prev);
DISPOSE(tmpMpsleep);

continue;
}

mpsleep = mpsleep->next;
}
}
04 Aug, 2009, Koron wrote in the 2nd comment:
Votes: 0
I don't see anything immediately wrong (though I don't profess to be supremely awesome).

What's your code look like for setting mpsleep (especially the timer part)?
04 Aug, 2009, David Haley wrote in the 3rd comment:
Votes: 0
What about mpsleep 2 vs. mpsleep 32?

Are the old and new VPSs using the same processor architecture etc.?
04 Aug, 2009, Zeno wrote in the 4th comment:
Votes: 0
2 vs 32 still end up sleeping for the same time. Pretty much one round.

Mpsleep stuff:
/* mpsleep - Check if we should sleep -rkb */
one_argument( cmnd, arg );
if (!str_cmp(arg, "mpsleep"))
{
if ( (ifstate[iflevel][IN_IF] == TRUE && ifstate[iflevel][DO_IF] == FALSE) || // if we are in an if/else and we
(ifstate[iflevel][IN_ELSE] == TRUE && ifstate[iflevel][DO_ELSE] == FALSE) ) // dont want to execute, dont..
{
}
else
{
CREATE(mpsleep, MPSLEEP_DATA, 1);

/* State variables */
mpsleep->ignorelevel = ignorelevel;
mpsleep->iflevel = iflevel;
for (count = 0; count < MAX_IFS; count++)
{
for (count2 = 0; count2 <= DO_ELSE; count2++)
{
mpsleep->ifstate[count][count2] =
ifstate[count][count2];
}
}

/* Driver arguments */
mpsleep->com_list = STRALLOC(command_list);
mpsleep->mob = mob;
mpsleep->actor = actor;
mpsleep->obj = obj;
mpsleep->vo = vo;
mpsleep->single_step = single_step;

/* Time to sleep */
cmnd = one_argument(cmnd, arg);
cmnd = one_argument(cmnd, arg);
if (cmnd[0] == '\0')
mpsleep->timer = 4;
else
mpsleep->timer = atoi(arg);

if (mpsleep->timer < 1)
{
progbug("mpsleep - bad arg, using default", mob);
mpsleep->timer = 4;
}
/* Save type of prog, room, object or mob */
if (mpsleep->mob->pIndexData->vnum == 3)
{
if (!str_prefix("Room", mpsleep->mob->description))
{
mpsleep->type = MP_ROOM;
mpsleep->room = mpsleep->mob->in_room;
}
else if (!str_prefix("Object", mpsleep->mob->description))
mpsleep->type = MP_OBJ;
}
else
mpsleep->type = MP_MOB;

LINK(mpsleep, first_mpsleep, last_mpsleep, next, prev);

–prog_nest;
return;
}
}


I don't know about the old VPS. It's the one that was hacked (entire company got hacked) and I have no way to find info about it.
04 Aug, 2009, Banner wrote in the 5th comment:
Votes: 0
Is the mpsleep in an if/else statement?
04 Aug, 2009, Koron wrote in the 6th comment:
Votes: 0
Quote
CREATE(mpsleep, MPSLEEP_DATA, 1);

Nevermind, that's probably your culprit. I thought that was the letter L, but it's the number 1…
04 Aug, 2009, Zeno wrote in the 7th comment:
Votes: 0
Banner said:
Is the mpsleep in an if/else statement?

No. But I believe I fixed the issue with mpsleep in ifchecks a while ago.
04 Aug, 2009, Koron wrote in the 8th comment:
Votes: 0
Might want to check to make sure arg is being set right here, too.
Quote
mpsleep->timer = atoi(arg);

I'm supa paranoid!
04 Aug, 2009, Zeno wrote in the 9th comment:
Votes: 0
Koron said:
Quote
CREATE(mpsleep, MPSLEEP_DATA, 1);

Nevermind, that's probably your culprit. I thought that was the letter L, but it's the number 1…

What? You sure you know what you're talking about? That 1 is not the time it lasts for, it's the size of the mem alloc.
04 Aug, 2009, Koron wrote in the 10th comment:
Votes: 0
Haha, no. I'm totally not sure.
04 Aug, 2009, Zeno wrote in the 11th comment:
Votes: 0
My code:
/* Time to sleep */
cmnd = one_argument(cmnd, arg);
cmnd = one_argument(cmnd, arg);
if (cmnd[0] == '\0')
mpsleep->timer = 4;
else
mpsleep->timer = atoi(arg);

So wait, what? I don't understand this. Why is it checking cmnd if it is setting the data from arg? This appears to be the problem.

Found this in FUSS:
/*             * Time to sleep              */
cmnd = one_argument( cmnd, arg );
if( cmnd[0] == '\0' )
mpsleep->timer = 4;
else
mpsleep->timer = atoi( cmnd );
if( mpsleep->timer < 1 )
{
progbug( "mpsleep - bad arg, using default", mob );
mpsleep->timer = 4;
}


Yep, my code was wrong. Don't know how it worked up to this point.
04 Aug, 2009, Koron wrote in the 12th comment:
Votes: 0
So I may be an idiot, but at least I'm right once in a while. :P
0.0/12