Forum:Calculators in infoboxes

From the RuneScape Wiki, the wiki for all things RuneScape
Jump to: navigation, search
Forums: Yew Grove > Calculators in infoboxes
Archive
This page or section is an archive.
Please do not edit the contents of this page.
This thread was archived on 7 December 2011 by TyA.

A while ago, I was thinking it would be nice if we could have calculators in infoboxes, to make it easier to calculate amounts of kills for a monster. This would make it easier to plan the amount of XP you'd get from killing the amount of monsters you want to kill, without needing to get your calculator and re-entering the calculation for every change you'd like to make. This is the same as our Calculators, but then inside an infobox to make it easier to use.

To make this possible, I wrote a script at User:Joeytje50/monstercalc.js (if you want to test it you can import it with importScript('User:Joeytje50/monstercalc.js') in your .js file). This script does the following:

  • Adds a small input box of 30px wide (4 characters) allowing up to 5 characters to monster pages that have an "Experience for killing" row in the infobox, and another one for monster pages that have a "Slayer XP" row in the infobox
  • Adds a small input box of 50px wide (7 characters) allowing up to 10 characters to item pages that have an "Exchange price" row in the infobox, and another one to all of the GE prices given for items with multiple GE price, using either {{Exchange potion}} or {{Exchange varieties}} (so it adds one input box for each price, so 4 input boxes for potions)
  • When clicked on, it selects the contents of the input
  • Adds commas to the result of the GE price calculator (could easily be added to the other 2 too)
  • When the input is empty, it displays the value for 1 kill or item
  • When non-numeric characters are added, they are ignored and the user is notified that the non-numeric characters are ignored

I think these calculators could be great for planning the amount of experience you will get for a slayer task, or the costs for buying an amount of ingredients for something you want to do etc.

I don't think these scripts affect pageloads that much, as the script checks if the page has the correct element on the page to let the calculator work, before running the script, so if there is no exchange price on the page, the script just doesn't run.

I could also add or remove functions to the script, for example adding commas to the "Experience for killing" and "Slayer XP" calculators, or not selecting all content of the input when the box is clicked, or add another script for [[Template:Infobox Hunter]] or other infoboxes (probably Template:Infobox Construction and Template:Infobox Tree, the experience rows, too). I could quite easily modify the script to be more useful, so please suggest things you want to have improved. JOEYTJE50TALKpull my finger 10:19, October 27, 2011 (UTC)

Added function - There is now a checkbox in front of the kill xp calc, which decides if the two boxes of fight and slayer xp can communicate. If it is not checked, only the calculator that is being typed in is affected, but if it is checked, entering something in either one automatically transfers it to the other one. The checkbox only appears if both calculators are on the page. I am going to let it depend on cookies if the checkbox is checked by default or not. JOEYTJE50TALKpull my finger 17:40, October 27, 2011 (UTC)

Discussion

Support - Also support adding it to other infoboxes like Infobox Hunter. JOEYTJE50TALKpull my finger 10:19, October 27, 2011 (UTC)

Support - I like it, sounds like it brings more utility to the pages especially slayer tasks, that would make it so simple to input my next check point. Quest.png Darrik Ash US serv.svg HS ALDarklight detail.png 16:18, October 27, 2011 (UTC)

Slight support - I like the idea, however I'm unsure of how "good" it would look on the page, couldn't they just head over to our calculators? Also, the code is a mess, to me. Ts4kNfA.png 23:29, October 28, 2011 (UTC)

If you're unsure of that, you could import my script and see what it looks like. JOEYTJE50TALKpull my finger 11:39, October 29, 2011 (UTC)
There are a lot of things you still need to fix with the code, such as special cases in infoboxes where there are characters that aren't numbers. Also, I don't like the current layout. It's just a textbox preceding the experience/price. Plus, like Walrus said, you could clean the code up still. Suppa chuppa Talk 20:29, October 29, 2011 (UTC)
Should I add a title to the input boxes to make that a bit clearer, and add //comments to the script then? JOEYTJE50TALKpull my finger 15:28, October 30, 2011 (UTC)
I've cleaned up the code a bit, added something new to make the script work at implings, which had 2 different xp values, and now the calculator treats them as different numbers and calculates them seperately, and I've added a title to the input boxes to make clearer what it is for. Is there anything else that needs improvement? JOEYTJE50TALKpull my finger 15:10, October 31, 2011 (UTC)

