Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
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
LOP 1.45
Author: Remcon
Submitted by: Remcon
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
Users Online
CommonCrawl

Members: 0
Guests: 10
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SWFOTE FUSS » Command sset does not have su...
Forum Rules | Mark all | Recent Posts

Command sset does not have support to delete a skill.
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Dec 25, 2008, 1:20 pm   Last edited Dec 25, 2008, 1:24 pm by ayuri
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

I don't know if anyone cares but in the nature of setting OLC skills - should we not be able to delete them? There is at least looks to have had some support planned for this in the past. (Sorry if this was talked about on the SMAUG side of things. And if I'm wrong for whatever reason - sorry to have wasted your time)

In skills.c find do_sset and look for this:

 if( arg1[0] == '\0' || arg2[0] == '\0' || ( argument[0] == '\0' && strcmp( arg2, "delete" ) ) )


I can not find anything else other than that. I checked the SMAUGFUSS 1.8 source and all it has is just:
if( arg1[0] == '\0' || arg2[0] == '\0' || argument[0] == '\0' )

I do not know SMAUGFUSS, and didn't check to see if there were another way to remove skills.

I found this while looking at the idea convert spice into a table system used for herbs.

Ayuri
PS Merry Christmas.
       
Post is unread #2 Dec 25, 2008, 3:13 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

There's been talk of it, but even on the Smaug side nobody has ever put in an actual skill delete. AFKMud came close enough that it could probably be finished easily enough. The thing is, some skills require more than just the softcode system. The ones that require hardcoded functions have to be deleted from the source code which is something the sset command can never do.
       
Post is unread #3 Dec 25, 2008, 7:54 pm
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

True while hard coded skills can never (never say never?) be deleted from the source OLC, there is so much (dare I say junk?) left in the swfotefuss side of things from its origins that are not in use within the game that removing the hard coded part isn't going to be a problem.

I'm looking at from the standpoint of Skill:A is no longer needed. Rather than edit the datafile, then copyover, just take it out from within the game and be done with it. This isn't an urgent issue, just wondering what people might have thought of it. If it should be removed, or looked into.
I myself can count a few times where we wanted to add in a new skill/affect combo and then remove the old one - but wanted to keep the code for it in future use.

I don't wish to speak for Keberus, but I think he was looking into it (after I posted here). Keb, sorry if I gave away too much :)

Ayuri
       
Post is unread #4 Dec 25, 2008, 7:56 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

I tried quite a few ways to do this including deleting it on the spot and resorting the tables and all and found that is impossible (because of how the skills and sns are handled for lots of other stuff) So I ended up doing it as a type of skill like SKILL_DELETE and make it so if they enter a command to delete a skill it sets it to SKILL_DELETE and it is never saved into the table. Then when a hotboot is done it will not have the new skill and will handle everything correctly. Don't remember which release that got tossed in right off but I know it's in the last release of LOP :)
       
Post is unread #5 Dec 25, 2008, 8:04 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Yes, part of the problem with this is going to be safely removing it from the skills array without seriously pissing the game off. AFKMud only deletes skills from memory during a shutdown, when it doesn't matter, and only because doing so helps make Valgrind debugging easier. But a lot of the delete routines that were added would be useful in general, such as being able to delete deities and clans without a reboot.
       
Post is unread #6 Dec 25, 2008, 8:17 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

Yea you can easily do clans and deities without a reboot. (Done that one, and never noticed a problem with it).

I tried lots of different ways on the skills things though and always ran into some problem here and there sooner or later. The way of setting it so that it doesn't save and is more or less deleted when it starts up seems to be the best way to handle it.
       
Post is unread #7 Dec 25, 2008, 9:42 pm   Last edited Dec 25, 2008, 9:45 pm by ayuri
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

Remcon said:


Yea you can easily do clans and deities without a reboot. (Done that one, and never noticed a problem with it).

We've made new clans online and changed things about. Don't exactly use deities in a Star Wars game. But, that was with makeclan and setclan and even nuked a clan with remclan. (All functions are in clans.c (SWFotEFUSS) if you wanna peek at them)

I do not know how SN's are used, it could be a problem.

Ayuri
       
Post is unread #8 Dec 25, 2008, 10:27 pm   Last edited Dec 25, 2008, 10:40 pm by Keberus
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

I had a bit of trouble but after this post gave deleing a skill a go, and didn't seem to have any problems (after I got the code working, that is ). I corrupted my pfile 3 or 4x to figure it out, but I tested this by add in multiple new skills, and deleting a skill from the middle of the new ones and see if I had an issue, and the code didn't.


Anywho, this is what I did for Fote, which should pretty much be the same for smaug.

---------------


tables.c

At the bottom add:
void free_skill( int sn )
{
    SMAUG_AFF *aff, *aff_next=NULL;

        for( aff = skill_table[sn]->affects; aff; aff = aff_next )
        {
            aff_next = aff->next;
            DISPOSE( aff->duration );
            DISPOSE( aff->modifier );
            DISPOSE( aff );
        }
        DISPOSE( skill_table[sn]->noun_damage );
        DISPOSE( skill_table[sn]->dice );
        DISPOSE( skill_table[sn]->die_char );
        DISPOSE( skill_table[sn]->die_room );
        DISPOSE( skill_table[sn]->die_vict );
        DISPOSE( skill_table[sn]->spell_fun_name );
        DISPOSE( skill_table[sn]->skill_fun_name );
        DISPOSE( skill_table[sn]->components );
        DISPOSE( skill_table[sn]->imm_char );
        DISPOSE( skill_table[sn]->imm_room );
        DISPOSE( skill_table[sn]->imm_vict );
        DISPOSE( skill_table[sn]->hit_char );
        DISPOSE( skill_table[sn]->hit_room );
        DISPOSE( skill_table[sn]->hit_vict );
        DISPOSE( skill_table[sn]->miss_char );
        DISPOSE( skill_table[sn]->miss_room );
        DISPOSE( skill_table[sn]->miss_vict );
        DISPOSE( skill_table[sn]->teachers );
        DISPOSE( skill_table[sn]->msg_off );
        DISPOSE( skill_table[sn]->name );
        DISPOSE( skill_table[sn] );
}

