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
AhrefsBot

Members: 0
Guests: 20
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 #21 Oct 3, 2013 4:48 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
yeah and Remcon has seen my codebase many times(fixed a few things i was stumped at) So I am hoping he will be able to find out whats wrong with it.

Post is unread #22 Oct 4, 2013 11:04 am   Last edited Oct 4, 2013 11:13 am by dbna2
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
So I tried it your way Remcon and the mud didn't like it so much.... It ended up crashing.
It seems to show up when I use slookup "final Shine"


I am at a lost......

Post is unread #23 Oct 4, 2013 7:50 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
well you shouldn't have to anyways, but i will take a look at it sometime and let you know :)

Post is unread #24 Oct 5, 2013 6:33 am   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
appericiate it :) trying to get the game open for round 2 of player testing.

Post is unread #25 Oct 6, 2013 12:57 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
Quixadhal its more or less the same lol :)

Ok, so I just added two skills to my mud, final flash and final shine and of course not useable till after a hotboot and then final flash is 163 and final shine is 164. Slookup works fine to show both, but when using it seems it always uses the final shine. Since I made both skills and target self and affect hit by 5 I just added in hitchar messages to show a message for what skill it was. And you are right on the fact that it has no way to know for sure which you are using so I'll try to find a good way to do it lol.

Post is unread #26 Oct 6, 2013 1:06 pm   Last edited Oct 6, 2013 1:16 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

 
Ok here is the issue
in interp.c find
      /*
       * Grab the command word.
       * Special parsing so ' can be a command, also no spaces needed after punctuation.
       */
      mudstrlcpy( logline, argument, sizeof( logline ) );
      if( !isalpha( (int)argument[0] ) && !isdigit( (int)argument[0] ) )
      {
         command[0] = argument[0];
         command[1] = '\0';
         argument++;
         while( isspace( (int)*argument ) )
            argument++;
      }
      else
         argument = one_argument( argument, command );


It is the fact it allows ' to be used as a command that causes the issue. I don't have a ' command though so it is simple for me to just take and make it
      /*
       * Grab the command word.
       */
      mudstrlcpy( logline, argument, sizeof( logline ) );

      argument = one_argument( argument, command );
      if( command == NULL || command[0] == '\0' )
         return;

The check is to stop it from doing things like '' hi and it using channels etc... lol

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

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
thanks that worked perfectly :)

Post is unread #28 Oct 7, 2013 6:53 am   
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

 
That doesn't make sense....

If you're typing "final shine" to try to use the skill "final shine", argument[0] *IS* alphabetic, so it won't enter that if statement.

A better fix would be to set aside any skills that have spaces in their name and scan for those FIRST.

for( skillCheck = 0; skillCheck < multiwordSkillCount; skillCheck++ ) {
    if(strncasecmp(multiwordSkillName[skillCheck], argument, strlen(multiwordSkillName[skillCheck]) - 1) {
        // found skill, so make that the "command", and carry on as usual
        strcpy(command, multiwordSkillName[skillCheck]);
        argument = argument + strlen(multiwordSkillName[skillCheck] - 1;
    }
}


Of course, you'll need to add a few bounds checks in there, and of course you'll have to break the skills with spaces off into a seperate list to scan, but that's my suggestion.

Post is unread #29 Oct 7, 2013 10:52 am   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
it matters and afterall it was designed to catch ' and treat it like a command, it use to be a command for say or chat lol been a long time so dont recall which right off.

Post is unread #30 Oct 7, 2013 11:57 am   
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

 
Here's the equivalent spot in WileyMUD's code:

    /*
     * Find first non blank
     */
    for (begin = 0; (*(argument + begin) == ' '); begin++);

    /*
     * Find length of first word
     * Order swapped by Quixadhal to fix say bug when using "'"
     */
    if ((*(argument + begin) == '\'') || (*(argument + begin) == ':') ||
        (*(argument + begin) == '\"') || (*(argument + begin) == ',') ||
        (*(argument + begin) == '@'))
        look_at = begin + 1;
    else
        for (look_at = 0; *(argument + begin + look_at) > ' '; look_at++) {
            /*
             * Make all letters lower case AND find length
             */
            *(argument + begin + look_at) = LOWER(*(argument + begin + look_at));
        }

    hack = argument;
    cmd = old_search_block(argument, begin, look_at, command, 0);


Of course, I have no commands that have whitespace embedded in them, but my parser checks ONLY for the things that are actually used as wizard-command or other special prefixes.

Post is unread #31 Oct 18, 2013 7:24 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
alright question. I want to add in something like a defensemod

it would start out at 100% which is normal.
lets say we add 10% so it would be 110% I want it to decrease the damage done to you by 10%

lets say we subtract 10% making it 90%
I want it to increase the damage done to you by 10%

I know where I would put this for it to work. I just can't figure out the math part on it.

Any help ?

Post is unread #32 Oct 19, 2013 6:47 am   
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

 
Assuming a straight linear scale, just look at what you want it to do.

Assuming you're using integers....

int damage;
int shield;

shield = 100;
damage = (int)((double)damage * ((double)shield / 100.0) );

That would increase damage based on the shield level, the opposite of what you want, but it's easy to see how the typecasting works here. You want to use floating point math to scale your damage, and 1.0 would be "normal". You cast it back to an integer to truncate it and make it work with the rest of your system.

Now, you want 90% shields to mean you take extra damage, and 110% shields to take less damage. So, work out the equation to make that work... Of note, percent is simply a ratio, so 100% is 1.0, 90% is 0.9, 110% is 1.1.

damage = (int)((double)damage * (2.0 - ((double)shield / 100.0)));

So, if your shields are at 200%, you take no damage (2.0 - 2.0). If your shields are at 0%, you take double damage (2.0 - 0.0), At 100%, it's normal (2.0 - 1.0).

Finally, you have to cap the bounds to avoid exploits. As is, setting your shields to 300% would heal you, since you'd be taking negative damage. Likewise, if you somehow got a negative shield value...

int shield_attenuated_damage(int raw_damage, int shield_level) {
    if(raw_damage <= 0)
        return(0);

    if(shield_level < 0)
        shield_level = 0;

    if(shield_level > 200)
        shield_level = 200;

    return( (int)((double)raw_damage * (2.0 - ((double)shield_level / 100.0))) );
}


Now, if you want your scale to be different (IE: 500% shields makes sense), you'll have to adjust the formula accordingly. If you want it to scale differently, look into logarithmic functions.

Post is unread #33 Oct 19, 2013 7:02 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
Alright Well I want to have a function that does the opposite as well.
Like a racial attack mod. 100% normal 90% - 10% less and 110- 10% more

Pages:<< prev 1, 2 next >>