Login
User Name:

Password:



Register

Forgot your password?
do_owhere recursive
Author: Khonsu
Submitted by: Khonsu
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
Users Online
Bing, AhrefsBot, Google

Members: 0
Guests: 30
Stats
Files
Topics
Posts
Members
Newest Member
489
3,791
19,644
596
Elwood

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » General » Coding » Need some help
Forum Rules | Mark all | Recent Posts

Need some help
< Newer Topic :: Older Topic >

Pages:<< prev 1, 2 next >>
Post is unread #1 Sep 29, 2013 10:59 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
Alright for some reason I am having trouble with this ifcheck....
This is in char update btw:

  if ( !IS_NPC(ch) )
            {
                 if ( is_saibaman ( ch ) )
                 {
                  if (time_info.hour >= 6 || time_info.hour <= 19 )
                  {
                    if ( !xIS_SET(ch->affected_by, AFF_SYNTHESIS) )
                      transform_synthesis(ch);
                  }
		else
                 {
                    if ( xIS_SET(ch->affected_by, AFF_SYNTHESIS) )
                      untransform_synthesis( ch );
                }
            }	
	      }




Its suppose to make a saibaman affected by synthesis during the day, and unaffected at night. It will transform but not untransform the player... I don't understand why though...


here is the two functions:

/*Saibman Power ups */
void untransform_synthesis( CHAR_DATA *ch )
{

        xREMOVE_BIT(ch->affected_by, AFF_SYNTHESIS);

        act( AT_DGREY, "The moon rises and the sun sets, your ability to gain energy from the sun ceases.", ch, NULL, NULL, TO_CHAR);
        act( AT_DGREY, "$n stops collecting energy from the sun.", ch, NULL, NULL, TO_NOTVICT );

        if (xIS_SET(ch->affected_by, AFF_SAIBAMAN1))
        {   
           if(  xIS_SET(ch->affected_by, AFF_MAJIN))
            ch->pl = ch->exp * 11.5;
           else
	     ch->pl = ch->exp * 10;
        }
        else if (xIS_SET(ch->affected_by, AFF_SAIBAMAN2))
        {
           if(  xIS_SET(ch->affected_by, AFF_MAJIN))
            ch->pl = ch->exp * 17.5;
           else
	     ch->pl = ch->exp * 16;
        }
        else if (xIS_SET(ch->affected_by, AFF_SAIBAMAN3))
        {
           if(  xIS_SET(ch->affected_by, AFF_MAJIN))
            ch->pl = ch->exp * 25.5;
           else
	     ch->pl = ch->exp * 24;
        }
        else
          ch->pl = ch->exp;

        return;
}

/*
 *  The Sythesis for saibaman
 */
  
void transform_synthesis( CHAR_DATA *ch )
{ 
     if (  xIS_SET( ch->act, PLR_NOSYN ))
       return;

        if( xIS_SET(ch->affected_by, AFF_SYNTHESIS) )
	  return;

        act( AT_GREEN, "You glace up at the sun and your body begins to radiate as you begin absorbing energy from the sun.", ch, NULL, NULL, TO_CHAR );
        act( AT_GREEN, "$n glaces up at the sun and suddenly $s body begins to radiate as they begin collecting energy from the sun.", ch, NULL, NULL, TO_NOTVICT );

        xSET_BIT(ch->affected_by, AFF_SYNTHESIS);

        if (xIS_SET(ch->affected_by, AFF_SAIBAMAN1))
        {   
          if( (xIS_SET(ch->affected_by, AFF_SYNTHESIS) && xIS_SET(ch->affected_by, AFF_MAJIN)))
           ch->pl = ch->exp * 14.5;
          else if(( xIS_SET(ch->affected_by, AFF_SYNTHESIS) && !xIS_SET(ch->affected_by, AFF_MAJIN)) )
           ch->pl = ch->exp * 13;
          else if(( !xIS_SET(ch->affected_by, AFF_SYNTHESIS) && xIS_SET(ch->affected_by, AFF_MAJIN)) )
           ch->pl = ch->exp * 11.5;     
          else
	    ch->pl = ch->exp * 10;
        }
        else if (xIS_SET(ch->affected_by, AFF_SAIBAMAN2))
        {   
          if( (xIS_SET(ch->affected_by, AFF_SYNTHESIS) &&  xIS_SET(ch->affected_by, AFF_MAJIN)))
           ch->pl = ch->exp * 19.5;
          else if(( xIS_SET(ch->affected_by, AFF_SYNTHESIS) && !xIS_SET(ch->affected_by, AFF_MAJIN)) )
           ch->pl = ch->exp * 18;
          else if(( !xIS_SET(ch->affected_by, AFF_SYNTHESIS) && xIS_SET(ch->affected_by, AFF_MAJIN)) )
           ch->pl = ch->exp * 17.5;     
          else
           ch->pl = ch->exp * 16;
        }
        else if (xIS_SET(ch->affected_by, AFF_SAIBAMAN3))
        {   
          if( (xIS_SET(ch->affected_by, AFF_SYNTHESIS) &&  xIS_SET(ch->affected_by, AFF_MAJIN)))
           ch->pl = ch->exp * 27.5;
          else if(( xIS_SET(ch->affected_by, AFF_SYNTHESIS) && !xIS_SET(ch->affected_by, AFF_MAJIN)) )
           ch->pl = ch->exp * 26;
          else if(( !xIS_SET(ch->affected_by, AFF_SYNTHESIS) && xIS_SET(ch->affected_by, AFF_MAJIN)) )
           ch->pl = ch->exp * 25.5;     
          else
           ch->pl = ch->exp * 24;
        }
        else 
          ch->pl = ch->exp * 2;
        return;
 }

