News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Custom Fields for Custom Stats

Started by M45T3R5W4G3R, September 17, 2024, 04:24:56 PM

Previous topic - Next topic

M45T3R5W4G3R

Hey all, it is kind of a niché issue but wanted to ask anyway. I used to host a forum RPG back in the day using SMF 2.0.18 and after a while I am considering to reopen another one with SMF 2.1.4. Since the forum is focused on play-by-post RPGs and each account would actually be a character profile, I want to assign custom stats to characters. How I used to achieve it was through the two steps below (sharing it so both the problem could be understood and also people with similar forums may utilize this approach):

  • Disable +/- karma for standard users, rename it to XP, and when users make XP purchases for stats, one of the admins manually adds negative karma. XP (renamed karma) is also given to good RPs or as quest rewards etc.
  • Create custom profile fields to utilize user stats. When an item or dice roll requires stats to be used, do a database lookup from the themes table to find the value of the specific cust_field for the user with ID, convert it to an INT, and use it as an arithmetic modifier.

These two worked well but required a heavy PHP work to implement and still lacked significant automation as if a person purchased a stat with XP, XP had to be reduced from profile manually, and custom field for the stat had to be increased manually as well.

In SMF 2.1.x, I observe the infrastructure for the custom fields is the same as 2.0.x. And also it seems like we cannot just give or take karma with + or - buttons. So... I was wondering if anyone faced a similar issue or has any suggestions on implementing such a system through GUI elements, if possible. I'd appreciate any kind of inputs regarding this.


Illori

karma no longer exists by default in SMF 2.1.

vbgamer45

Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

M45T3R5W4G3R

Thank you both. That is really a good starting point. Besides the karma tho, would you have specific suggestions on introducing GUI support for custom fields?

What I think is I can just create multiple "Karma"s for custom stats based on the mod you shared, which may be well-structured but overbloated. So another idea is maybe implementing some PHP functions to be usable throughout the admin panel so that stats could be given out to custom profile fields as STShop "Add credits to user" interface. Would like to hear your opinions regarding if I am trying to solve the problem from a convoluted way, tho.

Kindred

#4
You are shoe-horning your concept into a system that was not intended to be used like that.

Quite honestly,  your best bet would be to create your own tables with a separate screen to deal with them rather than trying to misuse the karma and custom fields

It would also probably be better, resource-wise
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

M45T3R5W4G3R

I see. I am kinda' afraid of taking things into the GUI side as I only have a small experience with SMF but yeah, you are most likely right. Having a custom table would make a much cleaner back-end and then I'd only have to worry about displaying them in user profiles and modifying them from admin side. Actually quite a simple approach but somehow I didn't think of it while trying to keep away from adding new things on my own. Thanks a lot. ^^

Kindred

oh, you can easily take advantage of the SMF gui design...   Look at how some of the other mods have done it for fields and display...

I'd suggest one of the gallery mods, maybe the articles mod, the custom forms mod, and/or the glossary mod

they all do parts of what you'd want to do for display and field entry -- but they use the defined SMF layouts and functions.


Also -- advantages to doing it this way 1- As a mod, you can easily re-apply it if you ever need to reset your system, 2- using the hooks you can integrate it and enable/disable as needed without actually editing the core forum code 3- you could offer it to other people
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: