Mob Using Player Data SYSERR

  • Rumble
  • Rumble's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
More
8 years 11 months ago - 8 years 11 months ago #19 by Rumble
Mob Using Player Data SYSERR was created by Rumble
This question has come up a couple times lately so I decided to post it here to direct people as needed.

Players and mobs (non-player characters, NPC) share many of the same data fields, but not all. So when a mob tries to access player data it gives a SYSERR like this:
SYSERR: Mob using >'((ch)-)player_specials-)saved.pref)' at act.wizard.c:127

The fix is actually a very easy one. All you have to do is make sure it only checks player data if it is a player. The way this is done in the code is with an NPC check. Again, NPC means it is a mob. So you need a double negative to make sure it is not a mob/NPC. I know this is confusing, but programmers are used to these kinds of things so they write unreadable code that makes no sense to normal mortals. If you are still confused you can just copy the example below and modify it to suit your purpose.
-    if (PRF_FLAGGED(ch, PRF_NOREPEAT))                        // This line should be removed, hence the "-"
+    if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))         // This line should be added without the "+"
The changed line now will now check for the flag NOREPEAT and make sure it is not a mob/NPC, then continue if both are true.

I hope this helps and please report these (and any other bugs/SYSERR's) you find. I've corrected dozens of these and they keep cropping up, especially when you switch into a mob and try player commands.

More SYSERR explanations can be found in the documentation: syserr.txt

Rumble
The Builder Academy
tbamud.com 9091
This email address is being protected from spambots. You need JavaScript enabled to view it.
Last edit: 8 years 11 months ago by Rumble.

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds