Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Sluggy

Pages: [1] 2
1
Design Lab / Mudlib Design Specs: pt1
« on: January 29, 2013, 06:28:43 pm »
Since I've previously mentioned on another thread that I am going to start work on a new mudlib I've been scribbling lots of things down onto paper. Before I really get into the code I want at least a rough sketch of what it should look like once things are in a working order. Since then I've come across a few considerations that I figured might warrant other opinions. Since its likely that many of these 'considerations' might pop up I've decided to label each such thread with a part number- hence the 'pt 1' in the title.

Sefuns: Do people like them? I generally like the idea of common functions just being available without having to include special headers or accessing wrapper objects. However, there is something to be said about the organization of placing hundreds of function prototypes and #include statements into a single sefun object. And that something isn't very nice.

User Accounts: This one seems to have a lot of merit both ways and tends to spark quite a few arguments. How do people (both developers and players) feel about parent accounts that hold all of their separate characters? It seems like a bit of a security risk and many of my players actually argue that it would be less convenient than just having multiple passwords. Anyone else have a thought?

God Characters: My initial idea was to simply provide 'creator' accounts that did not have any 'physical' player avatar. However, it does seem that a lot of folks feel cheated by that. Players like 'seeing' their creators walking about and talking with them within the virtual world. And creators find it easier to simply upgrade an existing character rather than make a new account that seems to have fewer capabilities. I've read Crat's comments on this in regards to DS and I'm starting to come around to the idea.


2
General / Starting a mudlib. Which driver?
« on: January 19, 2013, 10:46:40 pm »
So I've been considering the possibility of starting a new mudlib for a while and recently decided that I had the time and energy to put into it. However, before I really get into anything code-wise it seems I still have some research and consideration in terms of drivers. Admittedly I'm not that well versed on them so I'm hoping that others will have input that can aid me in making a decision.

There is one basic goal I want to focus on. A message-based, composite-patterned, component-oriented architecture for the higher-level constructs. The will of course necessitate a much higher object count than most mudlibs as well as more overhead and processing to pass information around. It will probably also rely on more taboo LPC constructs like shadows or function binding.

So knowing that, I am left with the next step - picking the driver. The way I see it (and it is very limited I'll admit) the two big choices are FluffOS and DGD. Initially I was leaning towards Fluff because it is something I feel safe and comfortable with.  I'm used to it and I generally know what to expect. However, many people have been recommending DGD and I'm starting to take a liking to the idea. My biggest problem here is that DGD seems to offer features that are not found in other drivers. I usually like to go with the option that is more standards-compliant. Not surprisingly, as far as I can tell there really is no such thing for LPC. Not in any official capacity anyway. So perhaps the best metric is features rather than standards? Is that a fair assessment? If so are there any other drivers with interesting features I should consider?

The best features I see coming from DGD (if I understand them properly) are:
 
  • Light-weight objects - might be useful for composition?
  • Extension interface - can I do it with DLLs or do I need to edit the driver itself?
  • State dumps / persistence - not the most important thing to me but hey, I won't complain
  • Does not necessitate telnet communications - did I understand that one correctly?

 

3
Licensing / Starting a new mudlib
« on: January 16, 2013, 08:39:47 pm »
Recently I've decided to start a new mudlib. It's mostly as an exercise of curiosity but I'd like to leave myself open to the option of releasing it to public domain. To that end I'd like to confirm a few things about licensing in relation to drivers and existing mudlibs.

1) Is the 'Lil' mudlib found on the downloads page considered PD? I can't seem to find any indication of its license.

2) What rights do I have when I use code from PDed mudlibs. As a specific example: Am I allowed to yank, say, the sefuns DeadSoulsII (the PDed version) and use them in my project with complete freedom - including freedom to modify or use any non-whole pieces as I see fit?

3) What about packaging a driver - specifically in the case of starting with a previously existing code base like Lil? Can I distribute the source from the latest build of FluffOS? What about the windows binary? Do I have to rebuild it myself of can I simply take a build from another PDed mudlib package.

I can probably take a guess at some of this stuff but I'd simply rather have it spelled out right to me just to be sure. I'll probably also have further questions based on what answers I get for this stuff.



