Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Sogou, Yahoo!

Members: 0
Guests: 12
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SWFOTE FUSS » Bug with oset?
Forum Rules | Mark all | Recent Posts

Bug with oset?
< Newer Topic :: Older Topic > in oset <item> desc

Pages:<< prev 1 next >>
Post is unread #1 Mar 1, 2009, 11:23 am
Go to the top of the page
Go to the bottom of the page

Kasji
Apprentice
GroupMembers
Posts62
JoinedDec 23, 2007

First off, a disclaimer: I'll admit that I'm not actually using SWFOTE FUSS, I'm just using SWFOTE.

I've been working on a little function that is meant to randomly generate non-persistant objects throughout areas. This led me into researching the OBJ_DATA struct a bit, as I was trying to differentiate between the various types of descs that objects have (short, long, extra.) My main issue being that I was confused at which variable is used when you see objects in a room versus which variable is used when you examine an object.

The issue I stumbled across is a pretty remote case, but I found that every time I do a "oset <some item> desc", the mud will add a new extra desc instead of replacing the old one. At least, under the extra desc keywords. This also happens even if you abort in the editor with '/a'. For example, if you edit the desc of an item several times, even if you make no changes and do a '/s' or '/a' to leave the editor, under the extra desc keywords, you will see the list grow.
       
Post is unread #2 Mar 3, 2009, 10:28 am
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

Very interesting, I recall a builder saying something about that on my SWFOTE game a while back. However, I've not had much time to look into it. I'll see what I can dig up in FUSS.
Now, I'm also not using SWFOTE FUSS, just good ol' SWFOTE but many of the bugs are present in both branches (I run both code bases on my server - great for testing).

Ayuri
       
Post is unread #3 Mar 3, 2009, 2:49 pm   Last edited Mar 3, 2009, 2:51 pm by ayuri
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

Ok, so what I've found so far is that its setting the extra keyword from the object name. Like if you have an object named binders, oset binders desc fill in your text here. So, using the binders example 'look binders' "Your text here".

Now, if you do abort it does set the an extra desc to the name of the object, but does not remove it. To remove the extra desc just 'oset binders rmed binders'.

Its also the same if you put an extra desc on it and abort. Example 'oset binders ed test' then abort the editor. The object will now have test as an extra desc.

Note: In SWFOTEFUSS this is present.

As to making the code do that when you abort the editor, that's beyond my skills.

Hope this helps some,
Ayuri
       
Post is unread #4 Mar 3, 2009, 6:38 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

Well it looks like (code wise) it is doing exactly as it was designed to do :)

using 'oset <item> ed <name>' allows you to set what keyword you want and what ever description you want for it.
using 'oset <item> desc' just starts an extra description with the object's name for the keyword.

My guess is that they got rid of the way SMAUG had a different spot for it and instead set it up to work this way.
The ed is already created and set to you by the time you start editing it would have to add in something to make sure it wasn't aborted and then turn around and remove it if you don't want to remove it the current way. (Might be an easier way just haven't looked at it in a long time).
Long is what is seen if an object is in a room.
Short is what is seen in inventory/equipment/etc...
Description (in this base) is an extra description with keywords being the object's name (Bad idea really since you would have to change it when you change the object's name.
Extra descriptions can be what ever you want really lol. You specify the keywords and the descriptions seen when they look at it.

Well I'd check what you have for the desc part in your oset with what the FUSS has.
   if( !str_cmp( arg2, "desc" ) )
   {
      CHECK_SUBRESTRICTED( ch );
      if( obj->timer )
      {
         send_to_char( "It's not safe to edit a description on an object with a timer.\r\nTurn it off first.\r\n", ch );
         return;
      }
      if( obj->item_type == ITEM_PAPER )
      {
         send_to_char( "You can not add a description to a note paper at the moment.\r\n", ch );
         return;
      }
      if( IS_OBJ_STAT( obj, ITEM_PROTOTYPE ) )
         ed = SetOExtraProto( obj->pIndexData, obj->name );
      else
         ed = SetOExtra( obj, obj->name );
      if( ch->substate == SUB_REPEATCMD )
         ch->tempnum = SUB_REPEATCMD;
      else
         ch->tempnum = SUB_NONE;
      if( lockobj )
         ch->spare_ptr = obj;
      else
         ch->spare_ptr = NULL;
      ch->substate = SUB_OBJ_EXTRA;
      ch->dest_buf = ed;
      start_editing( ch, ed->description );
      editor_desc_printf( ch, "Extra description '%s' on object vnum %d (%s).",
                          arg3, obj->pIndexData->vnum, obj->short_descr );
      return;
   }

If it looks the same (minus what changes you may have added/removed) then take a look at these
EXTRA_DESCR_DATA *SetOExtra( OBJ_DATA * obj, const char *keywords )
{
   EXTRA_DESCR_DATA *ed;

   for( ed = obj->first_extradesc; ed; ed = ed->next )
   {
      if( is_name( keywords, ed->keyword ) )
         break;
   }
   if( !ed )
   {
      CREATE( ed, EXTRA_DESCR_DATA, 1 );
      LINK( ed, obj->first_extradesc, obj->last_extradesc, next, prev );
      ed->keyword = STRALLOC( keywords );
      ed->description = STRALLOC( "" );
      top_ed++;
   }
   return ed;
}

EXTRA_DESCR_DATA *SetOExtraProto( OBJ_INDEX_DATA * obj, const char *keywords )
{
   EXTRA_DESCR_DATA *ed;

   for( ed = obj->first_extradesc; ed; ed = ed->next )
   {
      if( is_name( keywords, ed->keyword ) )
         break;
   }
   if( !ed )
   {
      CREATE( ed, EXTRA_DESCR_DATA, 1 );
      LINK( ed, obj->first_extradesc, obj->last_extradesc, next, prev );
      ed->keyword = STRALLOC( keywords );
      ed->description = STRALLOC( "" );
      top_ed++;
   }
   return ed;
}

It is the is_name that decides if there is an existing one to edit or if it should create a new one.
If everything looks the same then check the data that is being checked by is_name etc...
Hope it helps out some. (Had to download SWFOTE1.4FUSS just to check on these lol.)
       
Post is unread #5 Mar 4, 2009, 10:36 am
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

Nice detail Remcon,
And the swfote 2.1.5 vs FUSS is the same when it comes to oset.
And I agree, the code is doing what it should, also when it comes to changing the name of the item, I can't see many times I've done that. Normally I'll just nuke the item and start from scratch, or make a new item. Shorts and longs are what we change the most it seems.
I have a few copies of SMAUGFUSS about, I think I'll look into how they are dealing with descriptions on objects.
I'd love to dig deeper but I gotta make it off to work. Hopefully I'll get a chance to take a look at the SMAUG code tonight.

Ayuri
       
Post is unread #6 Mar 4, 2009, 1:16 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

Smaug keeps the description of the object in its own spot like short and long are done. Then changing the name doesn't matter since looking at the object shows the description. The way that one is if you changed the object name and not the keywords for the added description, people would have to use the old name to see that description. (Unless they added something to check and modify it on a name change. Haven't checked lol).
       