Support - I think it's a great idea, and incredibly helpful too. But I don't think people would know how to use it if it's just a textbox before a certain parameter. I doubt people would even notice it's there. ɳex undique 20:39, October 29, 2011 (UTC)

Weak support - Heh why not? Hofmic Talk 04:03, October 30, 2011 (UTC)

Comment - I'm trying to get an improved calculator script added to [[MediaWiki:Common.js]]. If this ever happens, the features you describe could be implemented through it, rather than having separate code specifically for it. Stewbasic 02:50, November 1, 2011 (UTC)

Your calculator scripts look great, and if they could be added and made to seem intuitive to most of our base, that would be awesome. Suppa chuppa Talk 04:47, November 1, 2011 (UTC)
Even though it would be great to have your script on the wiki, we could add your script and my script seperately, and when your script is finished, merge the two scripts into one page. JOEYTJE50TALKpull my finger 17:18, November 6, 2011 (UTC)

Support - I'd love this. It'd make things a lot easier, just as long as people know what exactly it does. Blaze_fire.png12.png 08:33, November 9, 2011 (UTC)

Support - Only one problem I see with this: for monsters with multiple levels (and therefore multiple xps), the script does not work. Great work though! Quest point cape.pngTalk Newbie856 edit count Nomad guideMusic icon.png 21:56, November 10, 2011 (UTC)

I just changed the script that it can multiply multiple amounts of experience when the infobox has a comma or slash seperated list, up to any amount. So if a monster has 10 versions it will still multiply each version by the input value. The only problem still is that in Template:Infobox Monster, the amount of xp received from killing a monster won't work if the amount of lp in the parameter contains anything other than a number, so if there are multiple LP values, that box won't appear (so, also no calculator). An example of multiple values is dwarf. JOEYTJE50TALKpull my finger 11:51, November 16, 2011 (UTC)

Not yet - The script is a good idea, and I'm sure it will help many users, but it just isn't ready yet. In terms of layout, I still think it might be confusing to many viewers as they will have no idea what's going on. Additionally, there are a lot of things that don't necessarily work with the script yet, as has been already mentioned above. From a javascript point of view, what Walrus and I were trying to tell you is that what you have is lengthy and inefficient. We don't want to increase the load time on pages unnecessarily. Suppa chuppa Talk 00:02, November 11, 2011 (UTC)

I just asked a couple of people what they would think those boxes are for if they'd see them, all but one understood it immediately, and the one who didn't get it immediately, tried entering stuff there and found out what it was that way. Also, the script is quite efficient already, as only the scripts that can actually apply to a page will be run, and within the scripts only the parts that can be used are loaded. If you got an idea to make it more efficient, you're free to change that, but I don't see how I could make this script more efficient while still keeping all features. JOEYTJE50TALKpull my finger 17:59, November 11, 2011 (UTC)

Oppose of sorts - why not just make this calculator on its own page?  —The preceding unsigned comment was added by KDanger100 (talk).

This way people can do it faster. Instead of opening a page with a calculator, it'd be in the infobox. ɳex undique 12:31, November 21, 2011 (UTC)
so long as there isnt page lag i guess it would work well that way. also sorry not for signing Zaros symbol.png KDanger Talk 17:49, November 21, 2011 (UTC)

Support This looks like a great idea, however, I still feel what Suppa and Walrus said- I'm wondering how it would look on the pages itself, and that the code might need tidying up, but then again, looks aren't everything. However, it does look like an overall great plan, and I would love to see it implemented. :) S T Y G 16:46, December 2, 2011 (UTC)

Conditional support - After importing Joey's script and testing it out, it works great. It's such a simple addition, but quite a handy one. However, I'm not all that knowledgeable about js, so I'd prefer any problems with the code that people who (I assume) are knowledgeable about js put forth be addressed before the script is implemented wiki-wide. Matt (t) 21:27, December 2, 2011 (UTC)

Closed - Joey's script will be added to the Common.js page. svco4bY.png3Gf5N2F.png 22:06, December 7, 2011 (UTC)