RuneScape:WikiGuilds/Calculators

From the RuneScape Wiki, the wiki for all things RuneScape
Jump to: navigation, search
Archive
This page or section is an archive.
Please do not edit the contents of this page. Direct any additional comments to the current project page or contact an administrator for aid if no talk page exists.

The Calculator WikiGuild is a project to help develop and maintain the wiki's calculators, used to derive a variety of things such as training profits, experience points gained during various activities, combat levels, and more. The recently-installed JS Calculator script also enables these calculators to run dynamically on a page. See Forum:Java calculators for the discussions which brought about this WikiGuild. We need help making these calculators useful and putting them in useful locations on the wiki!

Members

Sign here if you are helping us!

Tasks

  • Help develop and debug various RuneScape calculators.
  • Determine the best place to put the calculators.

Links

Proposed Calculators

Proposed calculators should be added as a subsection here for discussion. Once you feel the discussion has run its course, then leave a note stating so and an administrator will add it to the archive.

Alchemy Value (Stelercus)

This calculator can be used to determine how many of an item is required to get to a certain Magic level or XP number and how much money this will cost. It will then determine how much you will get in return and your final profit. Magic-icon.pngStelercusIlluminated Book of Balance.png 22:03, May 27, 2010 (UTC)

Efficiency (Cook Me Plox)

This calculator shows at what point a certain training method is more efficient than another, based on Experience per hour and Profit/Loss per hour or GP/XP. Thanks Gaz Heart ʞooɔ 00:00, July 17, 2010 (UTC)

Anytime =D Quest.png Gaz Lloyd 7:^]Events!99s 18:42, July 27, 2010 (UTC)

Calculators/Magic maximum hit|Magic max hit (Newbie856 and Gaz Lloyd who created the template)

I simply used the existing template and made it into a dynamic calc, was quite easy since the template was really well explained.

Note to all those who want to edit it: could someone please change the template so that words are not case-sensitive, that way I can change the way they are written in the form. I would have done it myself but I got lost in the code o_O. Also, a few other things are to change (ex: only mature wmb is accepted instead of mature wizard's mind bomb). It isn't a biggy but it seems kinda weird when you look at it.

Quest point cape.pngTalk Newbie856 edit count Nomad guideMusic icon.png 18:05, July 27, 2010 (UTC)

All text inputs to the template are already case-insensitive. I expanded mature wmb (though that is the actual in-game name, I agree that a non-abbreviated version would be better).
As an extra note there is a version here, we should decide whether to remove the calc from there (with a link to this page), or whatever. Quest.png Gaz Lloyd 7:^]Events!99s 18:42, July 27, 2010 (UTC)
Hmm... of course, something never works when you want it too, but when you show it to someone it does! Anyway, thanks for changing the mature wmb and pointing out to me that it actually was case-insensitive. As soon as Quarenon's submitunfocused function comes out, I'll change the forms so that spells are less complicated to input by having different categories activated by a selection menu. Until then, a text field is fine (I think). Quest point cape.pngTalk Newbie856 edit count Nomad guideMusic icon.png 19:41, July 27, 2010 (UTC)

Calculators/Comparing farming herb prices (Newbie856)

More or less a dynamic calc. It pretty much compares planting herbs depending on the number you harvest. It's basicly a dynamic version of Calculators/Farming herbs#Second Calculator. It's pretty neat if you want to find which herb is more profitable and starting how many herbs are farmed. Test it by comparing snapdragon and ranarr and you will soon understand. Quest point cape.pngTalk Newbie856 edit count Nomad guideMusic icon.png 18:31, July 28, 2010 (UTC)

User:Dd4235/Calcs/RC/UI (DD4235)

This is a dynamic calc that finds profit/loss RCing. It's still a work in progress (no mem. runes or multi-rune support), but it works. I modeled it after the Mining calc, and it works pretty much the same way. MiningDD4235TalkSmithing 04:13, September 14, 2010 (UTC)

I finally got the RC calculator working. It has support for all runes and has multirune support. If anyone sees any bugs, please post them on this page. Otherwise, I will put the calc on the Calculators page Thurs. Sept 16, 2010 MiningDD4235TalkSmithing 22:31, September 15, 2010 (UTC)
Woot, another member of RS:Calc ! In all seriousness though, nice work! Just wondering, why is it not on the calculators page? It is pretty epic! Is it incomplete or something, 'cause we really need a RCing calc. Quest point cape.pngTalk Newbie856 edit count Nomad guideMusic icon.png 21:37, October 9, 2010 (UTC)
Method of Leveling Comparison Calculator
A calculator that calculates the total cost of skilling using different methods. This calculator takes the methods shown from the skill training pages and adds a calculator that shows exactly how much they cost and how long it would take to achieve the desired level.
A person would only need to indicate which levels they wanted to start and stop each method and show how much they feel they can earn per hour. Since these items change for each player the calculator would show customized information for that player.

