inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Jun 27, 2014 5:17:57 GMT -8
In the settings in the plugin its set however to be Random not Static
|
|
inherit
162752
0
Nov 7, 2024 3:58:23 GMT -8
Pebble
Where it all does or doesn't happen!
1,437
January 2011
pebbleleague
|
Post by Pebble on Jun 27, 2014 5:19:31 GMT -8
Perhaps a screen shot of the user tabs from the build section would help diagnose it.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Jun 27, 2014 5:22:09 GMT -8
Nevermind, I'm not sure when it happened but somehow the one for Random got changed to static. I'll see that first see if that fixes it (I'm honestly not even sure how!)
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Jun 27, 2014 8:52:23 GMT -8
Yeah, probably something simple you have overlooked, because I ran this in the console, and it's fine... var otmplace = pb.plugin.get('placeable_otm');
if(otmplace.settings.random_or_static === "random"){ var ran = (Math.random() * otmplace.settings.otms.length) | 0;
console.log("Random: " + ran); } else { console.log("static"); } +1 Nice example Peter Bitwise OR appears to be one of the fastest truncation methods with bit shifting sometimes beating or tying it on the more popular platforms. [ source] I recall reading a few articles about it years ago and have seen the method used much more frequently in recent years (e.g. jquery source) but never saw stats to back up the rise in popularity until now.
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Jun 27, 2014 9:26:56 GMT -8
Chris, Am pleased you spotted it, I didn't think anyone would notice (I don't think many here do much with the bitwise operators probably). I haven't used it much in plugins, usually for mess around projects, otherwise people find it hard to read the code when it's heavy of bitwise (I know I do sometimes). I actually noticed that negation and shifting is quicker in this test (sometimes shifting is quickest)... jsperf.com/math-floor-vs-math-round-vs-parseint/118console.log(~~ Math.PI) // 3 console.log(Math.PI >> 0) // 3 Firefox / Chrome Consistently, it seems a double NOT is the better option, as it's faster that ORing. Either way, bitwise it a lot faster from the tests.
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Jun 27, 2014 10:56:59 GMT -8
Unless Im running it in a giant loop, I stick with parseInt because I just like typing it. if you run it once, we are talking millionths/billionths of a second difference.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Jun 27, 2014 18:24:46 GMT -8
True Wormo , and as Peter pointed out, readability is important too and the billionth of a second one saves means one could potentially lose a couple hours hunting down a bug because the intent of the line was not clear. It brings to mind an adage my grandmother is frequently found saying: "penny wise and dollar foolish".
|
|