# Template talk:Goal

This talk page is for discussing the Template:Goal page.
2%
 60 99
39 levels

This is an intresting template. :) --Whiplash 14:55, 26 April 2007 (UTC)

55%
 69 75
6 levels

100%
 99
0 levels

## Testing

The examples show that the template is not yet robust enough. Parameter checking always is a bit tricky. A further point of attention is the spacing between tables. The current format is somewhat arbitrary and might benefit from some constructive feedback. It seems of sufficient use to move it into the wiki proper. --Miw 15:49, 26 April 2007 (UTC)

I love it. Is there some way to do exp as opposed to level in a skill? Megalodon99 (Talk) score 15:56, 26 April 2007 (UTC)
The template now calculates the current amount of XP from the level. Inserting an if statement to check for the existence of a parameter, makes it possible to add this option. Could you give an example of a possible template call and how you think it should look? --Miw 16:11, 26 April 2007 (UTC)

Hi Miw, I love the template. I've just started using external image links to get the same effect, but with a little more work I could use these instead. I'm happy to make the changes, if you don't mind. The changes I was thinking of are:

• Make new template {{Skill clickpic|skill}} (which may be used in other templates too), and use this in the Goal template (reduces the first half of the template content to couple of lines).
• Allow XP to be given (using levels-only will always give a jump from 91% to 100% at the end) - can use template with {{Goal|Skill=Mining|Goal=85|XP=901256}} as an alternative to {{Goal|Skill=Mining|Goal=85|Level=72}}. Just need to use {{{XP|{{XP|{{{Level}}}}}}}} in place of {{XP|{{{Level}}}}}. The display of the current level in the bar would probably be replaced by {{{Level|&nbsp;}}}. This would mean that if a level was given (as well as the XP), then it is shown in the bar.
• Handle when goal already reached or exceeded by not displaying blue bar, and display 100% and "Achieved" in the last columns.
• Handle case where current level is less than 1% (maybe forcing to be min 1px on the bar, just so it displays ok), because currently width of 0px is ignored by IE7 (and maybe other browsers), resulting in a 50% / 50% bar split. For example:
0%
 30 85
55 levels

As I said, I'm happy to make the changes, or leave them for you to do. Whichever you prefer. Amaurice talk 17:41, 26 April 2007 (UTC)