All Fields but Item 1, A and B would be automatically filled in:

1. Coins the player feel comfortable earning per hour (Fill in Manually)


Skill Category:

A. Starting Level Using This Method (Fill in Manually)

B. Finishing Level Using This Method (Fill in Manually)

C. Method of Leveling

D. Experience Needed to Level between Levels Shown

E. XP per Hour Using this Method

F. Items Required to Level between levels shown

G. Grand Exchange Price of Items Required to be invested (F x G.E. Price)

H. Grand Exchange Price of Items to Be Sold after Using Method (F x G.E. Price of Converted Item)

I. Profit or Loss Created after Selling Converted Items (G - H)

J. Profit or Loss per Experience Point (I / B)

K. Number of Hours would it take to level between levels shown using this method (D / E)

L. Time Value in Coins (Item 1 x K)

M. Total Cost in Time and Coins (I + L)

N. Total Cost in Time and Coins Per Experience Point (M / E)

This is a quick example of how this calculator could work for firemaking. This person filled in that they planned to level on only normal, maple, and magic logs. They could have changed it up in any way to compare their results using this calculator. See below.


$ Player Earns Per Hour: $500,000
A. Start Lvl B. Finish Lvl C. Method D. XP Needed E. XP / Hr F. Items G. $ Invested H. $ Returned I. Profit/Loss J. Profit/Loss per XP K. Hours L. Time Value in $ M. Total Cost N. Cost / XP
1 45 Normal Logs 61,512.00 48,000 1,537.80 126,099.60 - (126,099.60) (2.05) 1.28 (640,750.00) (766,849.60) (12.47)
0 0 Oak Logs - 72,000 - - - - - - - - -
0 0 Willow Logs - 108,000 - - - - - - - - -
45 75 Maple Logs 1,148,909.00 162,000 8,510.44 476,584.47 - (476,584.47) (0.41) 7.09 (3,546,015.43) (4,022,599.91) (3.50)
0 0 Eucalyptus Logs - 232,200 - - - - - - - - -
0 0 Yew Logs - 243,000 - - - - - - - - -
75 99 Magic Logs 11,824,010.00 364,200 38,920.38 58,886,527.75 - (58,886,527.75) (4.98) 32.47 (16,232,852.83) (75,119,380.58) (6.35)
Total 13,034,431.00 59,489,211.82 - (59,489,211.82) 40.84 (20,419,618.26) (79,908,830.08)


When the primary skill leveling methods are on the list, this calculator could be tied to the high scores table so a person could type in their screen name to show approximately how long and how many coins it would cost (or earn) to level each skill from their current level to 99 in time, coins, and oportunity cost figuring the amount that they make per hour.

I Will try to help out as much as I can. I have used a spreadsheet like this on excel and it has consistantly been a great resource. Look forward to hearing your ideas and recommendations.Orninion132 05:24, November 11, 2010 (UTC)


house design and cost calculator (scaper12123)

Ok, here's my idea. What if there was a calculator that you could use to plan out the layout of your house, with all the different furnature you could put in it, and after everything is put together, the calculator would tell you how much your house would cost when doing certain things like buying flatpacks, gathering resouces from scratch, or buying items like planks off of the ge. It would be complex, no doubt, but it's an idea to throw out there. Scaper12123 19:08, December 26, 2011 (UTC)

The re-up

According to the most recent Poll, people want more calculators. For now, before we go to work in earnest on this, we should make a list of the calculators that we want.

Skill calculators

Ideas for extending the calculators

I notice there's been talk recently about extending the javascript calculators. I have some suggestions for this (which I would be happy to help implement if they are agreed upon). I've put a demonstration of some of these ideas here.

Client-side calculations with javascript. Currently when calculators... erm... calculate, they request a template page from the wiki, which then uses its template parser to determine the result. This suggestion has the following advantages:

  • Less strain on the wikia server
  • (probably) less wait for the answer
  • (possibly) avoiding the clunky syntax of wikia templates

The main disadvantage is that the existing calculators are in wikia template format. Also it would mean more overhead in [[MediaWiki:Common.js]] (though maybe we could check if the page has calculators before loading the calculator stuff).

Label arbitrary elements as input/output. That is, rather than give a bunch of parameters which the calculator code uses to create an input form, let the calculator writer flag a <div> or <td> element as a holder for an input element. This would give more control over the layout of the calculator; eg the Calculators/Max_hit_melee|max hit calculator would look much better in 2 columns IMO.

Toggle inputs. It's already been suggested that we add radio buttons and checkboxes. I also propose (conditional on the last suggestion) marking entire elements to toggle their background colour when clicked, as on the penguin list.

