[Home] [Downloads] [Search] [Help/forum]

Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  I face an important bug.

I face an important bug.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by Oblisgr   (123 posts)  [Biography] bio
Date Sun 19 Jul 2020 08:07 PM (UTC)
Hi i just ask if someone have noticed a bug like this.
When i save my game the attributes and the ac of my player are rising. Each time i save they all go up.

I replaced my save.c with a fresh one and nothing changed so for sure it is not from there.

Anyone has face a bug like thing from his coding experience?

I m trying to find what causes the problem and fix it but i can figure ouy what other files are interract with this kind of stuff.

If anyone knows...
I will be grateful
[Go to top] top

Posted by Nick Gammon   Australia  (23,017 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 19 Jul 2020 09:15 PM (UTC)
Do you mean, when you type "save" your HP etc. immediately go up in game? Without reloading? Or do you mean, they are higher next time when you load the game, compared to when you saved it?

What you could do is type "save" and then edit your player file and see if the correct numbers were saved, eg.

Version      5
Name         Admin~
Sex          1
Class        5
Race         1
Age          0 23 9 605
Languages    -1 1
Level        65
Played       31580733
Room         21004
HpManaMove   24 24 145 145 110 110    <----- HERE

If the numbers in the save file are wrong, you have a problem in your saving.

However if they are correct, but higher when next loaded, you have a problem in your loading code.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Oblisgr   (123 posts)  [Biography] bio
Date Reply #2 on Mon 20 Jul 2020 06:22 AM (UTC)
The numbers in pfile are changing too.
Everytime i do save the numbers there change too.

I replaced my save.c file with a clean one and did that just to check if i have the bug, and ideed i had so if i m right and save.c is the file that handles the saving, then it has no problem.

I dont thing it is a loading problem since the mud reads the wrong values that the pfile has.

The thing is that every time it stacks the new values to the old one. For example if Str is 10, after save it will be 11 (+1), then i save again and it gets 11 from pfile and adds +1 so 12 and goes on.

I also tried to grep for the AttrMod just to check if something else might be occured somewhere else but i havent touched anything there.
[Go to top] top

Posted by Oblisgr   (123 posts)  [Biography] bio
Date Reply #3 on Mon 20 Jul 2020 04:11 PM (UTC)

Amended on Mon 20 Jul 2020 04:14 PM (UTC) by Oblisgr

I think i found why the ac is messed up.
I have 3 armor skills in my mud, light, medium and heavy.
I wanted to make them give extra ac by skill level so i replaced in handler.c under apply_ac function the following code with the next one but it causes problems.
Do you see how i cant be fixed maybe?

      case WEAR_BODY:
         return obj->value[0];

     case WEAR_BODY:

        if( obj->value[5] == 1 )
          if(LEARNED(ch, gsn_lightarmor) > 0)
          armortype = ((obj->value[0] * 10) + LEARNED(ch, gsn_lightarmor))/10;

        if( obj->value[5] == 2 )
          if(LEARNED(ch, gsn_mediumarmor) > 0)
          armortype = ((obj->value[0] * 10) + LEARNED(ch, gsn_mediumarmor))/10;

        if( obj->value[5] == 3 )
          if(LEARNED(ch, gsn_heavyarmor) > 0)
          armortype = ((obj->value[0] * 10) + LEARNED(ch, gsn_heavyarmor))/10;

      return armortype;
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]