4
Dead Souls Support / Spaceship Avatars
« on: February 14, 2011, 08:43:00 pm »
Well, a while back I got my MUD up and running but there is still one major feature I have yet to tackle. I've finally mustered up the time and energy to get it done but I'm not quite sure where to start.

Basically, the mud is a Sci-Fi, space exploration game. As such, I thought it would be a rather neat feature to allow players to own and operate their own spacecraft that allow them to move freely within a 'space scape' using virtual rooms. Representing space itself is a task I'm saving for another day, right now I'm simply trying to get a plan together for making the spacecraft itself.

Without getting into too much detail, my basic plan is to have three interrelated objects. The first object of course is the player. This serves as the focal point for the ship since there needs to be a way to identify who has rights to access and operate any given ship. The second is an object derived from my own 'instance room' (found in a post from a while back). This allows me to create an interior space for the ship that each player has their own private copy of when entering their own ship. Finally, I have the ship avatar itself. The object that plies around inside the space scape virtual rooms. This is also the key entry-point for players to enter the instanced room interior space.

The trouble I'm having right now is designing the third part, the  avatar itself. First and foremost, I'm not sure what objects should be inherited to give it the required features for proper interaction. So far I've figured LIB_MASS, LIB_MOVE, LIB_OBJECT, LIB_PERSIST, LIB_SHOW are the ones to have. Secondly, I'm having difficulty thinking of a good way to manage the avatar when players leave and the ship and the game itself. Would it make sense that the ship avatar be created and docked at some space port whenever the player enters the game? When they leave the game does it sound reasonable to ensure their are no other players within the confines of the interior of the ship and then remove it from the game? Or should I simply set/unset the cleanup flag when players are inside the ship and let the reaper handle all the work?

I realize this is a big topic and I'm being rather vague. As it is, I'm really just trying to brain storm the game play aspect and then suss out the implementation details from that. I would love to hear any comments or ideas that others have.

5
Dead Souls Support / Party Bug in DS3.0
« on: July 12, 2010, 10:14:10 pm »
Ok here I go again with crying wolf, but this time it's confirmed for a virgin install of DS3.0. Actually, it's been around since like 2.7 or 2.8 and I mentioned it in one of my old threads.

If a player creates a party and then the mud is warmbooted or rebooted, they can no longer use that name for any future party.

As well, I just learned that if a player creates a party called 'test' they gain access to the 'test' intermud channel even if they haven't yet been given access to intermud.

6
Dead Souls Support / Help System Problem
« on: July 10, 2010, 02:12:11 pm »
I'm having a lot of trouble with the help system in my mud right now.  It seems that sometimes players, and non-admin creators cannot access the in-game help. Sometimes it'll work just fine, and then later it goes haywire. A reset of the mud doesn't seem to make any reliable difference in this behavior.

I used a non-admin creator and accessed the help system and got an error like this:
Quote
2010.07.10-18.01,16
*Function for verb 'help' not found.
Object: <none> (0) at /:0