Also just noticed, the template would be better if it had at least a blank line (if nothing else) before the first {|, because if someone includes in another table like:

{| cellpadding="0" cellspacing="0" border="0" align="center"
|-
|{{Goal|Skill=Mining|Goal=85|Level=72}}
|-
|{{Goal|Skill=Smithing|Goal=85|Level=70}}
|}


Then the formatting of the tables messes up because it does not recognise the {| in the template as at the start of a line (because once it's been substituted, it is not at the start of a line). Try it and you will see what I mean.

Btw, I'm keen to fix these so I can use it, but will hang off in case you want to do it (after all, it is your creation :) Amaurice talk 18:11, 26 April 2007 (UTC)

Great feedback. Please feel free to make those changes, that is why i put it in the public wiki namespace. The templates are like normal programming but without variables they can be a bit of a pain to code. My table formatting skills are not good enough to make this template really shine. Some your userpage and figured one could do something similar with the wiki. Nice to have some support! --Miw 20:44, 26 April 2007 (UTC)
Ok, I've made most of the changes. The only one left is the case of specifying the XP instead of (or as well as) the Level. Given that the template is using the function {{XP|level}} is can look a bit complicated if the parameter is also {{{XP}}}. So we end up with {{{XP|{{XP|{{{Level}}}}}}}}. I might make the parameter Xp instead, so it's easier to tell parameter from function. I'll start on that now. Amaurice talk 21:14, 26 April 2007 (UTC)
Nice changes. I couldn't have done them. And the starting line bug is great, because i have that table issue with the combat template as well. So i guess that has the same problem. As for this template, is it possible to fail nicely when the target XP ends up being lower than the current XP? E.g. you can take the max from the two XP values and the min at the appropriate places. --Miw 21:28, 26 April 2007 (UTC)
I've already changed it so that if the target XP is lower than the current XP, then it shows as "100%" and "Achieved". I've also made the bar show the "Goal" level instead of the current level when the goal has been achieved. I think I've made all the changes, just needs a bit more adding to the usage, but I need to go out for about 15 mins, so will look at when I get back. Amaurice talk 21:39, 26 April 2007 (UTC)
The second example misses the level in the bar. This probably requires the reverse of the XP template. Looks like a 100 or so if statements to do that reverse look-up. --Miw 22:07, 26 April 2007 (UTC)
I think your right. I can't think of a better way of doing it. If I can't think of anything better soon I'll create another template to do the reverse lookup (if there isn't already one) and change Goal to call it. Amaurice talk 22:29, 26 April 2007 (UTC)
The reverse could be some strange log function on the Xp, but that is probably just a difficult. --Miw 22:47, 26 April 2007 (UTC)
The reverse is not quite a log function. It looks like the easiest is going to be to create the list of #ifexpr cases. I'll start putting it together and will probably call the reverse template "XP to Level". I will then add the call to it from the Goals page. Amaurice talk 22:53, 26 April 2007 (UTC)

## New formula

I am working on a reverse formula to cut down on include space. So far I have only managed to simplify the original formula somewhat. Here is what I have (where L is the level):
Experience required ${\displaystyle =\left\lfloor \displaystyle {\frac {L^{2}-L}{8}}+{\frac {\sum _{n=1}^{L-1}\left\lfloor 75\times 2^{8-n}\right\rfloor }{4}}\right\rfloor }$
This is exactly the same formula as is shown in the article on Experience, but expanded somewhat. I'm a regular user and I approve this message.  TLUL Talk - Contribs 19:48, 24 June 2009 (UTC)

I think the formula should be with ${\displaystyle 2^{\frac {n}{7}}}$ rather than ${\displaystyle 2^{8-n}}$. It would be good to get a reverse foumula if possible. I did try seeing if using variables helped by assigning the parameter to a variable at the start of "XP to Level", and then using the variable in the expression, but I'm not sure it helped much. Amaurice talk 12:11, 25 June 2009 (UTC)
Yes, I was thinking about it, and I realized my mistake there. You are correct. I had tried to find a way to expand ${\displaystyle a^{b/c}}$ and came up with ${\displaystyle {\frac {a^{c}}{a^{b+1}}}}$, which, when used in this equation, does eventually expand into this. As it turns out, I got b and c mixed up. On top of that, I just happened to pick several tests that did work with that, but not everything does. So here is what I have:
Where x is experience required and L is level
${\displaystyle x=\left\lfloor {\frac {1}{4}}\sum _{n=1}^{L-1}\left\lfloor n+300\times 2^{n/7}\right\rfloor \right\rfloor }$

${\displaystyle x=\left\lfloor {\frac {L^{2}-L}{8}}+{\frac {\sum _{n=1}^{L-1}\left\lfloor 300\times 2^{n/7}\right\rfloor }{4}}\right\rfloor }$

${\displaystyle x=\left\lfloor {\frac {L^{2}-L}{8}}+75\sum _{n=1}^{L-1}2^{n/7}\right\rfloor }$ I'm a regular user and I approve this message.  TLUL Talk - Contribs 22:19, 25 June 2009 (UTC) (edited 00:03, 26 June 2009 (UTC), 20:35, 18 July 2009 (UTC))

By using Javascript to create a table of the level for every 10000 experience, then using OpenOffice.org Calc's logarithmic regression feature, I was able to find a reverse formula: ${\displaystyle L=10.09\times ln(x)-66.85}$ is the reverse formula (${\displaystyle R^{2}=1}$). With the same method in Microsoft Excel the formula is given as ${\displaystyle L=10.092\times ln(x)-66.845}$ (${\displaystyle R^{2}=0.9992}$). If wikicode has a logarithmic function, I expect that this would be fairly easy to implement, and would save quite a bit of include space. To test where x is 13034431 (L should be equal to 99): 98. This obviously isn't perfect, so I will work on a program to allow me to tweak it until it works, and then I will post the closest match here. I'm a regular user and I approve this message.  TLUL Talk - Contribs 20:40, September 22, 2009 (UTC)

Well, I actually have managed to solve some of it mathematically. Here's what I've got so far:
Where x is experience required and L is level
${\displaystyle x=\left\lfloor {\frac {1}{4}}\sum _{k=1}^{L-1}\left\lfloor k+300\times 2^{k/7}\right\rfloor \right\rfloor }$

${\displaystyle x=\left\lfloor {\frac {L^{2}-L}{8}}+{\frac {\sum _{k=1}^{L-1}\left\lfloor 300\times 2^{k/7}\right\rfloor }{4}}\right\rfloor }$
This will very slightly overestimate because we are messing with the rounding.
${\displaystyle x=\left\lfloor {\frac {L^{2}-L}{8}}+75\sum _{k=1}^{L-1}2^{k/7}\right\rfloor }$
Now here comes the part that's a bit trickier. The following statement has been mathematically proven:
${\displaystyle \sum _{k=m}^{n}ar^{k}={\frac {a(r^{n+1}-r^{m})}{r-1}}}$
Comparing with the summation in the above formula, we see ${\displaystyle a=1,r=2^{1/7},n=L-1,m=1}$. Substituting these values into the formula yields:
${\displaystyle \sum _{k=1}^{L-1}2^{k/7}={\frac {1(2^{\frac {L-1+1}{7}}-2^{1/7})}{2^{1/7}-1}}}$
We can then substitute this into the equation for xp, removing summations entirely.
${\displaystyle x=\left\lfloor {\frac {L^{2}-L}{8}}+{\frac {75(2^{L/7}-2^{1/7})}{2^{1/7}-1}}\right\rfloor }$
Anybody who can work further with this, please feel free to. I'm a regular user and I approve this message.  TLUL Talk - Contribs 21:18, April 14, 2010 (UTC)

## include size

Attempted to split template and its documentation, so the documentation wont be included during a template. The description is quite clear, but following the description does not give the expected results. More study is required. --Miw 16:23, 22 May 2007 (UTC)

## Combat

I've noticed that a lot of people are using this as a goal for their combat levels, but this template would be inaccurate. Is there a way of letting people know that this won't work/making it impossible to use combat as a skill for this template?

00:06, 26 August 2008 (UTC)

## Current XP?

Is it possible to have a goal template linked to your hiscore so it is more accurate in terms of xp (or levels) left without regularly updating it? --King x treme 02:40, 12 March 2009 (UTC)

I don't know of a way to get it to get the data directly. The best I've managed to do is use the Template:ParseHiscoreData to make it easy updating all Goals and User Stats with a single edit. The Goals and User Stats can refer to the separate sub-page that you have that contains the "raw" highscore data (which you would copy from http://hiscore.runescape.com/index_lite.ws?player=King+X+Treme). In the Goal templates, you could also then use the "Xp" option instead of the "Lvl" option just as easily. I hope that helps. Amaurice talk 09:12, 12 March 2009 (UTC)
Sorry to say, but it didn't work out. Is it possible for you to help me on one so I can see your example?--King x treme 04:16, 18 March 2009 (UTC)
It sort of worked out, but after training a skill, it doesn't change. Is it possible for the goal to be somehow linked to the RS Hiscores so that it will update once you log out?--King x treme 00:41, 30 March 2009 (UTC)
Unfortunately, the Wikia does not currently allow processing of content from other sites, so I don't know of a way to do this automatically. Amaurice talk 12:09, 30 March 2009 (UTC)
A bot could be set up to do it. It's harder to do than items, though, since it needs to keep track of which Wikia account is which RuneScape username. In addition, it wouldn't work with players who don't make the Hiscores, so the bot would need to be able to handle "Not Ranked" (-1 in the index_lite) as well. Maybe the bot could work something like this: players register themselves with the bot somehow. The bot then, every night at midnight, looks up the registered players' RuneScape usernames on the Hiscores, and records the data to a sub-page of their userpage, such as User:Example/HiScoreData. HiScoreData would contain a template that returns various values similar to the way the Exchange template does, and the tables could be set up to use those values. It could be a bit of a challenge, but I'm sure its possible. I'm a regular user and I approve this message.  TLUL Talk - Contribs 18:22, 24 June 2009 (UTC)

## Expression error: Unrecognised punctuation character "["

Hello!

I am making a runescape wikia for Estonians with my friend and I am having a problem with the Goal template. I am getting a error:Expression error: Unrecognised punctuation character "[" inside the goal bar. You can look it yourself http://et.ruun.wikia.com/wiki/Mall:Goal .I am not sure what to do. So please help. Thank you.

## Simplicity

This template is rather difficult to work with due to all the un-needed text. as of right now, the template works like this:

{{Goal|Skill=Woodcutting|Goal=99|Level=1}}

when it would be much faster for it to work like this:

{{Goal|Woodcutting|99|1}}

The downside would be that this would create a lot of red-links in the Userspace, but I think that this would be in improvement in the long run. 03:33, January 3, 2010 (UTC)

## Start level

Could someone add a start level/start experience parameter? It would make it way better. -- 11:07, January 17, 2010 (UTC)

## Exp left is gone

The part that shows the experience left is gone. Why was it removed? Is there a way to turn it back on? Sixcorners (talk) 18:54, June 30, 2015 (UTC)

Hover over the bar. 23:23, June 30, 2015 (UTC)