Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4257
Latest: Alex998.
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43295
Total Topics: 7523
Most Online Today: 159
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 131
Total: 131

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

0 Members and 1 Guest are viewing this topic.

Offline halbarad

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

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

  • Member
  • *
  • 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

\[roll=(%d{1,2})\]
...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!
- SBB

Offline halbarad

  • Member
  • *
  • 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
8054 Views
Last post July 21, 2006, 03:00:32 pm
by gamesmad
1 Replies
6148 Views
Last post September 04, 2006, 07:37:29 pm
by Jump1979man
2 Replies
6753 Views
Last post September 20, 2006, 08:15:10 am
by rotor
1 Replies
3541 Views
Last post January 02, 2007, 11:13:41 am
by SMFHacks
6 Replies
6112 Views
Last post July 04, 2007, 07:07:59 pm
by stormlrd

+- Recent Topics

Please Help! by SMFHacks
April 17, 2024, 08:04:55 am

Rate own images by fvlog19
April 11, 2024, 10:56:53 am

Tidy Child Boards on 2.1.4 by SMFHacks
April 04, 2024, 03:54:12 pm

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
March 30, 2024, 12:41:08 pm

Can't DROP 'id_member'; check that column/key exists Datei: by SMFHacks
March 30, 2024, 11:58:20 am

No thumbnails on new uploads by Tonyvic
March 29, 2024, 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

Powered by EzPortal