In other cases I might get complete junk. For example, the runtime log has something like this for an earlier help access  (I can't remember what it was for):
Quote
2010.07.10-07.32,27
*Function for verb 'help' not found.
Object: <none> (0) at /6:2675568

I haven't done anything to the help system whatsoever in my modded mudlib but I can't get this to happen on a stock version of DS3.0. Any clues as to what may have gone wrong?

7
Dead Souls Support / Slow memory leak
« on: June 12, 2010, 12:50:36 am »
To my horror, the other day I was checking in on the mud I setup on a shared server and the processor and memory percentages were way over the allowed limit. However, the mud was entirely idle the whole time with the exception of a few occasional and momentary logins by myself.

Since then, I've been running several versions of my mud on a VM in linux, including a stock DS3.0, my modified version that was on the server, and another that I has worked on since. I've been running them constantly for about a day-and-a-half now.

I still seem to get rising numbers on all three though at different rates and times. I've been checking mstatus and heartbeats constantly but if anything the numbers go down when things are idle. I've also set the reset interval to 10 minutes. The one thing I noticed is that everything seems to hits the fan after I visit the menagerie room. The clones NPCs never seem to leave the list when I check dumpallobj. Is that normal?

Any suggestions about what I might be doing wrong here or where I should look next? I really figured it would be something obvious like a recursive object/heartbeat/callout spawn but it doesn't seem to be any of that.

8
I've finally finished a pet project for... well another pet project. I figured since this site and this mudlib have given me so much to work with I might as well share back. So I present to you, as the title suggests, Stellarmap a visual editor for DeadSouls domains, items, and npcs. It was intended for a less technical member of our project as well as the fact that I hate doing things a computer can do for me.

The basic info is a bit long so I've placed it all on another page. You can view more details, a screen shot, and download the file from here:
http://www.whackthefrog.com/content/muddev/stellarmass/files/index.htm

Dowload Here:http://www.whackthefrog.com/content/muddev/stellarmass/files/deadsouls%20stellarmap.zip

As the title also suggests, this is still beta and requires some use and testing before I consider it safe. Use at your own risk. Aside from that, please do use it and let me know what you think, if it could use any improvements, and of course tell me about any bugs you come across (I've been quite rushed with this that last few weeks so I'm sure a couple doozees got away from me)

Take notice: You will need to slightly modify two files in DeadSouls for this to be completely compatible. Read more in the help file that comes with it.


9
Dead Souls Support / Too many global variables in DS2.10?
« on: August 29, 2009, 08:31:39 pm »
I just merged my 2.9a13 code with DS2.10 and to my dismay things didn't quite work out. I really don't know where go from here.

I've added six additional variables to the player object (in combat.c and living.c) which seems to have pushed the creator.c object overboard. When I first logged on after the merge it spit out errors stating that I had gone over the maximum limit for globals in the creator object. I was a bit leary since I expected problems until after I had logged in and added all of the classes and races I needed. So I simply removed the variables, logged in, added everything and then replaced the variables to see if I would get the same result. I didn't.

Now I'm getting a runtime message about the creator being denied access to save. To make things stranger the whole system hangs if I try to set the player's level during logon (I had to disable some code I added to connect.c). I started over with a clean project and didn't recycle any character info from the 2.9a13 just to see if that would help. No luck. I also setup a virtual linux box and recompiled the driver after raising the globals limit in 'local_options.ds'. None of this seems to help. Here are the runtime errors I am getting (from the windows box without the recompile). Any help would be greatly appreciated.

Quote
----------------------------------------------------------------------------
Dead_Souls_admingod (FluffOS v2.16-ds05w) starting up on Microsoft Windows NT - Sat Aug 29 21:08:03 2009



Loading preloaded files ...
Initializations complete.

Accepting connections on port 6666.

Running autoexec, please wait...
Autoexec daemon run complete.


Error in error handler: *Object cannot be loaded during compilation.
program: /secure/sefun/sefun.c, object: /secure/sefun/sefun, file: /secure/sefun/timestamp.c:19
--- trace ---
Object: /secure/lib/connect#60, Program: <driver>
   in <fake>() at
Object: /secure/lib/connect#60, Program: /secure/lib/connect.c
   in InputPassword() at /secure/lib/connect.c:319
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in player_object() at /secure/daemon/master.c:978
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in load_object() at /secure/sefun/load_object.c:35
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in <catch>() at /secure/sefun/load_object.c:35
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in compile_object() at /secure/daemon/master.c:468
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in clone_object() at /secure/sefun/sefun.c:119
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in log_error() at /secure/daemon/master.c:693
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in <catch>() at /secure/daemon/master.c:693
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in timestamp() at /secure/sefun/timestamp.c:19
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in error_handler() at /secure/daemon/master.c:649
'      timestamp' in '/secure/sefun/sefun.c' ('/  secure/sefun/sefun') /secure/sefun/timestamp.c:19
--- end trace ---
Error in error handler: *Object cannot be loaded during compilation.
program: /secure/sefun/sefun.c, object: /secure/sefun/sefun, file: /secure/sefun/timestamp.c:19
--- trace ---
Object: /secure/lib/connect#60, Program: <driver>
   in <fake>() at
Object: /secure/lib/connect#60, Program: /secure/lib/connect.c
   in InputPassword() at /secure/lib/connect.c:319
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in player_object() at /secure/daemon/master.c:978
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in load_object() at /secure/sefun/load_object.c:35
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in <catch>() at /secure/sefun/load_object.c:35
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in compile_object() at /secure/daemon/master.c:468
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in clone_object() at /secure/sefun/sefun.c:119
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in log_error() at /secure/daemon/master.c:693
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in <catch>() at /secure/daemon/master.c:693
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in timestamp() at /secure/sefun/timestamp.c:19
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in error_handler() at /secure/daemon/master.c:649
'      timestamp' in '/secure/sefun/sefun.c' ('/  secure/sefun/sefun') /secure/sefun/timestamp.c:19
--- end trace ---
Error in error handler: *Object cannot be loaded during compilation.
program: /secure/sefun/sefun.c, object: /secure/sefun/sefun, file: /secure/sefun/timestamp.c:19
--- trace ---
Object: /secure/lib/connect#60, Program: <driver>
   in <fake>() at
Object: /secure/lib/connect#60, Program: /secure/lib/connect.c
   in InputPassword() at /secure/lib/connect.c:319
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in player_object() at /secure/daemon/master.c:978
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in load_object() at /secure/sefun/load_object.c:35
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in <catch>() at /secure/sefun/load_object.c:35
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in compile_object() at /secure/daemon/master.c:468
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in clone_object() at /secure/sefun/sefun.c:119
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in log_error() at /secure/daemon/master.c:693
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in <catch>() at /secure/daemon/master.c:693
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in timestamp() at /secure/sefun/timestamp.c:19
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in error_handler() at /secure/daemon/master.c:649
'      timestamp' in '/secure/sefun/sefun.c' ('/  secure/sefun/sefun') /secure/sefun/timestamp.c:19
--- end trace ---
Error in error handler: *Object cannot be loaded during compilation.
program: /secure/sefun/sefun.c, object: /secure/sefun/sefun, file: /secure/sefun/timestamp.c:19
--- trace ---
Object: /secure/lib/connect#60, Program: <driver>
   in <fake>() at
Object: /secure/lib/connect#60, Program: /secure/lib/connect.c
   in InputPassword() at /secure/lib/connect.c:319
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in player_object() at /secure/daemon/master.c:978
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in load_object() at /secure/sefun/load_object.c:35
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in <catch>() at /secure/sefun/load_object.c:35
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in compile_object() at /secure/daemon/master.c:468
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in clone_object() at /secure/sefun/sefun.c:119
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in log_error() at /secure/daemon/master.c:693
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in <catch>() at /secure/daemon/master.c:693
Object: /secure/sefun/sefun, Program: /secure/sefun/sefun.c
   in timestamp() at /secure/sefun/timestamp.c:19
Object: /secure/daemon/master, Program: /secure/daemon/master.c
   in error_handler() at /secure/daemon/master.c:649
'      timestamp' in '/secure/sefun/sefun.c' ('/  secure/sefun/sefun') /secure/sefun/timestamp.c:19
--- end trace ---
/log/login
*Error in loading object '/lib/creator'
Object: /secure/sefun/sefun at line 119

'<fake>' at /secure/lib/connect#60 (/<driver>) at line 0
'InputPassword' at /secure/lib/connect#60 at line 319
'player_object' at /secure/daemon/master at line 978
'load_object' at /secure/sefun/sefun at /secure/sefun/load_object.c:35
'CATCH' at /secure/sefun/sefun at /secure/sefun/load_object.c:35
'compile_object' at /secure/daemon/master at line 468
'clone_object' at /secure/sefun/sefun at line 119

--
/log/login
*call_other() couldn't find object
Object: /secure/sefun/sefun at /secure/sefun/load_object.c:35

'<fake>' at /secure/lib/connect#60 (/<driver>) at line 0
'InputPassword' at /secure/lib/connect#60 at line 319
'player_object' at /secure/daemon/master at line 979
'load_object' at /secure/sefun/sefun at /secure/sefun/load_object.c:35
'CATCH' at /secure/sefun/sefun at /secure/sefun/load_object.c:35

--
---
2009.08.29-17.08,17
**Denied write permission in save_object().
Object: /secure/daemon/master at line 606

'<fake>' at /secure/save/players/a/admingod (/<driver>) at line 0
'save_player' at /secure/save/players/a/admingod (/lib/user/autosave.c) at line 79
'unguarded' at /secure/sefun/sefun at /secure/sefun/security.c:104
'apply_unguarded' at /secure/daemon/master at line 606

10
Dead Souls Support / Hosting Specs
« on: August 01, 2009, 10:44:36 am »
Hello all. I'm inquiring the collective wisdom of these forums for hosting information. Up to this point I've been hosting on my own Windows box at home but very shortly I will no longer be able to do that. My own knowledge of hosting services for games is next-to-none.

I have a two-pronged question:

1) Are there any hosts that would be advisable to consider. So far I've seen quite a few that don't tell me anything or simply aren't up. One recommended host is http://dune.net/ which I am seriously considering. As a comparison I also checked out http://www.genesismuds.com/. I noted that the prices are more expensive in the second one but then I also see they specifically mention that compiling isn't held against me. Is that common?