void free_skill_table( void )
{
    int sn;

    for( sn = 0; sn < top_sn; sn++ )
       free_skill( sn );

    return;
}



skills.c

Find:
bool validate_spec_fun( const char *name );


After it add:
void free_skill( int sn );
void shift_sns( int deletedsn );



skills.c do_sset

Locate
   if( arg1[0] == '\0' || arg2[0] == '\0' || ( argument[0] == '\0' && strcmp( arg2, "delete" ) ) )


Change to:
   if( arg1[0] == '\0' || arg2[0] == '\0' || ( argument[0] == '\0' && str_cmp( arg2, "remove" ) ))


Then Locate:
         send_to_char( "or:     sset create herb 'new herb'\r\n", ch );
      }


Change to:
         send_to_char( "or:     sset create herb 'new herb'\r\n", ch );
         send_to_char( "or:     sset <sn> remove\r\n", ch );
      }


Locate:
      if( !str_cmp( arg2, "difficulty" ) )
      {
         skill->difficulty = atoi( argument );
         send_to_char( "Ok.\r\n", ch );
         return;
      }


After that add:
        if( !str_cmp( arg2, "remove" ) && (get_trust( ch ) > LEVEL_SUB_IMPLEM) )
        {
            ch_printf( ch, "&YThe skill &W%s &Yhas been &Rdeleted!\r\n", skill->name );
            free_skill( sn );
            shift_sns( sn );
            return;
        }


Then locate:
   if( ( victim = get_char_world( ch, arg1 ) ) == NULL )
   {
      if( ( sn = skill_lookup( arg1 ) ) >= 0 )
      {
         sprintf( arg1, "%d %s %s", sn, arg2, argument );
         do_sset( ch, arg1 );
      }
      else
         send_to_char( "They aren't here.\r\n", ch );
      return;
   }


Change to:
   if( ( victim = get_char_world( ch, arg1 ) ) == NULL )
   {
      if( str_cmp( arg2, "remove" ) && ( ( sn = skill_lookup( arg1 ) ) >= 0 ) )
      {
         sprintf( arg1, "%d %s %s", sn, arg2, argument );
         do_sset( ch, arg1 );
      }
      else
         send_to_char( "They aren't here.\r\n", ch );
      return;
   }


skills.c

At the bottom add:
void shift_sns( int deletedsn )
{
   int sn;

   for( sn = deletedsn; sn < top_sn; sn++ )
   {
      skill_table[sn] = skill_table[sn+1];
   }
   top_sn--;
   return;
}



The big thing was the shift_sns function, without it the skill loop gets corrupted and the game will drop seg vios like crazy, you cant save, logout or nothing and your pfile gets corrupted. Anywho, with it, I was seemingly able to add/remove them without difficulty.

Lemme know if it works or doesn't work, or if I'm forgetting something.

Later,
KeB
       
Post is unread #9 Dec 26, 2008, 7:49 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

I've already gotten the clans and deities so they can be removed through olc without any problems.

I would say your forgetting the SNs. Take like a potion/wand/staff/etc... and put a spell on it and delete the spell or a spell before or after it and then delete a spell that is on it or one before it. You have nothing that will correct the SNs on objects as well as nothing that is going to fix the characters skill setup.

Example:
lets just say that we have 3 spells...1 - Heal, 2 - Slink, 3 - Refresh
Lets say they have heal at 40% Slink 90% Refresh 5%
If you delete Slink and update the skill list but not the character list it thinks like this
Heal is at 40%
Refresh is at 90%
NULL is at 5%
and it will try to save it in the pfile like that (to an extent) so it kind of moves around the info and something ends up with bad data or if you fixed that it will just move the data around and drop the NULL one.

Objects work in a very similar fashion with using an int to hold what skill it should use. Failure to set it to what it should correctly will cause a lot of issues. :)
       
Post is unread #10 Dec 26, 2008, 6:04 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Remcon raises a good point. Skill sn numbers are used in a huge number of places, but the critical ones like class skill lists and object affect skills will cause problems if those things are not dealt with. It could be why the Smaugdevs never coded in online skill deleting.
       
Post is unread #11 Dec 26, 2008, 6:51 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

Well you could do it, but it takes a good bit of planning and effort. You would have to keep a current list of how the skills are setup and then create a new list once the spell/skill is removed and then toss through all objects and characters and if there is a change from the old list to the new list update them as you go....

It is a pain and I thought of how to do it long ago, but well never have gotten around to it and not really sure the trouble is worth what you gain from it lol.

Oh and dont forget you will have to update any and all affects (like spells/skills put on characters/items/rooms as well) (Think that is why I just never bothered with deleting them online)
       
Post is unread #12 Dec 26, 2008, 8:10 pm
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

You both raise valid points. Thanks for the info. I have been considering moving away from the use of SN's the the sense of how they are currently used, and instead opting for an index value, and referencing everything by the name of the skill, to get that value instead...I may try going that route. Or try working out the issues that are noted above.

Later,
KeB
       
Post is unread #13 Dec 26, 2008, 8:57 pm
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

Heh, sorry for all the extra work Keb. As I said, I was just digging though the code and found something that seemed odd.

Ayuri
       
Pages:<< prev 1 next >>