Click to open network menu
Join or Log In
Mobafire logo - Happy Halloween

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

Create an MFN Account






Or

Community celebration time! Share a Halloween story or creation to enter our Special Halloween Giveaway! Less than 24 hours remaining. 🎃
's Forum Avatar

Using javascript (or any other coding language)...

Creator: Ekki September 6, 2015 6:51pm
1 2
Ekki
<Veteran>
Ekki's Forum Avatar
Show more awards
Posts:
1091
Joined:
Nov 28th, 2013
Permalink | Quote | PM | +Rep September 6, 2015 6:51pm | Report
So I'm currently reworking one of my guides, and I want to add a random item generator to the build. I figured out that maybe mobafire allows for some kind of code embedding, but I haven't found anything other that it has a specific bracket for javascript and HTML, so I guessed it maybe supports javascript.

I haven't tried anything yet, but I don't want to get my hopes high if it can't be done (or it's not allowed).
OTGBionicArm
<McFly>
OTGBionicArm's Forum Avatar
Show more awards
Posts:
10305
Joined:
Jan 8th, 2012
Permalink | Quote | PM | +Rep September 6, 2015 7:15pm | Report
I dont think theres rule against it as long as nothing you add is offensive. Not sure how to do it, if the page actually allows it though.

Edit: there is a way to randomize images, but im not sure if it works on icons like too.
Ekki
<Veteran>
Ekki's Forum Avatar
Show more awards
Posts:
1091
Joined:
Nov 28th, 2013
Permalink | Quote | PM | +Rep September 6, 2015 8:18pm | Report
I dont think theres rule against it as long as nothing you add is offensive. Not sure how to do it, if the page actually allows it though.

Edit: there is a way to randomize images, but im not sure if it works on icons like too.
I'm more concerned that the way to do it is mess with the bbcode parsing, like adding a </stop interpreting bbcode> or whatever then manually add code, which is a really dirty way to modify things and may be forbidden.

I've seen people randomize their signatures, but I only saw it with images, and I doubt I can add conditions to the random generator, or nest the randomizers. I guess I could make code to generate a list of all possible combinations that I would need, then somehow add that to my guide via the image randomizer, but it would be too much work for something that I could do with an external program.

Anyways, thanks for reminding me of the sigs randomizer. Not all hope is lost :P
Janitsu
<Moderator>
Janitsu's Forum Avatar
Show more awards
Posts:
8829
Joined:
Jul 3rd, 2011
Permalink | Quote | PM | +Rep September 6, 2015 9:58pm | Report
If you want to randomize with BBCode you'll need [randomize][/randomize] and [ri] for each randomize part.


[randomize]
[ri][icon=trinity force size=64]
[ri][icon=infinity edge size=64]
[ri][icon=bloodthirster size=64]
[ri][icon=phantom dancer size=64]
[/randomize]

will yield:





EDIT: Seems like it doesn't work for items, though, I'll copy-paste my signature for more information whether it's a bug with randomizing or with items only

~Junatsee's Graphics~

Thanks to 'Manda!

Thanks to OwenTheAwesomer for the signature =)
Ekki
<Veteran>
Ekki's Forum Avatar
Show more awards
Posts:
1091
Joined:
Nov 28th, 2013
Permalink | Quote | PM | +Rep September 6, 2015 10:18pm | Report
Janitsu wrote:
If you want to randomize with BBCode you'll need [randomize][/randomize] and [ri] for each randomize part.
Apparently, the [randomize] function only works in signatures. *sigh* Well, at least now I know how to randomize my signature.

EDIT: I have tested it with a guide and apparently it works there. I'll work from there and see if it's enough for what I have in mind. Thanks for the help!
jhoijhoi
<MOBAFire Mother>
jhoijhoi's Forum Avatar
Show more awards
Posts:
14438
Joined:
Mar 20th, 2011
Permalink | Quote | PM | +Rep September 7, 2015 5:47am | Report
No... the randomize feature works all over the site, just the way it is intended. If you copy Jan's post, like I do below, you'll see (most likely) that I'll get a different item.

