Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Development
Nov 28, 2018, 10:10 am
By Keirath
First Immortal
Oct 12, 2018, 12:02 pm
By GatewaySysop
Bug in do_climb( )
Jun 5, 2018, 5:31 pm
By joeyfogas
question on overland code
May 31, 2018, 10:03 am
By joeyfogas
KaVir's Protocol Snip
May 15, 2018, 7:57 pm
By joeyfogas
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

Members: 0
Guests: 11
Stats
Files
Topics
Posts
Members
Newest Member
481
3,740
19,397
634
BlaineNock
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Coding » A Simple way of doing MpSleep?
Forum Rules | Mark all | Recent Posts

A Simple way of doing MpSleep?
< Newer Topic :: Older Topic > I'm wondering if it can be done...

Pages:<< prev 1 next >>
Post is unread #1 Feb 22, 2009, 11:20 pm
Go to the top of the page
Go to the bottom of the page

Sanus Compleo
Magician
GroupMembers
Posts153
JoinedMar 25, 2008

First of all, I'd like to say that I'm a big fan of Rasmus' MpSleep code, it's so very useful and can bring such ambiance to programs, and really I just think it's great... Secondly, I'd like to say that I hate the code with a fiery passion. It just seems so overcomplicated, and all it really is, is a series of ifs and elses, and not really a command. Installing the snippet is a hassle of ungodly proportions, and so far there's no alternative for the same effect without really knowing your stuff (Which I unfortunately don't). I suppose that it could be done with as little as a command and something in update.c (or wherever your mud does it's updates) to put the mobile's programs in a paused state for <x> rounds or seconds. I personally don't have the skill level to do this sort of thing, and I am fairly sure that this hasn't already been done (And if it has, please, oh please, put up a link or something!), but I really want to know is if it CAN be done, with just the little "pause" part in updates.c, and the mpcommand.
       
Post is unread #2 Feb 23, 2009, 1:41 am
Go to the top of the page
Go to the bottom of the page

Sanus Compleo
Magician
GroupMembers
Posts153
JoinedMar 25, 2008

Been thinking it over all night, and I may have come up with something simple and easy to do. I haven't taken a look at the code at all yet, but the concept probably won't have to change much.

Give mobiles/objects/rooms a new value called "sleeping". The command increases "sleeping" by the argument which comes after the command, with a max value of maybe 150 or so, and a minvalue of 1. In update.c there needs to be a new function that checks every round for the sleeping value (Or something along those lines) and decreases it by one. The part in which it actually executes programs needs a new stopping point that adds a loop, and will trigger a return to the beginning of the loop if there is a sleep value, to where the loop began in between lines in the program. Update decreases this automatically, if that function is added, until it goes to 0, at which point the program will continue to the next line.

Now what I want to know is... is that even possible?
       
Post is unread #3 Feb 23, 2009, 10:15 am
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

In keeping with your concept rather than actual code, yes, it should be possible. It'd mean adding a new value to char_data (for the mobs), and in update.c adding in the decrease to zero if that value is greater than zero each pulse (or group of pulses if you wanted instead), and adding in the mud prog code to do your delay loop until that value had reached zero, and adding into db.c and save.c to save/read said value to/from the area file, and adding to (do_mset?) do_mpedit to allow setting of that sleep value, and, finally, adding a help entry to help.are so your builders know what to do with it...assuming I didn't forget anything in all that. But I'll leave it to David and others here to determine if that'd really be the best approach.. :wink:
       
Post is unread #4 Feb 23, 2009, 11:39 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

I guess it seems reasonable enough. The problem with mpsleep in general is that mudprogs don't really have any kind of structural representation, and interpreting them means literally stepping through the string of the program. So yeah, it's necessarily a complex operation, because you have to keep track of a lot of stuff. And a lot can go wrong, too: the mob might disappear (die) while still sleeping or something like that.

To be honest I haven't looked at Rasmus's mpsleep code so I don't know much about how it works.

What you described, and what Conner gave the detail for, seems like a reasonable solution although you'll have to watch out for gotchas like dying mobs.

Do any bases have mpsleep built in, out of curiosity?
       
Post is unread #5 Feb 23, 2009, 12:44 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,644
JoinedJan 1, 2002

DavidHaley said:

Do any bases have mpsleep built in, out of curiosity?


AFKMud has it. It works most of the time. :)

I think it got added to FUSS when 1.8 made it a stock feature too, so it should be hiding away in there somewhere.
       
Post is unread #6 Feb 23, 2009, 1:19 pm
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

MPSleep is indeed stock FUSS material since 1.8.

As far as the proposed new approach. I can't really say that I'd be inclined to do something like that. Like David said, MobProgs are not a simple thing. So the solution is likely to not be simple. And yes, while Mpsleep is not an actual command, it accomplishes what needs to be done in as simple a way as Rasmus could think of.
       
Post is unread #7 Feb 23, 2009, 1:47 pm
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

Incidentally, there's no real reason for it to be an actual "command". And given how closely it needs to mess with mudprog internals, there's actually reason to believe that it is much better off handled as a fake hook in the mudprog interpreter.

At some point, I'll take a look at FUSS's mpsleep -- I'm assuming it uses the same snippet? -- and see if there's a way to improve it. It's just that I have an inclination to not poke at it too much given how fragile the whole mudprog system is, and, well, if it ain't broke and all that...
       
Post is unread #8 Feb 24, 2009, 6:16 am
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

Yeah, it uses Rasmus's MpSleep with Dace K's fixes, and a couple of fixes I think Samson and I came up with.
       
Pages:<< prev 1 next >>