Save variables to a cookie. I also noticed that the penguin list uses a cookie to remember what the user has entered. It'd be cool if a calculator could mark certain variables (eg "strength_level") to be saved to a cookie and restored next time the user came to that page. Moreover if we were consistent about variable names, they could enter it on one calculator and have it appear on some other calculator which used the same field. (Also it'd be nice to replace the penguin list with a calculator instead of having code in [[MediaWiki:Common.js]] just for that).

Stewbasic 17:40, February 28, 2011 (UTC)

This is a great list of suggestions. I've also seen some problems with the current calculator setup. I made User:Quarenon/Scripts/DynamicForms as a working draft quite a while back trying to come up with a new system that would be more flexible; I've also just posted the code that went with it here, but it will need to be rewritten. There are also some good suggestions posted to my talk page courtesy of Gaz. Now that there is widespread discussion about improving calculators, I'm highly interested in trying to put out a much improved script to bring the wiki on par with the other sites with calculators.
The page above introduces some concepts that align with your suggestions, such as flexible form layouts by using HTML tags instead of a <pre> section. I also want to integrate other things like being able to show/hide form fields, or at least be able to disable them, based on the values of other fields.
I love your idea of putting the calculations on the client-side. I think for many cases this can boost the speed of things, and since you use an expression parser, people can't inject arbitrary JavaScript with the calculator. I think being able to call a server-side wiki template would still be useful but using primarily client-side expressions would be wonderful. What is the state of your expression parser? Do you plan to work on a version with infix syntax? I would definitely be willing to integrate something like that into the next calculator version, even though I would like to see it work with traditional syntax so it will be more familiar to calculator writers before we deploy it. --Quarenon 05:39, March 5, 2011 (UTC)
I have made a working calculate function in Flash AS3, which uses almost the same syntax as JavaScript, which i may be able to translate to JavaScript, if you are interested.
You only input a string to the function ("4*sqrt(5+4)^3"), which it then calculates and output a number or an error (108). Prayer-icon.pngTyiloTalkQuest.png 09:48, March 5, 2011 (UTC)
Translated it somewhat, don't expect everything to work: User:Tyilo/calc.js Prayer-icon.pngTyiloTalkQuest.png 12:34, March 5, 2011 (UTC)
Test it here: User:Tyilo/Calculator Prayer-icon.pngTyiloTalkQuest.png 20:49, March 5, 2011 (UTC)

Thanks Tyilo, if you don't mind I'll take your code and modify a little to replace my expression parser, so that it handles infix notation. Regarding hiding elements and calling wiki templates, what do you think of adding two more statements to the expression parser (ie in addition to "if" and "let"):

show(variablename,expr)

which shows or hides any elements tied to variablename, depending on the value of expr, and

get(variablename,templatename,variable1,variable2,...)

which sends variable1, variable2 etc to templatename, and puts the result in variablename? Stewbasic 15:22, March 6, 2011 (UTC)

You're free to use the code.
About the other two functions:
*show: I like the idea, but would it update automatically or should you call show every time "expr" changes?
*get: Would it be halt the code until it have got the result back from the template?
I was thinking the showing/hiding would happen when the function was called. Currently it's possible to call some code whenever an input is updated. So, for example, when a user selects a radio button this might trigger some elements to be shown or hidden depending on their choice.
Good point about get. I guess it would have to halt, since presumably the reset of the code might depend on the result. Stewbasic 01:37, March 7, 2011 (UTC)
Wouldn't that take longer time than the "script executing limit"-thingy?
If you don't know what i'm talking about, try using the JS Calc extension to embed another JS Calc depending on the result. (Choices: "Ancient", "Lunar", "Normal". If user chooses "Ancient", the result will show another choice-box: "Ice", "Blood", "Smoke"...). Example: User:Tyilo/Calculators/Max_magic Prayer-icon.pngTyiloTalkQuest.png 18:12, March 14, 2011 (UTC)
I couldn't get that to work, I know the default script won't display any forms that are loaded within the template of another form, unless I'm missing something. Also, the loading of templates asynchronously should not trigger the execution time limit of the browser, there could be a time-out but that is configurable.
Also, is there any game plan/schedule for getting this worked on? I could try to work on the expression parsing if need be and get things ready so we can transition to this new calculator script ASAP. --Quarenon  Talk 04:15, March 31, 2011 (UTC)
I'll try to implement the expression parser and show and get this weekend. Stewbasic 00:57, April 1, 2011 (UTC)
Infix notation and show function added (also I took the recursion out of the statement parser). Stewbasic 00:15, April 7, 2011 (UTC)
OK, I guess "this weekend" was a bit optimistic... Anyway get is now done also. The parsing and statement evaluation are pretty complete now, but the input elements aren't nearly as fancy as those in [[MediaWiki:Common.js/calc.js]] or Quarenon's new version. I'm not sure the best way to put it all together. Stewbasic 17:02, May 16, 2011 (UTC)