Post is unread #7 Mar 5, 2009, 11:24 am
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

So, would it be best practices to copy what SMAUG is doing into SWFOTE?

I think if I get some free time tonight I'll see if I can't rip that out of smaug and give it a test.

Ayuri
       
Post is unread #8 Mar 5, 2009, 2:17 pm
Go to the top of the page
Go to the bottom of the page

Kasji
Apprentice
GroupMembers
Posts62
JoinedDec 23, 2007

I agree with that. I feel it would be best to have descriptions in their own spot. Aren't mobs doing just like PCs and rooms anyway? I suppose this wouldn't be classified as a bug per se, but rather a design flaw.

I can't figure out why objects were changed to be this way.. And I wonder if SWR is like this too? Will have to check.

       
Post is unread #9 Mar 5, 2009, 5:51 pm
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

So,
I'm not that well versed with stock SMAUGFUSS, but from what I'm seeing all descriptions are treated as extra desc. There isn't just a oset <item> desc switch. So it looks like you have to use oset <item> ed <keyword>.

Anyone with more knowledge of SMAUG care to chime in?

Ayuri
       
Post is unread #10 Mar 6, 2009, 2:52 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

Well, looks like your correct (never bothered to put a description on an object myself lol aside from short and long).
I would suggest looking at how mobile descriptions are handled and do it that way.
       
Post is unread #11 Mar 6, 2009, 11:14 am
Go to the top of the page
Go to the bottom of the page

Kasji
Apprentice
GroupMembers
Posts62
JoinedDec 23, 2007

Oh? So Smaug is the same then? Well it won't be very difficult to change this. Just off the top of my head, the following things would need to be changed:

  • mud.h -- add the variables to OD and OID structs

  • build.c -- do_oset

  • act_wiz.c -- do_ostat

  • act_info.c -- do_look, do_examine, etc

  • db.c -- object prototype saving/loading (area files)

  • player.c/save.c -- object saving/loading (pfiles)

  • copyover.c -- Possibly any persistent state code such as copyover code that saves objects?



Okay, this is easier said than done actually. I always hate messing with area files since SWR and its derivatives don't have keyed area file formats. If the code changes are done well, we wouldn't have to worry about objects whose descriptions are extra descs, as they shouldn't be affected by this, but before a new area loading function can be implemented, area files must first be saved in the new format, and then the new area loading function can be implemented.

I don't really know if it's worth the effort, but from a design perspective I think it makes sense for objects to be treated the same as mobs/players and rooms.
       
Post is unread #12 Mar 6, 2009, 11:55 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,857
JoinedJul 26, 2005

That's a good off the top of your head figuring :) All of those would need to be done and I think that covers all the major places it would need to be done also.
       
Pages:<< prev 1 next >>