r/TagPro • Flail ~ ((Antagloble4edes)) ~ RHCP? • May 20 '15

[Userscript] Time on Ball

This is a simple script intended to help with focus while playing. Basically, it shows you the last two digits of the time on your ball, with the intention of making powerup callouts a bit easier.

In action: http://i.imgur.com/qsOkd1W.png

Here's the script: http://pastebin.com/GjFy1p5b

I used ballparts' excellent afk timer script as a basis for this. If anyone has insight and can figure out how to programmatically center the text on the ball, I'm really interested. I just guess-and-checked until it lined up, but I'm sure there's a more graceful solution.

Hope this script helps!

Edit: Fixed pastebin link

Edit: Approved by Ash and asdf for competitive play!

Edit: Better version with spin and centeredness courtesy of /u/DatBlizzard and /u/snaps_

18 Upvotes

25 comments sorted by

2

u/[deleted] May 20 '15

now... make the numbers rotate! awesome script btw!

2

u/robopuppycc Flail ~ ((Antagloble4edes)) ~ RHCP? May 20 '15

Done (see edit).

1

u/[deleted] May 20 '15

Awesome! Can't wait to get home test it out!

2

u/snaps_ snaps||radius May 20 '15

Here is a version that adds rotation and the information that Some Ball -1 mentioned below to center the text a little more accurately.

1

u/robopuppycc Flail ~ ((Antagloble4edes)) ~ RHCP? May 20 '15

This looks more robust and sane, but it's not working for me. What can I provide to help debug?

1

u/snaps_ snaps||radius May 20 '15

Any errors popping up in the JS console?

1

u/robopuppycc Flail ~ ((Antagloble4edes)) ~ RHCP? May 20 '15

Nope. Some Ball -1 had some ideas here.

It also looks like transparency isn't working. It doesn't look like Pixi's text object has support for that.

Also rotation is a little wonky (it's rotating around the top left point of the bounding rectangle).

I'm heading to bed, so any fixing from me will have to wait until tomorrow, but feel free to get together with /u/DatBlizzard to investigate.

→ More replies (1)

1

u/DatBlizzard Some Ball -1 May 20 '15 edited May 20 '15

On lines 92 and 93 he used .textWidth and .textHeight which don't actually exist. I think he meant .width and .height except I still don't quite understand why that would make sense either because he set the anchor point to 0.5.

So to fix, either change .textWidth and .textHeight to .width and .height, respectively, and comment out or remove line 70 to remove the anchoring.
Or, remove lines 92 and 93 and add the following right below line 70: text.x = text.y = 20;, which leaves the anchoring intact and positions the text in the center of the ball.

Edit: This should do the trick: http://pastebin.com/f9wrEaNT.

→ More replies (2)

6

u/DatBlizzard Some Ball -1 May 20 '15

If you add the timerText to the player's sprite instead of the ui layer then you can center the text by setting it's position to (20,20) and set timerText.anchor.x = timerText.anchor.y = 0.5 which means the position is based on the center of the PIXI object instead of its default top-left corner.

Check out one of those ball spin overlay scripts to see what I mean, they do exactly that.

1

u/mmartinutk Macho | JuicyJuke May 20 '15

Oh man... at first glance I thought this was a script that had how long you've held the flag on your ball, and now I want that script.

Someone make it pls.

10

u/robopuppycc Flail ~ ((Antagloble4edes)) ~ RHCP? May 20 '15

Just limit yourself to grabbing at x:00 and you should be fine.

1

u/mmartinutk Macho | JuicyJuke May 20 '15

My god... it's brilliant.

1

u/[deleted] Oct 16 '15

Is there a script with updated centerness but without the spin? I was using the first version of the script until now but the lack of centerdness is annoying

1

u/robopuppycc Flail ~ ((Antagloble4edes)) ~ RHCP? Oct 16 '15

Have you tried changing the ROTATE variable to false?

1

u/[deleted] Oct 16 '15

how exactly would I set the variable to false?

1

u/robopuppycc Flail ~ ((Antagloble4edes)) ~ RHCP? Oct 16 '15

Change the 'true' to 'false' on line 25

→ More replies (1)

1

u/[deleted] Oct 16 '15

Na I haven't, I'll try that now. I know nothing about scripts so I didn't know what value to change

1

u/Reaxram | Reaxram | $ Ex member of Moneyballs $ May 20 '15 edited May 20 '15

I'm still new to javascript but I think to center the text you'd have to make this change:

var TEXTLOCATION_HOR = 0.0;

var TEXTLOCATION_VER = 0.0;

1

u/QuantumJuker I love curry. | Centra May 20 '15

Darn I have the flair on my ball.

1

u/18skeltor anti-timer luddite / First / Origin May 20 '15

Didn't know I needed this. Seems very helpful for me pup%!

1

u/sizviolin Fairy // B€ May 20 '15

For some reason it turns itself off every few games, only to be working again the next one usually. Any idea why that might be? Another userscript interfering with it maybe?