Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
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
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
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, Google, Bing, Yahoo!

Members: 0
Guests: 16
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » 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, 8:59 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 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, 9:31 am
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

any ideas?
       
Post is unread #3 Sep 30, 2013, 1: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, 1:38 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
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, 1:58 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

example ?
       
Post is unread #6 Sep 30, 2013, 7: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, 8:48 pm   Last edited Sep 30, 2013, 8:50 pm by Remcon
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
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, 9:19 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

thanks :)
       
Post is unread #9 Sep 30, 2013, 10:13 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

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


removeall <arms>

and it will remove all the items from the arms slot?
       
Post is unread #10 Sep 30, 2013, 10:48 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 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, 10:19 am
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 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, 12:58 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
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, 3:56 pm   Last edited Oct 2, 2013, 4:11 pm by dbna2
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 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, 4:33 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 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, 6:20 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
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 2, 2013, 11:31 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

I am going to send you a copy in your email.
       
Post is unread #17 Oct 3, 2013, 7:31 am
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 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, 8: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, 12:57 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

where is the parser
       
Post is unread #20 Oct 3, 2013, 2: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 >>