2) What kind of resource usage should I expect from DS, especially on Linux? At the most I've had maybe six creators running about 8 characters on the server over a range of about three rooms. When files start loading, even a single person can apparently jump the RAM usage up to about 30 megs for a couple minutes. For now I don't see more than 20 people being interested in playing when the server is up. I'm kind of hoping that between a decent Linux driver and some throttling of the RAM usage through the config options. I can keep it under 30 megs for now.


11
Dead Souls Support / Here's some code
« on: January 07, 2009, 12:13:14 am »
It's not much and it's not perfect but here's some code for making objects attachable/able to accept attachments. I feel with this great mudlib and all the help I've gotten here I kinda owe something back. I was cleaning it up the other day and it seemed fairly modular so I felt it might be usable to others. I've been using it for silencers and scopes myself.

ATTACHMENTS:
Inherit attachment.c in anything you want to be able to attach. Call SetAttachmentType(string) to set this half of the relationship.


ATTACHMENT ACCEPTORS:
Inherit the events from acceptor.c in anything you want to accept stuff. Call acceptor::create(). Call SetAcceptedAttachments() with a mapping where the keys are the attachment types you want to be able to connect to this object. The values were meant to be the number allowed but I never finished that part.

NOTES: This is kinda weird but when an object is attached to an acceptor, the filename and keyname of that attachment are stored and it is destroyed. During detachment the keyname must be supplied and then the object will be re-created using the filename from before. It's kinda specific to the mud I'm working on but eventually I might have to change it to just store the attachment object in the acceptor.

