Jump to content


Photo

Fantasy Survivor Script Update for 2017


22 replies to this topic

#1 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,703 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2017 MFL: 55681
  • , 18835

Posted 31 May 2017 - 09:53 AM

This script was included as an option in my report generator but since those scripts required the use of the habmanJSON_common file which I will be retiring this year I have created an independent version of this script.

 

Fantasy Survivor is a contest that will work for just about every league and requires no extra work for owners.

 

The basic premise is that the low scoring fantasy team gets eliminated every week until there is one survivor.

 

The one quirk is that if a team is the high scoring team in a given week then that team will have immunity from elimination the following week.  If the team that has immunity happens to be the low scoring team then then next lowest scoring team gets eliminated.  When there are only two teams remaining then immunity is not applicable for obvious reasons.

 

In my leagues we set aside prize money for the contest but you can do it for bragging rights.

 

I have been doing it for years in my leagues and the owners love it.  Many times I have had owners tell me that "oh well I lost this week but at least I didn't get eliminated from survivor".

 

The script requires the jQuery library which should be placed in a header home page message.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> 

 

Here is the survivor script which can be placed in a home page message.

 

<div id="survivorButtonContainer" class="form_buttons"></div>
<div id="survivorContainer" style="display:none"></div>

<script>
var survivor_useTriggerButton = true;
var survivor_hideMinimizeButton = false;
var survivor_includeHtmlCode = false;
var survivor_disableImmunity = false;

//FANTASY SCORE ADJUSTER - ENTER ("FID",WEEK#,SCORE ADJUSTMENT)
	var survivor_scoreAdjustment = new Array();
	//example 1 survivor_scoreAdjustment[0] = new Array("0005",5,-3);
	//example 2 survivor_scoreAdjustment[1] = new Array("0006",5,-1);

//SPECIAL ELIMINATION - ENTER ("FID",WEEK#,"REASON",true/false) true/false =>replaces regular elimination)
	var survivor_specialElimination = new Array();
	//example: survivor_specialElimination[0] = new Array("0004",3,"Team 4 failed to submit legal lineup therefore is eliminated",false);

//MULTIPLE ELIMINATION WEEKS
	//example below will eliminate three teams in weeks 1 & 2, two teams in week 3 then only one for all other weeks
	//var survivor_multipleEliminationWeeks = ({ "wk1":3 , "wk2":3 , "wk3":2 });
	
//START WEEK
	//set first week of elimination below.  The default is week 1.
	var survivor_startWeek = 1;
	
//SEPARATE DIVISIONS/CONFERENCES
	var survivor_separateDivisions = false;
	var survivor_separateConferences = false;
	var survivor_overallChampion = false;

//ALTERNATE NAME FOR GAME
	var survivor_alternateName = "";
</script>

<script src="//www.nitrografixx.com/MFL-Fantasy-Survivor/fantasy-survivor.js"></script>

 

 

There are options that adjust weekly scores for the survivor contest or for special eliminations but most leagues won't use them.  If you want to use them and you don't understand their implementation then please post and I can explain further.

 

 

================================================================================

EDITED July 11, 2017 to add var options: survivor_startWeek, survivor_useTriggerButton,  survivor_hideMinimizeButton, survivor_includeHtmlCode

 

All are self-explanatory except survivor_includeHtmlCode.  By setting this var to true the HTML to create the survivor table is generated to a textarea box.  You can copy this html code to another HPM then use that HPM to be placed on the home page.  This has to be done manually once per week but it will load fast as it is raw html.

 

================================================================================

EDITED July 7, 2018 to add var options: survivor_disableImmunity, survivor_separateDivisions,  survivor_separateConferences, survivor_overallChampion, survivor_alternateName

 

If you don't want to use immunity option then set survivor_disableImmunity to false.  For large leagues (19 or more teams) that have divisions and/or conferences you can now set winners for divisions and/or conferences then if desired have an overall champion.  Lastly if you don't like the name Fantasy Survivor then you can add your own contest name using the var provided example Last Man Standing


My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#2 fgbsrekcap

fgbsrekcap

    Veteran

  • Members
  • PipPipPip
  • 30 posts
  • Gender:Male
  • Location:Wisconsin

Posted 31 May 2017 - 10:26 AM

Thank You!!!!



#3 Andypro

Andypro

    Veteran

  • Members
  • PipPipPip
  • 173 posts
  • Gender:Male
  • Location:Central PA

Posted 08 June 2017 - 07:10 AM

Is there any way to add more variable?

 

Eliminate more than one team in a given week? Have more than one team get immunity? Bring a team back in? Separate by conference?

 