Hiscore implementation

I have implemented the hiscore function here using the ParseHiscoreData function: Calculators/Combat_level

Should it be implemented to more calculators or should i remove it? Prayer-icon.pngTyiloTalkQuest.png 19:50, March 14, 2011 (UTC)

Client side calculators proposal

The script for client-side calculators, demonstrated here, is now complete enough to be usable. I'd like to get feedback on the following:

  • Could the syntax be made more convenient?
  • In particular, are named arguments preferred or a fixed argument order?
  • Could it deal better with garbage input from the calculator writer or user? More importantly, is there any way to abuse it?

Once this feedback is addressed, I propose that it be added to [[MediaWiki:Common.js]] so that new calculators can use it, and old calculators can be converted to it where appropriate. There are more features that could be added, but this will surely always be true, and I think there's enough there now to start using it.

I'd also appreciate feedback on future features, in particular on the following points.

  • I haven't added the autocomplete feature of the "article" field type in the current calculators. Although I imagine autocomplete would be very useful sometimes, I'm not convinced that the options to choose from should always be the names of articles. Are there any calculators that use this feature? Maybe a custom list could be made for a particular input?
  • Some sort of looping/iteration/calling subroutines would make some calculators a lot less clunky (eg having an array of the xp of each rune/bar/log and iterating over it). However it should not be powerful enough to allow abuse. Maybe something as simple as an absolute limit on the number of commands that can run in response to a single user input?
  • Any suggestions in addition to those I've listed?

Stewbasic 02:55, October 16, 2011 (UTC)

Best idea ever! I would like to be able to use switch, for (while?) and arrays. I personally prefer named arguments.
Hiscore look-up via ajax would also be extremely useful. With this a shortcut to a dropdown of a list of skills would also be nice, instead of including
<div class="jcInput">name=skill|type=select|range=Agility,Attack,...,Woodcutting</div>
everytime. Prayer-icon.pngTyiloTalkQuest.png 13:07, October 16, 2011 (UTC)
Unfortunately I don't think ajax can get the high scores from Jagex because of this, so we'll have to fix User:Catcrewser/RSHighscores first. We could certainly make a template for that skill select field :). Assuming for loops and some sort of array initialisation were added, would the array-like behaviour demonstrated in this example be sufficient? Stewbasic 16:31, October 16, 2011 (UTC)
I don't like the syntax as it isn't arrays. It would also be impossible to get the length of an array using that. Prayer-icon.pngTyiloTalkQuest.png 17:08, October 16, 2011 (UTC)
Ignore what i said about same origin policy. Prayer-icon.pngTyiloTalkQuest.png 17:09, October 16, 2011 (UTC)
That's true. What would you want from arrays? Length, push, pop and foreach? Stewbasic 17:46, October 16, 2011 (UTC)
Foreach can be achieved with for + length, and I don't how you would use pop and push in calculators, so I suggest you just start with adding length Lol Prayer-icon.pngTyiloTalkQuest.png 19:11, October 16, 2011 (UTC)

How do I change the options (range) on a select input? Prayer-icon.pngTyiloTalkQuest.png 12:35, October 21, 2011 (UTC)

And wouldn't it be nice to be able to disable an element (radio, check, select, option inside select, button, ...) instead of hiding it? Prayer-icon.pngTyiloTalkQuest.png 12:42, October 21, 2011 (UTC)
Ah, I see why you ask from here. You can kind of get around it using show (see here), but I admit it's not ideal. Do you think setting the entire range at once would be most convenient? eg
letrange(type,"Cracked,Fragile,Normal,Strong")
Either setting the entire range or using an array Wink Prayer-icon.pngTyiloTalkQuest.png 20:26, October 23, 2011 (UTC)
Good point about disabling as well. btw I see you had a go at getting ajax to query runescape.com; did you have any success? In any case I'd prefer to get some use out of the current features before adding new ones, since there are plenty of calculators that could be written with what's there now. Stewbasic 16:54, October 21, 2011 (UTC)
I could it get to work with some hack, which basically includes a site in a script tag, which calls a function. Test it here User:Tyilo/Hiscore_test. It is also currently using my server, but whatever. Prayer-icon.pngTyiloTalkQuest.png 20:26, October 23, 2011 (UTC)
I have now updated the "hack" so it should be faster and give more error message. Prayer-icon.pngTyiloTalkQuest.png 21:30, November 2, 2011 (UTC)

Another new feature would be to implement functions. So you can reuse code, so it should both have (between 0 and Infinite) inputs and (none or one) output. The functions should both accept arrays and strings etc. as inputs and output. This would be just pure awesomeness. Prayer-icon.pngTyiloTalkQuest.png 21:30, November 2, 2011 (UTC)