-Obviously, variables can't be saved for attachment objects.
-All attachments inherit LIB_ITEM. Not a big deal to me some others might not like it.
-Only one type of each attachment is allowed per receiver. I started work on a system
 that would free this up but it got very convoluted and I wasn't even sure I'd ever
 need this so I just dropped it.

Enjoy!

/lib/events/acceptor.c
Code: [Select]
/*
STELLARMASS
1/4/2009
SLUGGY (J.C.)

Events inheritable by any object that should accept attachments.

The attachments are stored in acceptors as mappings containing the keyname used to refer to them
at attachment time as well as its filename. The actual object is destroyed upon attachment.
During detachment the object is re-created using that filename.

Known Issues:
-Obviously, variables can't be saved for attachment objects.
-All attachments inherit LIB_ITEM. Not a big deal to me some others might not like it.
-Only one type of each attchment is allowed per receiver. I started work on a system
that would free this up but it got very convoluted and I wasn't even sure I'd ever
need this so I just droppped it.
*/

private mapping Attached = ([]); //[object's keyname : {attachment type, instances, object ref}]
private mapping Accepted = ([]); //[attachment type : allowed instance]

#define ATTACHMENT_TYPE 0
#define INSTANCES 1
#define OBJECT_REF 2

static void create()
{
this_object()->AddSave( ({"Attached"}) );
}

void SetAcceptedAttachments(mapping types)
{
Accepted = types;
}

