Author Topic: points to member of league -- *Solved*  (Read 2289 times)

Jjoiker

  • Newbie
  • *
  • Posts: 9
    • View Profile
points to member of league -- *Solved*
« on: January 05, 2009, 08:02:39 PM »
I use formula(points * number of players, rank1=10, rank2=8, rank3=6, rank4=6..... )
assign("rank", switch(r, 1, 10, 2, 8, 3, 6, 4, 5, 5, 4, 6, 3, 7, 2, 8, 1))
rank*n

But i want that only members of a league get points!

Is there any way to do that?
« Last Edit: January 09, 2009, 09:51:49 AM by Jjoiker »

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5540
    • View Profile
Re: points to member of league
« Reply #1 on: January 06, 2009, 11:17:13 AM »
Check the "inLeague" variable.  1 means the player is in the league selected on the Game tab, 0 means the player is not.

By the way, in your formula, you are assigning a value to the "rank" variable.  Just so you know, this variable already has a value (it is the same as "r").  This isn't a problem, really, because you're just overwriting the value it has.

If your formula is:

assign("rank", switch(r, 1, 10, 2, 8, 3, 6, 4, 5, 5, 4, 6, 3, 7, 2, 8, 1))
rank*n



It could be rewritten as:

switch(r, 1, 10, 2, 8, 3, 6, 4, 5, 5, 4, 6, 3, 7, 2, 8, 1) * n


And using the "inLeague" variable:

if(inLeague, switch(r, 1, 10, 2, 8, 3, 6, 4, 5, 5, 4, 6, 3, 7, 2, 8, 1) * n, 0)


Jjoiker

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: points to member of league
« Reply #2 on: January 06, 2009, 11:53:23 AM »
i didn't get that to work, OK lets say, name of the league is AOE, I want to top 8 get points if they is member of the league, and i want to that every member gets 5 points for buyin in a tournament.

if i use the box for points for buyin every player gets that points, i want just members gets points.

Jjoiker

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: points to member of league
« Reply #3 on: January 06, 2009, 12:06:12 PM »
i used the following formula:
assign("rank", switch(r, 1, 10, 2, 8, 3, 6, 4, 5, 5, 4, 6, 3, 7, 2, 8, 1))
5 + rank*n
 Now i just want the points tho members of the League(AOE)
 I tried

assign("rank", switch(r, 1, 10, 2, 8, 3, 6, 4, 5, 5, 4, 6, 3, 7, 2, 8, 1))
if(inLeague(5 + rank*n)1)

That didn't work!!!!!!!!!!

Jjoiker

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: points to member of league
« Reply #4 on: January 06, 2009, 12:42:30 PM »
Where can i find a complete list of exixting variable? Couldn't find anything about rank or inLeague in the docs.html.

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5540
    • View Profile
Re: points to member of league
« Reply #5 on: January 07, 2009, 10:11:33 AM »
If you use the various inputs to award points (Points for buy-in, Points for rebuying, Points for hit, etc), they will be awarded to all players, regardless of league status.  You'll need to use the Points for Playing formula to determine league status and add points for those achievements into the formula.

The variables are listed and described on the Points for Playing "Test Formula" dialog and in the user manual, in the "Formulas" section (section 32 of the latest version).

assign("rank", switch(r, 1, 10, 2, 8, 3, 6, 4, 5, 5, 4, 6, 3, 7, 2, 8, 1))
if(inLeague(5 + rank*n)1)


This won't work because the second line is not a valid expression.  Try this:

assign("rank", switch(r, 1, 10, 2, 8, 3, 6, 4, 5, 5, 4, 6, 3, 7, 2, 8, 1))
if(inLeague, (5 + rank*n), 1)


That gives the results of the "5 + rank * n" to league members, and 1 to non-league members.

Jjoiker

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: points to member of league
« Reply #6 on: January 07, 2009, 01:40:00 PM »
If i use :
assign("rank", switch(r, 1, 10, 2, 8, 3, 6, 4, 5, 5, 4, 6, 3, 7, 2, 8, 1))
if(inLeague, (5 + rank*n), 0)
Everyone gets 0, if(inLeague, (0), 5 + rank*n), everyone gets points.
I use the League box in the gametab.
when i test to filter the leagues in statstab everything works fine. but every gets Points in the tournament.

Can it be something wrong in my TD install...
I dont get the inLeague-variable to work.

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5540
    • View Profile
Re: points to member of league
« Reply #7 on: January 07, 2009, 03:06:08 PM »
Are the players part of the league selected on the Game tab? 

Jjoiker

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: points to member of league
« Reply #8 on: January 07, 2009, 11:18:24 PM »
*********************************************************************************
***************************   S o l v e d  *******************************************
*********************************************************************************

Ok, thank you Corey Cooper. The code works excellent.
The trouble was the database, i created it in TD 2.3, back up, restored it to 2.4, backup, restored it to 2.5.
The new variables didn't work.
when i used export from v. 2.4 and imported it to 2.5...... it works.......... ;D
So import/export from old version to new version. Backup is for computer meltdown!!!!!!!!!!!

**************************
Like always, if something doesn't work "Back To Basic" and "Keep It Simple Stupid"..
Works always in computers, Cars, Girlfriends, family, AND POKER !!!!!!!!!!!  ::)
**************************

Thank you everyone
Jjoiker - http://acesovereights.se/ - http://www.nationaldagsbomben.se/ . (Swedish)
« Last Edit: January 09, 2009, 09:48:38 AM by Jjoiker »