Post is unread #2 Sep 30, 2013 11:31 am   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
any ideas?

Post is unread #3 Sep 30, 2013 3:17 pm   
Go to the top of the page
Go to the bottom of the page

mystickdreamer
Magician
GroupMembers
Posts128
JoinedApr 9, 2010

 
Should this:

if (time_info.hour >= 6 || time_info.hour <= 19 )




be this?
if (time_info.hour >= 6 && time_info.hour <= 19 )

Post is unread #4 Sep 30, 2013 3:38 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
I would first suggest you limit it a bit more some how. other wise every char_update it will be doing one or the other. Id just have it transform at one specified time and untransform at one specified time.

Post is unread #5 Sep 30, 2013 3:58 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
example ?

Post is unread #6 Sep 30, 2013 9:07 pm   
Go to the top of the page
Go to the bottom of the page

mystickdreamer
Magician
GroupMembers
Posts128
JoinedApr 9, 2010

 
was this what you were thinking remcom?
if ( !IS_NPC(ch) )
            {
                 if ( is_saibaman ( ch ) )
                 {
                  if (time_info.hour >= 6 )
                  {
                    if ( !xIS_SET(ch->affected_by, AFF_SYNTHESIS) )
                      transform_synthesis(ch);
                  }
		else if (time_info.hour >= 19)
                 {
                    if ( xIS_SET(ch->affected_by, AFF_SYNTHESIS) )
                      untransform_synthesis( ch );
                }
                else
                  bug("Reached something you shouldn't have);
            }	
	      }

Post is unread #7 Sep 30, 2013 10:48 pm   Last edited Sep 30, 2013 10:50 pm by Remcon
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
sorry started to reply earlier, but then got busy so didn't get to post it lol.

After looking over it I would suggest doing as you originally suggested and maybe just tossing in the checks for the untransform like is in the transform. at the top add
     if (  xIS_SET( ch->act, PLR_NOSYN ))
       return;

        if( !xIS_SET(ch->affected_by, AFF_SYNTHESIS) )
	  return;

No point in doing the rest if not transformed. And I figure this is so he doesn't have to manually add in on mob creation to transform if need be etc... so he wants it to auto update to how it needs to be.

Post is unread #8 Sep 30, 2013 11:19 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
thanks :)

Post is unread #9 Oct 1, 2013 12:13 am   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
Anyone have an idea on how to do a removeall command that works like this


removeall

and it will remove all the items from the arms slot?

Post is unread #10 Oct 1, 2013 12:48 am   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
I also was looking for how armor reduces damage.... But I can't seem to find it anywhere.

Post is unread #11 Oct 2, 2013 12:19 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
Alright I need help for this Big problem....

Alright I have two skills for this race one is called
final flash and the other is called final shine.
For some reason the mud doesn't recognize final shine as a skill when typed. Even though its fully installed, it will think I am trying to use final flash. I have typed it everyway I know and I guess it doesn't recognize ' or " either.

So I have typed it
final shine <-thinks I mean final flash
'final shine' <- says huh?
"final shine" <- says huh?

I know this problem is in check_skill or in interp.c But I have no idea where the first place to look would be....


here is the part of check_skill for it. I know its because it thinks a space means its done searching, but I am unsure how to fix that and I am unsure if the whole argument (both words) is being sent to check skill to begin with....