mapping GetAttachments()
{
return Attached;
}

mixed CanDetach(string attachment)
{
//make sure we even have the item in question to detach
if(member_array(attachment,keys(Attached)) >= 0)
{return 1;}
return "This " + this_object()->GetKeyName() + " does not have a " + attachment + " attached to it.";
}

int ValidateAttachments(mixed arg,string inType)
{
if(arg[ATTACHMENT_TYPE] == inType) return 1;
return 0;
}

mixed CanAttach(object attachment)
{
string inType = attachment->GetAttachmentType();

//first be sure it allows this type of attachment
if(member_array(inType,keys(Accepted)) >= 0)
{
//now make sure we don't already have one
if(!sizeof(values(Attached)) || !sizeof(filter(values(Attached),(:ValidateAttachments:),inType)))
{return 1;}
return "This " + this_object()->GetKeyName() + " already has " + attachment->GetShort() + " attached to it.";
}
return "This " + this_object()->GetKeyName() + " doesn't accept that " + attachment->GetKeyName() + " as an attachment.";
}

void eventAttach(string attachment,string attachType,string obj)
{
Attached += ([ attachment :({ attachType,1,obj }) ]);
}

mixed eventDetach(string attachment)
{
//the object is re-created using the filename stored during attachment
object obj = new(Attached[attachment][OBJECT_REF]);

if(obj && objectp(obj))
{
//test to make sure we actually created the right thing!
if(!obj->CanAttach(this_object()))
{
//we got something! but it isn't an attachment. eeep!
error("Detached a non-detachable object. Object name: " + obj->GetKeyName() + " Attachment Id: " + attachment);
destruct(obj);
return 0;
}
//success
map_delete(Attached,attachment);
return obj->eventDetachFrom(this_object());
}
//failure, no object
error("Detach did not create a valid object. Object name: " + obj->GetKeyName() + " Attachment Id: " + attachment);
return 0;
}

mixed indirect_attach_obj_to_obj(object this,object target)
{
if(environment() != this_player()) return "#You don't have " + this_object()->GetShort() + ".";
return 1;
}

//NOTE TO SELF: when dealing with string as first param, the
//function becomes 'direct'. Probably due to the fact that this
//object is now technically the first one in the statement.
//Whatever :P
mixed direct_detach_str_from_obj(string attachment,object me)
{
if(environment(this_object()) != this_player()) return "#You don't have " + this_object()->GetShort() + ".";
return CanDetach(attachment);
}

/lib/attachment.c
Code: [Select]
/*
STELLARMASS
1/4/2009
SLUGGY (J.C.)

Inheritable for any object that can be attached to anything that will accept it.

The attachments are stored as mappings containing the keyname used to refer to them at
attachment time as well as its filename. The actual object is destroyed upon attachment.
During detachment the object is re-created using that filename.

Known Issues:
-Obviously, variables can't be saved for attachment objects.
-All attachments inherit LIB_ITEM. Not a big deal to me some others might not like it.
-Only one type of each attchment is allowed per receiver. I started work on a system
that would free this up but it got very convoluted and I wasn't even sure I'd ever
need this so I just droppped it.
*/
#include <lib.h>

inherit LIB_ITEM;

private string AttachmentType = "attachment";

static void create()
{
::create();
SetKeyName("attachment");
SetId(({"attachment"}));
SetShort("an attachment");
SetLong("Some kind of attachment.");
}

void SetAttachmentType(string type)
{
AttachmentType = type;
}

string GetAttachmentType()
{
return AttachmentType;
}

mixed CanAttach(object target)
{
return target->CanAttach(this_object());
}

/******************************************************************
 1/5/2009
 J.C.
This function basically stores the object keyname and filename
in the receiver and then destroys itself. The attachment is
recovered by the receiver's detachment method by re-creating
the object using the filename that was stored.

Yeah, it's weird but for some reason I'm just too afraid to
add extra objects to my firearm's storage. I figure if this
causes the bigger hit I'll change it and if not I'll remove
the extra checks in my firearms' ammo-checking functions.
Either way I'll win! Safety first, optimization later.
/******************************************************************/
mixed eventAttachTo(object target)
{
string fileName = explode(file_name(this_object()),"#")[0];
string shortDesc = GetShort();
string targetDesc = target->GetShort();
mixed result = CanAttach(target);
if(intp(result) && result)
{
//success!
target->eventAttach(GetKeyName(),AttachmentType,fileName);
destruct(this_object());
say(this_player()->GetName() + " attaches " + shortDesc + " to " + targetDesc + ".");
return "You attach " + shortDesc + " to " + targetDesc + ".";
}
return result;
}

