Click to open network menu
Join or Log In
Mobafire logo

Join the leading League of Legends community. Create and share Champion Guides and Builds.

Create an MFN Account






Or

MOBAFire's first Mini Guide Contest of Season 14 is here! Create or update guides for the 30 featured champions and compete for up to $200 in prizes! 🏆
's Forum Avatar

Randomize Code...

Creator: jhoijhoi August 1, 2012 4:51am
15 posts - page 1 of 2
1 2
jhoijhoi
<MOBAFire Mother>
jhoijhoi's Forum Avatar
Show more awards
Posts:
14438
Joined:
Mar 20th, 2011
Permalink | Quote | PM | +Rep August 1, 2012 4:51am | Report
... doesn't seem to be working in forum posts?

http://www.mobafire.com/league-of-legends/forum/build-and-guide-discussion/mobaverse-library-16669

I'm trying to get a series of links to randomize within my post in order to make exposure "fair", but currently it's just "stuck" on one link when you refresh the page... :/
guide writing tips 'n tricksashes to ashesfancy a sig?

♡ sig by me ♡
Lugignaf
<Veteran>
Lugignaf's Forum Avatar
Show more awards
Posts:
10968
Joined:
Feb 8th, 2011
Permalink | Quote | PM | +Rep August 1, 2012 11:39am | Report
I know for a fact that it works on forum posts.

Maybe, because of how you coded it, it's messing up?

2

You should a random number from 1-3 here.

EDIT: Okay... It used to work. Now it seems borked.
Sig courtesy of GrandmasterD. Go get your own sig from them. :D
jhoijhoi
<MOBAFire Mother>
jhoijhoi's Forum Avatar
Show more awards
Posts:
14438
Joined:
Mar 20th, 2011
Permalink | Quote | PM | +Rep August 1, 2012 4:00pm | Report
^^ Yeah, it used to work. Like, it was literally working, but as soon as I added links, it just stopped working.
guide writing tips 'n tricksashes to ashesfancy a sig?

♡ sig by me ♡
Mowen
<Retired Admin>
Mowen's Forum Avatar
Show more awards
Posts:
6449
Joined:
Nov 7th, 2010
Permalink | Quote | PM | +Rep August 1, 2012 4:53pm | Report
I know Matt fixed something in the code a while back, maybe it broke this. So I'm sure he'll get on this soon.
Canoas
<Member>
Canoas's Forum Avatar
Posts:
3064
Joined:
Nov 9th, 2010
Permalink | Quote | PM | +Rep August 2, 2012 9:07am | Report
A few weeks ago, when I changed my sig, I noticed that the randomize code didn't work on forum posts. I assumed it was supposed to be that way, but if it's not then please fix it. It's a very... interesting feature.
Matt
<Administrator>
Matt's Forum Avatar
Show more awards
Posts:
4286
Joined:
Dec 8th, 2009
Permalink | Quote | PM | +Rep August 3, 2012 2:54am | Report
The randomize feature was created for use in signatures to help you guys include more information and creativity in your sigs without having 90% of every page just be massive signatures. It wasn't meant to be used anywhere else.

The nature of our bbcode system currently means you can use any tag anywhere unless I specifically add code to block it in some areas. So you can use randomize elsewhere, but since caching happens AFTER the bbcode is rendered, the cache will include whatever random item was selected. Next time the cache rebuilds, the randomize will run again and a different item will get selected. So jhoijhoi if you check back after a while, and the cache has cleared, you'll see a different item.

I specifically disable caching in signatures just to allow randomize to work, it means more load on the server but you guys like the feature a lot so I deal with it. Elsewhere on the site, to make randomize work I either have to disable caching or I have to make it entirely client-side. I can't disable caching, and I'm not super keen on making it client-side...

Note that the forum didn't always have a lot of caching, but some time ago I had to start adding it in to reduce load, mainly caching compiled bbcode.

You might also want to know that, guest caching is much more aggressive. If you log out and look at the forums, signatures will stop randomizing on every page load. That only happens for members. It's because I cache the entire page all at once for maximum speed.
jhoijhoi
<MOBAFire Mother>
jhoijhoi's Forum Avatar
Show more awards
Posts:
14438
Joined:
Mar 20th, 2011
Permalink | Quote | PM | +Rep August 3, 2012 4:47pm | Report
Ah okay Matt, thanks for that. I wasn't aware that it was a caching issue, as I remember a while ago us regulars would make luls posts with the randomise code in the forums, but I guess that was before you tried reducing the load :)

It's not necessary for the randomise code to work in the forums. The only reason why I was trying to use it was to achieve the same sort of effect as the front page; a set of new guides would appear every time you revisited.

But yeah ^^
guide writing tips 'n tricksashes to ashesfancy a sig?

♡ sig by Jovy ♡
Matt
<Administrator>
Matt's Forum Avatar
Show more awards
Posts:
4286
Joined:
Dec 8th, 2009
Permalink | Quote | PM | +Rep August 5, 2012 3:15am | Report
Yeah, it would be nice to be able to do stuff like that. Hell, if we could disable caching across the entire site, that would be awesome, we could do some wicked stuff :((( But we can't :(((

I'm about to ramble on about some tech stuff that may bore many of you so, feel free to tune out here ;)

I have been rebuilding the bbcode system manually and I actually have a fully working hand-crafted bbcode parser that handles everything in our database (I ran database-wide batch tests to compare). It's WAAAAAY faster for two reasons. 1) No regular expressions at all, it's all low level string handling. 2) It can do multiple compile sweeps which would allow me to compile majority of tags ahead of time, cache them permanently, and then only compile the last few tags right before display (mainly tags that do not have static output, like randomize or embed build from current guide stuff). Hopefully meaning that I can do bbcode caching without breaking those things, as currently happens in many places.

The only thing it doesn't yet do though, is handle white space the same way the current library does. Which is a show stopper. The current bbcode library I use has really wonky white space handling, I hate it, but I have to simulate it or all your past guides and comments will look wrong. I just haven't had the time to work through that yet. One of these days...
jhoijhoi
<MOBAFire Mother>
jhoijhoi's Forum Avatar
Show more awards
Posts:
14438
Joined:
Mar 20th, 2011
Permalink | Quote | PM | +Rep August 5, 2012 6:31am | Report
How different? If it's a factor of being worried some of our lines won't match, but it speeds the performance of the site by a huge amount, I'm sure people will be willing to accept they'll need to fiddle with code a little bit more to get their guides to fit the new system.

Sounds like a challenge though, that I hope you can overcome ^^
guide writing tips 'n tricksashes to ashesfancy a sig?

♡ sig by Jovy ♡
Canoas
<Member>
Canoas's Forum Avatar
Posts:
3064
Joined:
Nov 9th, 2010
Permalink | Quote | PM | +Rep August 5, 2012 11:24am | Report
Honestly, you shouldn't allow randomize on comments or guides. It would be so easy to create confusion all over the forum. One person reading one argument, the other reading the opposite argument, and me laughing. Yes, it would be fun, but it would create needless trouble for the mods.
And in guides.. 99% of the people see the right build, but one unlucky dude would get the ****piest one possible.
"Hmm, 90%+ rating? I guess this build must be good"
Hahaha.. guess again
1 2

You need to log in before commenting.

League of Legends Champions:

Teamfight Tactics Guide