bool check_skill( CHAR_DATA *ch, char *command, char *argument )
{
    int sn;
    int first = gsn_first_skill;
    int top   = gsn_first_weapon-1;
    int mana, blood;
    struct timeval time_used;


if ( IS_AFFECTED( ch, AFF_BERSERK ) )
{
   pager_printf( ch, "&RYou are currently out of control!  There is no stopping you in this state!\n\r" );
   return(FALSE);
}
    ch->renzoku = FALSE;
    /* bsearch for the skill */
    for (;;)
    {
	sn = (first + top) >> 1;

	if ( LOWER(command[0]) == LOWER(skill_table[sn]->name[0])
 	&&  !str_prefix(command, skill_table[sn]->name)
	&&  (skill_table[sn]->skill_fun || skill_table[sn]->spell_fun != spell_null)
        && ( can_use_skill(ch, 0, sn ) ) )
	break;
	if (first >= top)
	    return FALSE;
      if( strcasecmp( command, skill_table[sn]->name ) < 1 )
         top = sn - 1;
    	else
	    first = sn + 1;
    }

Post is unread #12 Oct 2, 2013 2:58 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
open up the skills.dat and search for the skills and put a ' around the name for each and then it will know the difference. like in the skills.dat it should have them as 'final flash' and 'final shine'

Post is unread #13 Oct 2, 2013 5:56 pm   Last edited Oct 2, 2013 6:11 pm by dbna2
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
is it possible to change it know the difference without that? like is it possible to make it go through and be able to use two or three worded skills

Post is unread #14 Oct 2, 2013 6:33 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
I don't want to have to ' ' around the words... unless I REALLY have too... I know dbsaga codebase recongizes 'final shine'

Post is unread #15 Oct 2, 2013 8:20 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
the simplest way is to just add the 's around it. Haven't looked to see the best way around it, but after just a quick glance i didn't see anything that would make it so typing 'final shine' would keep it from working.

Post is unread #16 Oct 3, 2013 1:31 am   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
I am going to send you a copy in your email.

Post is unread #17 Oct 3, 2013 9:31 am   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
and yeah I know that would be the simplest way to do things, but if I could figure out whats causing it, because it didn't used too then my life would be alot easier and wouldn't have to deal with players complaining... Another way I guess would be by making do_alist remove the ' ' from the skill name display not sure how I would do that though...

Post is unread #18 Oct 3, 2013 10:31 am   
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

 
It's most likely the parser.

If your skill system were old school (DikuMUD), you'd be typing "use final shine" or "use 'final shine'", and all would be fine. I suspect the newer parser is keying on the first word to determine if it's a command first, and then if that fails, it walks the sorted list of skills until if finds a match for that word.

If the list is sorted alphabetically (usualy the case, so you can do binary searches instead of a linear walk), of course "final" will match "final flash" before "final shine".

Your solution options are these:

1) Change the parser so it finds the first match and then checks subsequent whitespace dlimited words to see if it's also a match, continuing if not until it hits something that's no longer a match on the first word.

The simplest way would be to have the initial pass collect ALL possible matches and sort them by length, longest first. Then just match the whole skill name against the substring of the full command typed until it matches or falls through. You will have to normalize whitespace on the user input for this, otherwise players will whine when "final shine" doesn't work because they had multiple spaces or tabs or whatever.

2) Change the parser so it no longer uses a binary search (if it does), and hand-sort the skill list into whatever order makes logical sense to YOU and your players. In essence, put "final shine" before "final flash" so typing "final" will linear-search to the one you want it to hit. Prepare for players who expect things to be alphabetical to complain when it no longer makes sense to THEM.

3) Change your parser so it doesn't try to complete skills by themselves, and add a "use" command back in. You may want to add aliases (or commands) for some common skills like "kick" or "bash".

4) If your game has aliases built-in, just add system-wide aliases so "final" expands to "final shine"... same issue with player confusion as (2), but less coding. :)

That's all I can think off offhand. Good luck!

Post is unread #19 Oct 3, 2013 2:57 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
where is the parser

Post is unread #20 Oct 3, 2013 4:42 pm   
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

 
I can't tell you for sure. In *MY* codebase, it's the function command_interpreter() in the file interpret.c. It uses search_block() to identify a valid command, and if that fails, it falls through to check_exit_alias(), and then i3_command_hook(), imc_command_hook(), and finally random_error_message() if nothing was matched.

However, since my MUD started as DikuMUD Alfa, and evolved over 15 years or so, I suspect you'll find a very different layout in your codebase. :)

Pages:<< prev 1, 2 next >>