I tried the script on one of my 2016 leagues, and it popped right up and worked as expected. However, it would appear that it won't work for any league with more than 16 teams, which most of mine are.



#4 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,703 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2017 MFL: 55681
  • , 18835

Posted 08 June 2017 - 08:04 AM

Is there any way to add more variable?

 

Eliminate more than one team in a given week? Have more than one team get immunity? Bring a team back in? Separate by conference?

 

I tried the script on one of my 2016 leagues, and it popped right up and worked as expected. However, it would appear that it won't work for any league with more than 16 teams, which most of mine are.

 

There are already options to eliminate more than one team in a given week but it will have to be manually entered into the array vars provided.

 

For largers leagues I can try to create an new option that will automatically eliminate two teams a week for so many weeks than return to one team eliminations to fit into a 16 or 17 week NFL schedule,

 

Currenty the script does not support conferences where one team from each conference gets eliminated each week and the conference winners are paired for the final.  I might add this if I can find the time.

 

As far as giving more than one team immunity there is no option for that,  That being said if I do create the "conference" then multiple teams (one from each conference) will be given immunity.

 

Lastly there is not an option to bring a team back.  I can look into that but I am not sure if I can get that implemented.


My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#5 Andypro

Andypro

    Veteran

  • Members
  • PipPipPip
  • 173 posts
  • Gender:Male
  • Location:Central PA

Posted 08 June 2017 - 05:40 PM

Sadly, I fear I may be the only one interested in all the extra stuff, and thus not worth the trouble.

One of my leagues is actually called the Survivor Series, and the league champ is the Survivor champ. (we also have a regular league schedule, but the importance of the two is flipped around).

But right now I've got 42 teams, so we eliminate 3 for a while, and then 2, and we also give 2 teams immunity for awhile, and then it goes down to 1.

 

I had to do it by hand in Excel last year, and was hoping for a miracle cure.



#6 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,703 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2017 MFL: 55681
  • , 18835

Posted 12 June 2017 - 06:32 AM

I have added a new var for multiple team elimination for defined weeks and TOS has updated the js file to his site. You may need to do a ctrl f5 to clear your cache
My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#7 Andypro

Andypro

    Veteran

  • Members
  • PipPipPip
  • 173 posts
  • Gender:Male
  • Location:Central PA

Posted 13 June 2017 - 10:57 PM

Thank you Habman. I might be able to make this work for my league.

I'm going to take some time to back-test it for my league last year and see what I might need to adjust.

 

Thanks again.



#8 Kleve13

Kleve13

    Member

  • Members
  • PipPip
  • 15 posts

Posted 01 July 2017 - 09:03 PM

A couple questions...

1. Is there anyway to start the survivor league after week 1. Since we only have 10 teams, I was thinking it'd be nice to let the teams get established for a couple weeks before we begin.

2. Is there anyway to get it to load upon page load rather than clicking the button to open it?

 

This is really cool and our league is excited to try something new, so I appreciate this!

 

Thanks,
K13



#9 lurkmaster

lurkmaster

    Veteran

  • Members
  • PipPipPip
  • 106 posts
  • Gender:Male

Posted 01 July 2017 - 09:57 PM

Great job as always, guys.  Im looking forward to adding this in this season.  Thanks again!!!!



#10 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,703 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2017 MFL: 55681
  • , 18835

Posted 03 July 2017 - 08:19 AM

A couple questions...

1. Is there anyway to start the survivor league after week 1. Since we only have 10 teams, I was thinking it'd be nice to let the teams get established for a couple weeks before we begin.

2. Is there anyway to get it to load upon page load rather than clicking the button to open it?

 

This is really cool and our league is excited to try something new, so I appreciate this!

 

Thanks,
K13

 

1. I can try to add this.  I will get back to you.

2. I can add this but if you are going to put it on your home page as a regular module I would highly recommend to use the button click.  It loads fast now but as the season progresses it takes time as it has to hit each weekly results file depending on the current week. 


My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#11 Kleve13

Kleve13

    Member

  • Members
  • PipPip
  • 15 posts

Posted 05 July 2017 - 10:53 AM

Great. Thanks for the reply.  I hadn't thought about the load time in later weeks. If it's not too difficult, I would certainly appreciate it as it will go on a separate HPM that I'll link to that will contain all of the other Pools.  If it becomes an inconvenience for the league members, I can always go back to the button.



#12 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,703 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2017 MFL: 55681
  • , 18835

Posted 11 July 2017 - 02:25 PM

I have added a few options to the script.  See first post for updated code.

 