mixed eventDetachFrom(object target)
{
eventMove(environment(target));
say(this_player()->GetName() + " detaches " + target->GetShort() + " from " + target->GetShort() + ".");
return "You detach " + GetShort() + " from " + target->GetShort() + ".";
}

mixed direct_attach_obj_to_obj(object attachment,object target)
{
if(environment() != this_player()) return "#You don't have " + GetShort() + ".";
if(GetWielded()) eventUnequip(this_player());
return 1;//CanAttach(target); //for some reason 'target' is null. And here I thought I would be all clever-like :<
}

/verbs/items/attach.c
Code: [Select]
/*
STELLARMASS PROJECT
7/12/2008
JAMES CLARK

UPDATED 1/5/2009 J.C.
-Everything has been made to work in a more generic fasion rather than rely on very
specific functions within my firearms code.

Used for attaching an 'attachment' object to an 'attachable' object. Originally developed for
stellarmass fireams with scopes and silencers. Basically, when an attachment is attached,
the receiver stores only a reference to the object's keyname and file reference. Then the
object is destroyed. This verb makes the receiver re-create the object using the stored filename.

*/

#include <lib.h>
#include <rounds.h>

inherit LIB_VERB;

static void create()
{
::create();

SetVerb("attach");
SetRules("OBJ to OBJ");
SetErrorMessage("Attach what to what?");
SetHelp("Syntax: attach <OBJ> to <OBJ>\n\nAttaches one object to another. They obviously should be components that are capable of attachment.");
}

mixed eventAction(object attachment,object attachable)
{
if(!attachment || !objectp(attachment)) return 0;
if(!attachable || !objectp(attachable)) return 0;

write(attachment->eventAttachTo(attachable));
return 1;
}

mixed can_attach_obj_to_obj(mixed attachment,mixed attachable)
{
if(this_player()->GetParalyzed())
{return "You can't do anything.";}
return this_player()->CanManipulate();
}

mixed do_attach_obj_to_obj(mixed attachment,mixed attachable)
{
if(this_player()->GetInCombat())
{
this_player()->SetAttack(0,(:eventAction,attachment,attachable:),ROUND_OTHER);
return 1;
}
return eventAction(attachment,attachable);
}

/verbs/items/detach.c
Code: [Select]
/*
STELLARMASS PROJECT
7/12/2008
JAMES CLARK

UPDATED 1/5/2009 J.C.
-Everything has been made to work in a more generic fasion rather than rely on very
specific functions within my firearms code.

Used for detaching previously attached objects. Originally developed for stellarmass fireams
with scopes and silencers. Basically, when an attachment is attached, the receiver stores only
a reference to the object's keyname and file reference. Then the object is destroyed. This verb
makes the receiver re-create the object using the stored filename.

NOTE: The detachment event is called from the second object passing the
      attachment keyname as a parameter.
*/

#include <lib.h>
#include <rounds.h>

inherit LIB_VERB;

static void create()
{
::create();

SetVerb("detach");
SetRules("STR from OBJ");
SetErrorMessage("Detach what from what?");
SetHelp("Syntax: detach <STR> from <OBJECT>\n\nDetached one previously attached object from another. The first parameter must be either \"silencer\" or \"scope\" in order to have any effect on firearms.");
}

mixed eventAction(string attachment,object attachable)
{
if(!attachment || !stringp(attachment)) return 0;
if(!attachable || !objectp(attachable)) return 0;

write(attachable->eventDetach(attachment));
return 1;
}

mixed can_detach_str_from_obj(string attachment,object attachable)
{
if(this_player()->GetParalyzed())
{return "You can't do anything.";}
return this_player()->CanManipulate();
}