If you wish for the item to be randomised each time the page is reloaded, no, that won't work. You'll need to change some aspect of the text in the post for the randomise feature to work.



^ As my post is significantly different to Jan's the randomize code triggers. If you quote my post and add some of your own text, the item will be different.

Not sure why it works with guides though - are you sure you just weren't editing it repeatedly, thus forcing a new randomize seed?
♡ guide writing tips 'n tricks ♡ ashes to ashes ♡ fancy a sig? ♡

♡ sig by natuhlee ♡
Ekki
<Veteran>
Ekki's Forum Avatar
Show more awards
Posts:
1091
Joined:
Nov 28th, 2013
Permalink | Quote | PM | +Rep September 7, 2015 2:00pm | Report
jhoijhoi wrote:
No... the randomize feature works all over the site, just the way it is intended. If you copy Jan's post, like I do below, you'll see (most likely) that I'll get a different item.
I was suspecting this was the case. I think the problem was that I was testing it as a preview, which probably generated the guide each time, thus resetting the seed. The update time is quite big, and the url says "nocache" somewhere, so this may be the case.

jhoijhoi wrote:
If you wish for the item to be randomised each time the page is reloaded, no, that won't work. You'll need to change some aspect of the text in the post for the randomise feature to work.
Some aspect of the text in the post? You mean like editing it? Or some bbcode property of the randomize feature?

I guess I'll have to test if this works in one of my full guides (should I do it there or make a new guide and erase it as soon as I test this?).
Latest Legend
<Member>
Latest Legend's Forum Avatar
Show more awards
Posts:
3040
Joined:
Dec 7th, 2012
Permalink | Quote | PM | +Rep September 7, 2015 2:04pm | Report
Ekki wrote:
I'm more concerned that the way to do it is mess with the bbcode parsing, like adding a </stop interpreting bbcode> or whatever then manually add code, which is a really dirty way to modify things and may be forbidden.

I've seen people randomize their signatures, but I only saw it with images, and I doubt I can add conditions to the random generator, or nest the randomizers. I guess I could make code to generate a list of all possible combinations that I would need, then somehow add that to my guide via the image randomizer, but it would be too much work for something that I could do with an external program.
If the devs know what they're doing the HTML characters will be escaped. Which is the case AFAIK.

I believe you can nest randomizers. You can't add conditions but I think you should be able to handle simple logic with nesting and a lot of copying. What are you trying to achieve?

As a side note, what is the purpose of a guide if the build is randomly generated? xD
********'s a pretty good fertilizer
OTGBionicArm
<McFly>
OTGBionicArm's Forum Avatar
Show more awards
Posts:
10305
Joined:
Jan 8th, 2012
Permalink | Quote | PM | +Rep September 7, 2015 2:12pm | Report

As a side note, what is the purpose of a guide if the build is randomly generated? xD

Perhaps it's not random items but a randomized full build for various situations. That makes sense to me.
Ekki
<Veteran>
Ekki's Forum Avatar
Show more awards
Posts:
1091
Joined:
Nov 28th, 2013
Permalink | Quote | PM | +Rep September 7, 2015 2:23pm | Report
If the devs know what they're doing the HTML characters will be escaped. Which is the case AFAIK.

I believe you can nest randomizers. You can't add conditions but I think you should be able to handle simple logic with nesting and a lot of copying. What are you trying to achieve?

As a side note, what is the purpose of a guide if the build is randomly generated? xD
I tried nesting randomizers but it seems to generate several bugs, like adding previous [ri] values to the current randomizer, then calling the randomizer again. I doubt I can do most of what I want simply by nesting randomizers, but I guess I can work something off of it.

The idea is generating a different build every time you enter, but not just a random bunch of items. The guide would generate a playable build, which may need a bunch of logic to work :/ I could manually pick most of the options in the random seed, but it may be a lot of work, depending on how intertwined are the items considered "decent" in each case.
1 2

You need to log in before commenting.

League of Legends Champions:

Teamfight Tactics Guide