Facebook  Twitter 


+- +-


+- User Information

Welcome, Guest.
Please login or register.
Forgot your password?

+- Forum Stats

Total Members: 12375
Latest: scuzzy
New This Month: 2
New This Week: 1
New Today: 0
Total Posts: 40218
Total Topics: 7083
Most Online Today: 73
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 54
Total: 54

Author Topic: Need help working on a mod  (Read 3662 times)

0 Members and 1 Guest are viewing this topic.

Offline halbarad

  • Newbie
  • *
  • Posts: 2
    • View Profile
Need help working on a mod
« on: March 08, 2007, 10:09:22 am »

I am quite new to SMF and need some help with a mod I want to do. I am running a forum which will include Roleplaying and as part of that I need to make a dice roller, I want to do this as an additional option when posting a reply to a topic, however I don't know where all the options for this are set, nor where I should really code the rolling of the dice. I think I would also need to change how the posts are shown to check if the user rolled a dice and display the result.

Does anyone have any ideas on how I could do this, or where I should look to start coding the dice rolling options.

Thank you in advance.

Offline SBB

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Need help working on a mod
« Reply #1 on: March 09, 2007, 02:38:28 am »
I'd almost go after posts.php (or, subs-posts.php).

In the actual createpost function, just prior to the insert, do a regex for some pseudo BBCode you're about to invent. Something akin to
[roll=12] or whatever you need. In this case, a 12 sided. I'd suggest just prior to the insert, as you want to wait for the actual post to be created; you do NOT want this evaluated during a preview :)

I suspect the regex would be something akin to

...to support up to 99 sides.

Just prior to the insert, if at least one [roll=] is present, append some linefeeds to the message.
Then for each [roll=] in the post, generate the roll and append it to the message.

To validate that the rolls are legit... a reader merely proves that one or more [roll=] are present in the post, which means the legit rolls will be on the last line or something. (You will need to segregate the roll text from the user message, heh. Otherwise, I'd simply omit the [roll] and supply my own at the end of my message. Wow! I won again!)

Sounds like a fun project!

Offline halbarad

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Need help working on a mod
« Reply #2 on: March 09, 2007, 04:19:07 am »
Thanks for the help. I am not entirely sure how I would do some things (like segregating the roll text from the rest of the message) but I will look into it and see what I can do.

Thanks for the help.


Related Topics

  Subject / Started by Replies Last post
4 Replies
Last post July 21, 2006, 03:00:32 pm
by gamesmad
1 Replies
Last post September 04, 2006, 07:37:29 pm
by Jump1979man
2 Replies
Last post September 20, 2006, 08:15:10 am
by rotor
1 Replies
Last post January 02, 2007, 11:13:41 am
by SMFHacks
12 Replies
Last post June 29, 2008, 12:42:36 pm
by SMFHacks

+- Recent Topics

Download System Lite by Rock Lee
June 03, 2020, 07:34:24 pm

Font question by SMFHacks
May 27, 2020, 08:15:26 am

Error message with latest SMF 2.1 Github build by Hatshepsut
May 25, 2020, 01:43:26 am

smfblog not working on 2.0.17 by tech9
May 20, 2020, 01:44:34 pm

Copyright removal by stbc
May 18, 2020, 01:27:57 am

Mod Verified User i can't square the image by Rock Lee
May 07, 2020, 07:56:10 pm

SMF4Mobile 2.0 released for SMF 2.0.x by SMFHacks
May 06, 2020, 12:13:14 pm

SMF Social Login Pro - Discontinued? by Nicole
May 02, 2020, 05:47:04 pm

Likes by SMFHacks
April 30, 2020, 09:50:35 pm

Upgrade Issue - by SMFHacks
April 28, 2020, 12:40:13 pm

Powered by EzPortal