mixed do_detach_str_from_obj(string attachment,object attachable)
{
if(this_player()->GetInCombat())
{
this_player()->SetAttack(0,(:eventAction, attachment,attachable:),ROUND_OTHER);
return 1;
}
return eventAction(attachment,attachable);
}


12
Dead Souls Support / Vehicles and eventForce()
« on: December 30, 2008, 10:59:06 am »
I've been having a lot of problems with the eventForce() method. Are there certain limitations on what it will force an NPC do to, or perhaps there are limitations of NPCs that don't allow them to perform these actions?

I've personally tried to get eventForce() to make an NPC hand out an item in it's inventory to a player upon request. It was the only item in its inventory so I don't know why it wouldn't do anything. It just simply did nothing.

Another creator has been fooling around with the vehicle object and is trying to us the 'direct' command to make it pick up and put down items as well as wield them. Trouble is sometimes it works and most of the time it doesn't. We've tried a variety of commands to see if it was just having trouble parsing the input but that doesn't seem to be the case.

Also, is there any way to get the response that was sent to the NPC from the result of the eventForce() so that I can see if it is a parsing error?

13
Dead Souls Support / Is "body.c->GetMaxHealth()" melting my combat?
« on: December 20, 2008, 09:52:41 pm »
Perhaps these are two disparate issues but I can't seem to figure out what else could be wrong and I'm too tired to really think straight so I figured I would post here for ideas.

I've been modifying the stock DS code to generate max health, magic, and stamina from the player's class rather than race and after leaping through a ton of hoops it's finally working (getting it to work for NPCs was a nightmare!) however the combat system is now suffering from a huge meltdown and one that was previously not an issue, even while I was working on this! After some christmas-light testing I *think* it might have something to do with the way health, magic, and stamina are stored.

I actually overrode the 'GetMax<Whatever>()" and "SetMax<Whatever>()"functions in race.c and replaced them with my own that simply store the results in variables and then read them back out. Within living.c, these functions are called so that characters have their max health, magic, and stamina set based on their chosen class and current level within the SetLevel() function.

My ultimate issue is that when I go to attack something, combat.c->eventExecuteAttack() is sent an array rather than a single target and then combat just stops. I also noted that in combat.c->heart_beat(), the line following line is never called:
Code: [Select]
else if( ob = ResetCurrentEnemy() ) {
                eventExecuteAttack(ob);
            }

I really have no idea why this would happen but seeing as how the only portion of code that seems to affect it has to do with my changes to that area I just don't know what else to think.

After sifting through body.c I noticed that these GetMax<whatever> and SetMax<whatever> functions already exist. Oddly, in fact body.c->GetmaxHealth() simply returns 0. Are these functions ever called anywhere meaningful? I know the heartbeat calls it all the time but does that matter? Would this effect the way things get processed down the line to the combat system?


14
Dead Souls Support / Instanceable Rooms?
« on: August 11, 2008, 10:00:44 pm »
One of the specs I've been given is a short tutorial section at the very beginning where new players may learn the basic rules of the game while in an isolated and controlled environment. After creating their character they are placed within this tutorial zone and instructed how some of the basic interactions within the game world work. I personally feel this is somewhat important because several parts of DS have been modded or extended.

As far as I know, there is no out-of-box support to spawn 'instanced room' objects. Rooms, that are copied from a master version and then loaded into memory and supplied for individual players. This also seems a little time consuming and out of my league to try to implement so I'm rather thinking along the lines of simply providing several copies of the same domain and simply assigning each new player to one. Of course this has the natural limit that only as many players can create new characters as there are copies available. So before I go and do that I figured I would just ask if there was any way to create instanced rooms.


15
Dead Souls Support / Why does casting a string convert the L-value?
« on: August 09, 2008, 09:56:41 am »
This isn't a problem so much as a hiccup that caught me off guard. But why is it that when I cast a string as an int and try to then assign that value to an int it causes the int to become a string? It just seems to me that if you are building a semi-weakly typed language you would simply use the cast to convert the value to the type on the lhs. My first guess is that it was simply easier  ;D

Pages: [1] 2