1. Option to have fantasy survivor start in a week other than the default of 1.  For example a 12 team leagues can start in week 3 and eliminating one team per week will have one final survivor in week 13.

 

2. Option to omit the trigger button to create the table.  Please note the page won't fully load until the script has completely run.  If you are loading this page separately from the home page then this might be a good option for you.  If you are using on the home page then this may not be what you want.  The script loads fast early in the season but as more and more weekly results files have to be read the script may take as long as 2 or 3 seconds to fully load.

 

3. Option to auto-hide minimize button after the table is created.

 

4. Option to have html code generated which can be copied to another home page message.  


My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#13 fgbsrekcap

fgbsrekcap

    Veteran

  • Members
  • PipPipPip
  • 30 posts
  • Gender:Male
  • Location:Wisconsin

Posted 12 September 2017 - 12:54 AM

Quick question we have this script loaded on our site and we are eliminating 2 teams week 1 and 2 teams week 2

 

I have the script loaded per OP and have changed this line to this

 

<div id="survivorButtonContainer" class="form_buttons"></div>
<div id="survivorContainer" style="display:none"></div>

<script>
var survivor_useTriggerButton = true;
var survivor_hideMinimizeButton = false;
var survivor_includeHtmlCode = false;

//FANTASY SCORE ADJUSTER - ENTER ("FID",WEEK#,SCORE ADJUSTMENT)
	var survivor_scoreAdjustment = new Array();
	//example 1 survivor_scoreAdjustment[0] = new Array("0005",5,-3);
	//example 2 survivor_scoreAdjustment[1] = new Array("0006",5,-1);

//SPECIAL ELIMINATION - ENTER ("FID",WEEK#,"REASON",true/false) true/false =>replaces regular elimination)
	var survivor_specialElimination = new Array();
	//example: survivor_specialElimination[0] = new Array("0004",3,"Team 4 failed to submit legal lineup therefore is eliminated",false);

//MULTIPLE ELIMINATION WEEKS
	//example below will eliminate three teams in weeks 1 & 2, two teams in week 3 then only one for all other weeks
	//var survivor_multipleEliminationWeeks = ({ "wk1":2 , "wk2":2});
	
//START WEEK
	//set first week of elimination below.  The default is week 1.
	var survivor_startWeek = 1;
</script>

only one team the team with the lowest score is in red to show that they are eliminated. Should it show both teams eliminated for week 1 in red?



#14 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,703 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2017 MFL: 55681
  • , 18835

Posted 12 September 2017 - 05:58 AM

Quick question we have this script loaded on our site and we are eliminating 2 teams week 1 and 2 teams week 2

 

I have the script loaded per OP and have changed this line to this

 

<div id="survivorButtonContainer" class="form_buttons"></div>
<div id="survivorContainer" style="display:none"></div>

<script>
var survivor_useTriggerButton = true;
var survivor_hideMinimizeButton = false;
var survivor_includeHtmlCode = false;

//FANTASY SCORE ADJUSTER - ENTER ("FID",WEEK#,SCORE ADJUSTMENT)
	var survivor_scoreAdjustment = new Array();
	//example 1 survivor_scoreAdjustment[0] = new Array("0005",5,-3);
	//example 2 survivor_scoreAdjustment[1] = new Array("0006",5,-1);

//SPECIAL ELIMINATION - ENTER ("FID",WEEK#,"REASON",true/false) true/false =>replaces regular elimination)
	var survivor_specialElimination = new Array();
	//example: survivor_specialElimination[0] = new Array("0004",3,"Team 4 failed to submit legal lineup therefore is eliminated",false);

//MULTIPLE ELIMINATION WEEKS
	//example below will eliminate three teams in weeks 1 & 2, two teams in week 3 then only one for all other weeks
	//var survivor_multipleEliminationWeeks = ({ "wk1":2 , "wk2":2});
	
//START WEEK
	//set first week of elimination below.  The default is week 1.
	var survivor_startWeek = 1;
</script>

only one team the team with the lowest score is in red to show that they are eliminated. Should it show both teams eliminated for week 1 in red?

You need to remove the // in front of var survivor_multipleEliminationWeeks = ({ "wk1":2 , "wk2":2});

 

Those double slashes are used for comments so anything that follows is ignored.


My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#15 fgbsrekcap

fgbsrekcap

    Veteran

  • Members
  • PipPipPip
  • 30 posts
  • Gender:Male
  • Location:Wisconsin

Posted 24 October 2017 - 11:45 AM

Out of curiosity when does immunity stop? Is it when there are 2 teams left? How is it handled by the script?



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users