vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=248216

Shuffle Text BB Code (Randomizes text) (BBCode)
by BirdOPrey5
08 Aug 2010 18:43

1 Attachment(s)
This BB Code uses Javascript to shuffle the alpha-numeric and some special characters in a block of text. This can be used to create 'puzzles' for your members or perhaps provide answers to questions that aren't immediately apparent should someone accidentally glance at them. The use is of course up to you.

I found this Javascrpt already created on the web and have left the copyright info in tact. I made minor changes to adapt it to a BB Code.

Demo: here.

Add a new BBCode

Title: Random (Shuffle) Text
BB Code Tag Name: ran
Replacement:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Example: [ran]This is a random test[/ran].
Description: This code shuffles text. Do not use the following characters: " {}[]<>&
Use Option: No
Button Image: (optional) https://www.vbulletin.org/forum/external/2010/08/53.jpg
Remove Tag If Empty: Yes
All Disable Options: Yes

The following special characters do not work: " {}[]<>& (There may be others)
The following special characters do work: .,!?$()

Please mark as installed if you use this. :)
View My Profile for more BB Code Enhancements- they work on all versions.

Example:
[b][ran]A bold example[/ran].[/b] =
ex adlmopbl eA.

BirdOPrey5 08 Aug 2010 18:52

Note- this will randomize the letters each time you load the page... If you want to keep the same persistent order each time the page is loaded change the line in the replacement code:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Replace Math.random() with a number between zero and 1, DO NOT MAKE IT = 1!!!

An example is:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


MagicThemeParks 08 Aug 2010 20:45

Thank you for this sir! :)

I was wondering though....could this randomize the letters of each word rather than randomize the entire sentence or phrase?

For example......

THIS IS WHAT I WANT = hsit si hwta i ntaw

....instead of doing the entire phrase, it would give folks an actual clue to "solve the game" with only the actual letters of each word scrambled.

Can this be done?

EDITED: Just thinking about it....I can actually put the code around each word as a 'workaround'. :)

But, do you know if it could be done automatically to save some time?

BirdOPrey5 08 Aug 2010 23:19

Well anything is possible... let me work on this for a bit and see if I can figure it out... I'm thinking I can split the strings based on spaces and randomize each array that way...

MagicThemeParks 08 Aug 2010 23:22

That would be great! :up:

y2krazy 11 Aug 2010 18:53

Quote:

Originally Posted by MagicThemeParks (Post 2081007)
THIS IS WHAT I WANT = hsit si hwta i ntaw

....instead of doing the entire phrase, it would give folks an actual clue to "solve the game" with only the actual letters of each word scrambled.

Can this be done?

I would love to have this be the case, but how many queries would this add per post on showthread? if it was a paragraph with, let's say 200 words, would it add 200 queries for that one post?

Tagging this Mod, but curious how it will be handled with the potential for so many queries. :)

BirdOPrey5 11 Aug 2010 20:04

JavaScript doesn't run queries... it's all handled by the user's browser, not the server, there are no performance issues.

MagicThemeParks 12 Aug 2010 02:12

Quote:

Originally Posted by BirdOPrey5 (Post 2081058)
Well anything is possible... let me work on this for a bit and see if I can figure it out... I'm thinking I can split the strings based on spaces and randomize each array that way...

Were you able to figure it out?

BirdOPrey5 12 Aug 2010 02:24

Not yet... ran into some issues... will try and look at it again soon. Will let you know as soon as I have something.

MagicThemeParks 12 Aug 2010 03:06

Sounds great! Thanks :up:


All times are GMT. The time now is 10:37.

Powered by vBulletin® Version 3.8.12
Copyright © 2019, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.