It is currently December 13th, 2018, 2:32 pm

Convert Perl to Lua

Discuss the use of Lua in Script measures.
User avatar
Bananorpion
Posts: 40
Joined: April 16th, 2017, 8:35 pm

Convert Perl to Lua

Bananorpion » March 6th, 2018, 1:39 am

Hello,

for a skin I'm working on, I've designed a script to directly generate shapes for shape meters (With customized number of lines, gaps, scale, etc.). Now that I plan on sharing it, I met a problem: I used my usual scripting language, for this (Perl), and I forgot this was to be used by Windows users, who may not have Perl installed.
Two solutions from there: including a portable Perl interpretor (Even removing useless libraries, that's still HUGE), or convert it to Lua. Obviously, I don't know a thing about Lua. So, before I try and make a mess, I wonder if someone wants to give it a try, since this script could be useful to other people as well.

Below is an example of automatically-generated shape (To understand why I prefer not to design it manually everytime) :
VisualCircularA51=0,180 | LineTo 0,(max(1.53418684006867e-016 * 140 + 180,([MeasureAudioLevelSub00] * 2.64514972425634e-016 * 140 + 180))) | LineTo 7.2,(max(-0.0671260120484514 * 140 + 180,([MeasureAudioLevelSub01] * -0.115734503531813 * 140 + 180))) | LineTo 14.4,(max(-0.153954450544754 * 140 + 180,([MeasureAudioLevelSub02] * -0.265438707835782 * 140 + 180))) | LineTo 21.6,(max(-0.200360474227189 * 140 + 180,([MeasureAudioLevelSub03] * -0.345449093495153 * 140 + 180))) | LineTo 28.8,(max(-0.305575108551775 * 140 + 180,([MeasureAudioLevelSub04] * -0.526853635434095 * 140 + 180))) | LineTo 36,(max(-0.330557675852862 * 140 + 180,([MeasureAudioLevelSub05] * -0.569927027332522 * 140 + 180))) | LineTo 43.2,(max(-0.452563559399265 * 140 + 180,([MeasureAudioLevelSub06] * -0.780281998964251 * 140 + 180))) | LineTo 50.4,(max(-0.455743960064548 * 140 + 180,([MeasureAudioLevelSub07] * -0.785765448387152 * 140 + 180))) | LineTo 57.6,(max(-0.592691608004154 * 140 + 180,([MeasureAudioLevelSub08] * -1.02188208276578 * 140 + 180))) | LineTo 64.8,(max(-0.574021630401468 * 140 + 180,([MeasureAudioLevelSub09] * -0.989692466209428 * 140 + 180))) | LineTo 72,(max(-0.723835055988257 * 140 + 180,([MeasureAudioLevelSub10] * -1.24799147584182 * 140 + 180))) | LineTo 79.2,(max(-0.683597717946933 * 140 + 180,([MeasureAudioLevelSub11] * -1.17861675508092 * 140 + 180))) | LineTo 86.4,(max(-0.844005902360407 * 140 + 180,([MeasureAudioLevelSub12] * -1.45518259027656 * 140 + 180))) | LineTo 93.6,(max(-0.782811160909467 * 140 + 180,([MeasureAudioLevelSub13] * -1.34967441536115 * 140 + 180))) | LineTo 100.8,(max(-0.951382479585017 * 140 + 180,([MeasureAudioLevelSub14] * -1.64031461997417 * 140 + 180))) | LineTo 108,(max(-0.870157984626373 * 140 + 180,([MeasureAudioLevelSub15] * -1.50027238728685 * 140 + 180))) | LineTo 115.2,(max(-1.04433706820502 * 140 + 180,([MeasureAudioLevelSub16] * -1.80058115207762 * 140 + 180))) | LineTo 122.4,(max(-0.944314100286551 * 140 + 180,([MeasureAudioLevelSub17] * -1.62812775911474 * 140 + 180))) | LineTo 129.6,(max(-1.12146057140962 * 140 + 180,([MeasureAudioLevelSub18] * -1.93355270932694 * 140 + 180))) | LineTo 136.8,(max(-1.00415537676718 * 140 + 180,([MeasureAudioLevelSub19] * -1.73130237373651 * 140 + 180))) | LineTo 144,(max(-1.18158387550562 * 140 + 180,([MeasureAudioLevelSub20] * -2.03721357845796 * 140 + 180))) | LineTo 151.2,(max(-1.04877468131564 * 140 + 180,([MeasureAudioLevelSub21] * -1.8082322091649 * 140 + 180))) | LineTo 158.4,(max(-1.22379557248923 * 140 + 180,([MeasureAudioLevelSub22] * -2.10999236636074 * 140 + 180))) | LineTo 165.6,(max(-1.07749563075741 * 140 + 180,([MeasureAudioLevelSub23] * -1.85775108751277 * 140 + 180))) | LineTo 172.8,(max(-1.24745577606242 * 140 + 180,([MeasureAudioLevelSub24] * -2.15078582079727 * 140 + 180))) | LineTo 180,(max(-1.08988284477545 * 140 + 180,([MeasureAudioLevelSub25] * -1.87910835306113 * 140 + 180))) | LineTo 187.2,(max(-1.2522058216569 * 140 + 180,([MeasureAudioLevelSub26] * -2.15897555458087 * 140 + 180))) | LineTo 194.4,(max(-1.08574854583211 * 140 + 180,([MeasureAudioLevelSub27] * -1.87198025143466 * 140 + 180))) | LineTo 201.6,(max(-1.2379737034234 * 140 + 180,([MeasureAudioLevelSub28] * -2.13443741969552 * 140 + 180))) | LineTo 208.8,(max(-1.06515540568507 * 140 + 180,([MeasureAudioLevelSub29] * -1.83647483738805 * 140 + 180))) | LineTo 216,(max(-1.20497516576691 * 140 + 180,([MeasureAudioLevelSub30] * -2.07754338925329 * 140 + 180))) | LineTo 223.2,(max(-1.02841559534748 * 140 + 180,([MeasureAudioLevelSub31] * -1.773130336806 * 140 + 180))) | LineTo 230.4,(max(-1.15371043288144 * 140 + 180,([MeasureAudioLevelSub32] * -1.9891559187611 * 140 + 180))) | LineTo 237.6,(max(-0.97608605289356 * 140 + 180,([MeasureAudioLevelSub33] * -1.68290698774752 * 140 + 180))) | LineTo 244.8,(max(-1.08495662586114 * 140 + 180,([MeasureAudioLevelSub34] * -1.87061487217439 * 140 + 180))) | LineTo 252,(max(-0.908960040845109 * 140 + 180,([MeasureAudioLevelSub35] * -1.56717248421571 * 140 + 180))) | LineTo 259.2,(max(-0.999755982336684 * 140 + 180,([MeasureAudioLevelSub36] * -1.72371721092532 * 140 + 180))) | LineTo 266.4,(max(-0.828055121120292 * 140 + 180,([MeasureAudioLevelSub37] * -1.42768124331085 * 140 + 180))) | LineTo 273.6,(max(-0.899400057215132 * 140 + 180,([MeasureAudioLevelSub38] * -1.55068975381919 * 140 + 180))) | LineTo 280.8,(max(-0.734597729832207 * 140 + 180,([MeasureAudioLevelSub39] * -1.26654781005553 * 140 + 180))) | LineTo 288,(max(-0.785410144024137 * 140 + 180,([MeasureAudioLevelSub40] * -1.35415542073127 * 140 + 180))) | LineTo 295.2,(max(-0.630004585767557 * 140 + 180,([MeasureAudioLevelSub41] * -1.08621480304751 * 140 + 180))) | LineTo 302.4,(max(-0.659514213652751 * 140 + 180,([MeasureAudioLevelSub42] * -1.13709347181509 * 140 + 180))) | LineTo 309.6,(max(-0.515861214373986 * 140 + 180,([MeasureAudioLevelSub43] * -0.8894158868517 * 140 + 180))) | LineTo 316.8,(max(-0.523620720074163 * 140 + 180,([MeasureAudioLevelSub44] * -0.902794344955454 * 140 + 180))) | LineTo 324,(max(-0.393897912810472 * 140 + 180,([MeasureAudioLevelSub45] * -0.679134332431848 * 140 + 180))) | LineTo 331.2,(max(-0.37978967012882 * 140 + 180,([MeasureAudioLevelSub46] * -0.654809776084173 * 140 + 180))) | LineTo 338.4,(max(-0.265963520406175 * 140 + 180,([MeasureAudioLevelSub47] * -0.45855779380375 * 140 + 180))) | LineTo 345.6,(max(-0.2302013959206 * 140 + 180,([MeasureAudioLevelSub48] * -0.396898958483793 * 140 + 180))) | LineTo 352.8,(max(-0.133997392140804 * 140 + 180,([MeasureAudioLevelSub49] * -0.231029986449662 * 140 + 180))) | LineTo 360,(max(-0.0771235032046037 * 140 + 180,([MeasureAudioLevelSub50] * -0.132971557249317 * 140 + 180))) | LineTo 360,(min(0.0671260120484513 * 140 + 180,(-[MeasureAudioLevelSub50] * -0.115734503531813 * 140 + 180))) | LineTo 352.8,(min(0.153954450544754 * 140 + 180,(-[MeasureAudioLevelSub49] * -0.265438707835782 * 140 + 180))) | LineTo 345.6,(min(0.200360474227189 * 140 + 180,(-[MeasureAudioLevelSub48] * -0.345449093495153 * 140 + 180))) | LineTo 338.4,(min(0.305575108551775 * 140 + 180,(-[MeasureAudioLevelSub47] * -0.526853635434096 * 140 + 180))) | LineTo 331.2,(min(0.330557675852862 * 140 + 180,(-[MeasureAudioLevelSub46] * -0.569927027332521 * 140 + 180))) | LineTo 324,(min(0.452563559399265 * 140 + 180,(-[MeasureAudioLevelSub45] * -0.780281998964251 * 140 + 180))) | LineTo 316.8,(min(0.455743960064549 * 140 + 180,(-[MeasureAudioLevelSub44] * -0.785765448387154 * 140 + 180))) | LineTo 309.6,(min(0.592691608004154 * 140 + 180,(-[MeasureAudioLevelSub43] * -1.02188208276578 * 140 + 180))) | LineTo 302.4,(min(0.574021630401468 * 140 + 180,(-[MeasureAudioLevelSub42] * -0.989692466209428 * 140 + 180))) | LineTo 295.2,(min(0.723835055988257 * 140 + 180,(-[MeasureAudioLevelSub41] * -1.24799147584182 * 140 + 180))) | LineTo 288,(min(0.683597717946934 * 140 + 180,(-[MeasureAudioLevelSub40] * -1.17861675508092 * 140 + 180))) | LineTo 280.8,(min(0.844005902360408 * 140 + 180,(-[MeasureAudioLevelSub39] * -1.45518259027656 * 140 + 180))) | LineTo 273.6,(min(0.782811160909467 * 140 + 180,(-[MeasureAudioLevelSub38] * -1.34967441536115 * 140 + 180))) | LineTo 266.4,(min(0.951382479585017 * 140 + 180,(-[MeasureAudioLevelSub37] * -1.64031461997417 * 140 + 180))) | LineTo 259.2,(min(0.870157984626373 * 140 + 180,(-[MeasureAudioLevelSub36] * -1.50027238728685 * 140 + 180))) | LineTo 252,(min(1.04433706820502 * 140 + 180,(-[MeasureAudioLevelSub35] * -1.80058115207762 * 140 + 180))) | LineTo 244.8,(min(0.944314100286552 * 140 + 180,(-[MeasureAudioLevelSub34] * -1.62812775911474 * 140 + 180))) | LineTo 237.6,(min(1.12146057140962 * 140 + 180,(-[MeasureAudioLevelSub33] * -1.93355270932693 * 140 + 180))) | LineTo 230.4,(min(1.00415537676718 * 140 + 180,(-[MeasureAudioLevelSub32] * -1.73130237373651 * 140 + 180))) | LineTo 223.2,(min(1.18158387550562 * 140 + 180,(-[MeasureAudioLevelSub31] * -2.03721357845796 * 140 + 180))) | LineTo 216,(min(1.04877468131564 * 140 + 180,(-[MeasureAudioLevelSub30] * -1.8082322091649 * 140 + 180))) | LineTo 208.8,(min(1.22379557248923 * 140 + 180,(-[MeasureAudioLevelSub29] * -2.10999236636074 * 140 + 180))) | LineTo 201.6,(min(1.07749563075741 * 140 + 180,(-[MeasureAudioLevelSub28] * -1.85775108751277 * 140 + 180))) | LineTo 194.4,(min(1.24745577606242 * 140 + 180,(-[MeasureAudioLevelSub27] * -2.15078582079727 * 140 + 180))) | LineTo 187.2,(min(1.08988284477545 * 140 + 180,(-[MeasureAudioLevelSub26] * -1.87910835306113 * 140 + 180))) | LineTo 180,(min(1.2522058216569 * 140 + 180,(-[MeasureAudioLevelSub25] * -2.15897555458087 * 140 + 180))) | LineTo 172.8,(min(1.08574854583211 * 140 + 180,(-[MeasureAudioLevelSub24] * -1.87198025143466 * 140 + 180))) | LineTo 165.6,(min(1.2379737034234 * 140 + 180,(-[MeasureAudioLevelSub23] * -2.13443741969552 * 140 + 180))) | LineTo 158.4,(min(1.06515540568507 * 140 + 180,(-[MeasureAudioLevelSub22] * -1.83647483738805 * 140 + 180))) | LineTo 151.2,(min(1.20497516576691 * 140 + 180,(-[MeasureAudioLevelSub21] * -2.07754338925329 * 140 + 180))) | LineTo 144,(min(1.02841559534748 * 140 + 180,(-[MeasureAudioLevelSub20] * -1.773130336806 * 140 + 180))) | LineTo 136.8,(min(1.15371043288144 * 140 + 180,(-[MeasureAudioLevelSub19] * -1.9891559187611 * 140 + 180))) | LineTo 129.6,(min(0.97608605289356 * 140 + 180,(-[MeasureAudioLevelSub18] * -1.68290698774752 * 140 + 180))) | LineTo 122.4,(min(1.08495662586114 * 140 + 180,(-[MeasureAudioLevelSub17] * -1.87061487217439 * 140 + 180))) | LineTo 115.2,(min(0.908960040845108 * 140 + 180,(-[MeasureAudioLevelSub16] * -1.5671724842157 * 140 + 180))) | LineTo 108,(min(0.999755982336684 * 140 + 180,(-[MeasureAudioLevelSub15] * -1.72371721092532 * 140 + 180))) | LineTo 100.8,(min(0.828055121120293 * 140 + 180,(-[MeasureAudioLevelSub14] * -1.42768124331085 * 140 + 180))) | LineTo 93.6,(min(0.899400057215132 * 140 + 180,(-[MeasureAudioLevelSub13] * -1.55068975381919 * 140 + 180))) | LineTo 86.4,(min(0.734597729832206 * 140 + 180,(-[MeasureAudioLevelSub12] * -1.26654781005553 * 140 + 180))) | LineTo 79.2,(min(0.785410144024136 * 140 + 180,(-[MeasureAudioLevelSub11] * -1.35415542073127 * 140 + 180))) | LineTo 72,(min(0.630004585767557 * 140 + 180,(-[MeasureAudioLevelSub10] * -1.08621480304751 * 140 + 180))) | LineTo 64.8,(min(0.659514213652751 * 140 + 180,(-[MeasureAudioLevelSub09] * -1.13709347181509 * 140 + 180))) | LineTo 57.6,(min(0.515861214373986 * 140 + 180,(-[MeasureAudioLevelSub08] * -0.889415886851699 * 140 + 180))) | LineTo 50.4,(min(0.523620720074162 * 140 + 180,(-[MeasureAudioLevelSub07] * -0.902794344955451 * 140 + 180))) | LineTo 43.2,(min(0.393897912810472 * 140 + 180,(-[MeasureAudioLevelSub06] * -0.679134332431848 * 140 + 180))) | LineTo 36,(min(0.379789670128821 * 140 + 180,(-[MeasureAudioLevelSub05] * -0.654809776084174 * 140 + 180))) | LineTo 28.8,(min(0.265963520406174 * 140 + 180,(-[MeasureAudioLevelSub04] * -0.458557793803749 * 140 + 180))) | LineTo 21.6,(min(0.2302013959206 * 140 + 180,(-[MeasureAudioLevelSub03] * -0.396898958483792 * 140 + 180))) | LineTo 14.4,(min(0.133997392140804 * 140 + 180,(-[MeasureAudioLevelSub02] * -0.231029986449662 * 140 + 180))) | LineTo 7.2,(min(0.0771235032046038 * 140 + 180,(-[MeasureAudioLevelSub01] * -0.132971557249317 * 140 + 180))) | LineTo 0,(min(-1.33531076820792e-016 * 140 + 180,(-[MeasureAudioLevelSub00] * 2.30225994518607e-016 * 140 + 180))) | LineTo 0,(max(1.53418684006867e-016 * 140 + 180,([MeasureAudioLevelSub00] * 2.64514972425634e-016 * 140 + 180))) | LineTo 7.2,(max(-0.0671260120484514 * 140 + 180,([MeasureAudioLevelSub01] * -0.115734503531813 * 140 + 180))) | LineTo 14.4,(max(-0.153954450544754 * 140 + 180,([MeasureAudioLevelSub02] * -0.265438707835782 * 140 + 180))) | LineTo 21.6,(max(-0.200360474227189 * 140 + 180,([MeasureAudioLevelSub03] * -0.345449093495153 * 140 + 180))) | LineTo 28.8,(max(-0.305575108551775 * 140 + 180,([MeasureAudioLevelSub04] * -0.526853635434095 * 140 + 180))) | LineTo 36,(max(-0.330557675852862 * 140 + 180,([MeasureAudioLevelSub05] * -0.569927027332522 * 140 + 180))) | LineTo 43.2,(max(-0.452563559399265 * 140 + 180,([MeasureAudioLevelSub06] * -0.780281998964251 * 140 + 180))) | LineTo 50.4,(max(-0.455743960064548 * 140 + 180,([MeasureAudioLevelSub07] * -0.785765448387152 * 140 + 180))) | LineTo 57.6,(max(-0.592691608004154 * 140 + 180,([MeasureAudioLevelSub08] * -1.02188208276578 * 140 + 180))) | LineTo 64.8,(max(-0.574021630401468 * 140 + 180,([MeasureAudioLevelSub09] * -0.989692466209428 * 140 + 180))) | LineTo 72,(max(-0.723835055988257 * 140 + 180,([MeasureAudioLevelSub10] * -1.24799147584182 * 140 + 180))) | LineTo 79.2,(max(-0.683597717946933 * 140 + 180,([MeasureAudioLevelSub11] * -1.17861675508092 * 140 + 180))) | LineTo 86.4,(max(-0.844005902360407 * 140 + 180,([MeasureAudioLevelSub12] * -1.45518259027656 * 140 + 180))) | LineTo 93.6,(max(-0.782811160909467 * 140 + 180,([MeasureAudioLevelSub13] * -1.34967441536115 * 140 + 180))) | LineTo 100.8,(max(-0.951382479585017 * 140 + 180,([MeasureAudioLevelSub14] * -1.64031461997417 * 140 + 180))) | LineTo 108,(max(-0.870157984626373 * 140 + 180,([MeasureAudioLevelSub15] * -1.50027238728685 * 140 + 180))) | LineTo 115.2,(max(-1.04433706820502 * 140 + 180,([MeasureAudioLevelSub16] * -1.80058115207762 * 140 + 180))) | LineTo 122.4,(max(-0.944314100286551 * 140 + 180,([MeasureAudioLevelSub17] * -1.62812775911474 * 140 + 180))) | LineTo 129.6,(max(-1.12146057140962 * 140 + 180,([MeasureAudioLevelSub18] * -1.93355270932694 * 140 + 180))) | LineTo 136.8,(max(-1.00415537676718 * 140 + 180,([MeasureAudioLevelSub19] * -1.73130237373651 * 140 + 180))) | LineTo 144,(max(-1.18158387550562 * 140 + 180,([MeasureAudioLevelSub20] * -2.03721357845796 * 140 + 180))) | LineTo 151.2,(max(-1.04877468131564 * 140 + 180,([MeasureAudioLevelSub21] * -1.8082322091649 * 140 + 180))) | LineTo 158.4,(max(-1.22379557248923 * 140 + 180,([MeasureAudioLevelSub22] * -2.10999236636074 * 140 + 180))) | LineTo 165.6,(max(-1.07749563075741 * 140 + 180,([MeasureAudioLevelSub23] * -1.85775108751277 * 140 + 180))) | LineTo 172.8,(max(-1.24745577606242 * 140 + 180,([MeasureAudioLevelSub24] * -2.15078582079727 * 140 + 180))) | LineTo 180,(max(-1.08988284477545 * 140 + 180,([MeasureAudioLevelSub25] * -1.87910835306113 * 140 + 180))) | LineTo 187.2,(max(-1.2522058216569 * 140 + 180,([MeasureAudioLevelSub26] * -2.15897555458087 * 140 + 180))) | LineTo 194.4,(max(-1.08574854583211 * 140 + 180,([MeasureAudioLevelSub27] * -1.87198025143466 * 140 + 180))) | LineTo 201.6,(max(-1.2379737034234 * 140 + 180,([MeasureAudioLevelSub28] * -2.13443741969552 * 140 + 180))) | LineTo 208.8,(max(-1.06515540568507 * 140 + 180,([MeasureAudioLevelSub29] * -1.83647483738805 * 140 + 180))) | LineTo 216,(max(-1.20497516576691 * 140 + 180,([MeasureAudioLevelSub30] * -2.07754338925329 * 140 + 180))) | LineTo 223.2,(max(-1.02841559534748 * 140 + 180,([MeasureAudioLevelSub31] * -1.773130336806 * 140 + 180))) | LineTo 230.4,(max(-1.15371043288144 * 140 + 180,([MeasureAudioLevelSub32] * -1.9891559187611 * 140 + 180))) | LineTo 237.6,(max(-0.97608605289356 * 140 + 180,([MeasureAudioLevelSub33] * -1.68290698774752 * 140 + 180))) | LineTo 244.8,(max(-1.08495662586114 * 140 + 180,([MeasureAudioLevelSub34] * -1.87061487217439 * 140 + 180))) | LineTo 252,(max(-0.908960040845109 * 140 + 180,([MeasureAudioLevelSub35] * -1.56717248421571 * 140 + 180))) | LineTo 259.2,(max(-0.999755982336684 * 140 + 180,([MeasureAudioLevelSub36] * -1.72371721092532 * 140 + 180))) | LineTo 266.4,(max(-0.828055121120292 * 140 + 180,([MeasureAudioLevelSub37] * -1.42768124331085 * 140 + 180))) | LineTo 273.6,(max(-0.899400057215132 * 140 + 180,([MeasureAudioLevelSub38] * -1.55068975381919 * 140 + 180))) | LineTo 280.8,(max(-0.734597729832207 * 140 + 180,([MeasureAudioLevelSub39] * -1.26654781005553 * 140 + 180))) | LineTo 288,(max(-0.785410144024137 * 140 + 180,([MeasureAudioLevelSub40] * -1.35415542073127 * 140 + 180))) | LineTo 295.2,(max(-0.630004585767557 * 140 + 180,([MeasureAudioLevelSub41] * -1.08621480304751 * 140 + 180))) | LineTo 302.4,(max(-0.659514213652751 * 140 + 180,([MeasureAudioLevelSub42] * -1.13709347181509 * 140 + 180))) | LineTo 309.6,(max(-0.515861214373986 * 140 + 180,([MeasureAudioLevelSub43] * -0.8894158868517 * 140 + 180))) | LineTo 316.8,(max(-0.523620720074163 * 140 + 180,([MeasureAudioLevelSub44] * -0.902794344955454 * 140 + 180))) | LineTo 324,(max(-0.393897912810472 * 140 + 180,([MeasureAudioLevelSub45] * -0.679134332431848 * 140 + 180))) | LineTo 331.2,(max(-0.37978967012882 * 140 + 180,([MeasureAudioLevelSub46] * -0.654809776084173 * 140 + 180))) | LineTo 338.4,(max(-0.265963520406175 * 140 + 180,([MeasureAudioLevelSub47] * -0.45855779380375 * 140 + 180))) | LineTo 345.6,(max(-0.2302013959206 * 140 + 180,([MeasureAudioLevelSub48] * -0.396898958483793 * 140 + 180))) | LineTo 352.8,(max(-0.133997392140804 * 140 + 180,([MeasureAudioLevelSub49] * -0.231029986449662 * 140 + 180))) | LineTo 360,(max(-0.0771235032046037 * 140 + 180,([MeasureAudioLevelSub50] * -0.132971557249317 * 140 + 180))) | LineTo 360,(min(0.0671260120484513 * 140 + 180,(-[MeasureAudioLevelSub50] * -0.115734503531813 * 140 + 180))) | LineTo 352.8,(min(0.153954450544754 * 140 + 180,(-[MeasureAudioLevelSub49] * -0.265438707835782 * 140 + 180))) | LineTo 345.6,(min(0.200360474227189 * 140 + 180,(-[MeasureAudioLevelSub48] * -0.345449093495153 * 140 + 180))) | LineTo 338.4,(min(0.305575108551775 * 140 + 180,(-[MeasureAudioLevelSub47] * -0.526853635434096 * 140 + 180))) | LineTo 331.2,(min(0.330557675852862 * 140 + 180,(-[MeasureAudioLevelSub46] * -0.569927027332521 * 140 + 180))) | LineTo 324,(min(0.452563559399265 * 140 + 180,(-[MeasureAudioLevelSub45] * -0.780281998964251 * 140 + 180))) | LineTo 316.8,(min(0.455743960064549 * 140 + 180,(-[MeasureAudioLevelSub44] * -0.785765448387154 * 140 + 180))) | LineTo 309.6,(min(0.592691608004154 * 140 + 180,(-[MeasureAudioLevelSub43] * -1.02188208276578 * 140 + 180))) | LineTo 302.4,(min(0.574021630401468 * 140 + 180,(-[MeasureAudioLevelSub42] * -0.989692466209428 * 140 + 180))) | LineTo 295.2,(min(0.723835055988257 * 140 + 180,(-[MeasureAudioLevelSub41] * -1.24799147584182 * 140 + 180))) | LineTo 288,(min(0.683597717946934 * 140 + 180,(-[MeasureAudioLevelSub40] * -1.17861675508092 * 140 + 180))) | LineTo 280.8,(min(0.844005902360408 * 140 + 180,(-[MeasureAudioLevelSub39] * -1.45518259027656 * 140 + 180))) | LineTo 273.6,(min(0.782811160909467 * 140 + 180,(-[MeasureAudioLevelSub38] * -1.34967441536115 * 140 + 180))) | LineTo 266.4,(min(0.951382479585017 * 140 + 180,(-[MeasureAudioLevelSub37] * -1.64031461997417 * 140 + 180))) | LineTo 259.2,(min(0.870157984626373 * 140 + 180,(-[MeasureAudioLevelSub36] * -1.50027238728685 * 140 + 180))) | LineTo 252,(min(1.04433706820502 * 140 + 180,(-[MeasureAudioLevelSub35] * -1.80058115207762 * 140 + 180))) | LineTo 244.8,(min(0.944314100286552 * 140 + 180,(-[MeasureAudioLevelSub34] * -1.62812775911474 * 140 + 180))) | LineTo 237.6,(min(1.12146057140962 * 140 + 180,(-[MeasureAudioLevelSub33] * -1.93355270932693 * 140 + 180))) | LineTo 230.4,(min(1.00415537676718 * 140 + 180,(-[MeasureAudioLevelSub32] * -1.73130237373651 * 140 + 180))) | LineTo 223.2,(min(1.18158387550562 * 140 + 180,(-[MeasureAudioLevelSub31] * -2.03721357845796 * 140 + 180))) | LineTo 216,(min(1.04877468131564 * 140 + 180,(-[MeasureAudioLevelSub30] * -1.8082322091649 * 140 + 180))) | LineTo 208.8,(min(1.22379557248923 * 140 + 180,(-[MeasureAudioLevelSub29] * -2.10999236636074 * 140 + 180))) | LineTo 201.6,(min(1.07749563075741 * 140 + 180,(-[MeasureAudioLevelSub28] * -1.85775108751277 * 140 + 180))) | LineTo 194.4,(min(1.24745577606242 * 140 + 180,(-[MeasureAudioLevelSub27] * -2.15078582079727 * 140 + 180))) | LineTo 187.2,(min(1.08988284477545 * 140 + 180,(-[MeasureAudioLevelSub26] * -1.87910835306113 * 140 + 180))) | LineTo 180,(min(1.2522058216569 * 140 + 180,(-[MeasureAudioLevelSub25] * -2.15897555458087 * 140 + 180))) | LineTo 172.8,(min(1.08574854583211 * 140 + 180,(-[MeasureAudioLevelSub24] * -1.87198025143466 * 140 + 180))) | LineTo 165.6,(min(1.2379737034234 * 140 + 180,(-[MeasureAudioLevelSub23] * -2.13443741969552 * 140 + 180))) | LineTo 158.4,(min(1.06515540568507 * 140 + 180,(-[MeasureAudioLevelSub22] * -1.83647483738805 * 140 + 180))) | LineTo 151.2,(min(1.20497516576691 * 140 + 180,(-[MeasureAudioLevelSub21] * -2.07754338925329 * 140 + 180))) | LineTo 144,(min(1.02841559534748 * 140 + 180,(-[MeasureAudioLevelSub20] * -1.773130336806 * 140 + 180))) | LineTo 136.8,(min(1.15371043288144 * 140 + 180,(-[MeasureAudioLevelSub19] * -1.9891559187611 * 140 + 180))) | LineTo 129.6,(min(0.97608605289356 * 140 + 180,(-[MeasureAudioLevelSub18] * -1.68290698774752 * 140 + 180))) | LineTo 122.4,(min(1.08495662586114 * 140 + 180,(-[MeasureAudioLevelSub17] * -1.87061487217439 * 140 + 180))) | LineTo 115.2,(min(0.908960040845108 * 140 + 180,(-[MeasureAudioLevelSub16] * -1.5671724842157 * 140 + 180))) | LineTo 108,(min(0.999755982336684 * 140 + 180,(-[MeasureAudioLevelSub15] * -1.72371721092532 * 140 + 180))) | LineTo 100.8,(min(0.828055121120293 * 140 + 180,(-[MeasureAudioLevelSub14] * -1.42768124331085 * 140 + 180))) | LineTo 93.6,(min(0.899400057215132 * 140 + 180,(-[MeasureAudioLevelSub13] * -1.55068975381919 * 140 + 180))) | LineTo 86.4,(min(0.734597729832206 * 140 + 180,(-[MeasureAudioLevelSub12] * -1.26654781005553 * 140 + 180))) | LineTo 79.2,(min(0.785410144024136 * 140 + 180,(-[MeasureAudioLevelSub11] * -1.35415542073127 * 140 + 180))) | LineTo 72,(min(0.630004585767557 * 140 + 180,(-[MeasureAudioLevelSub10] * -1.08621480304751 * 140 + 180))) | LineTo 64.8,(min(0.659514213652751 * 140 + 180,(-[MeasureAudioLevelSub09] * -1.13709347181509 * 140 + 180))) | LineTo 57.6,(min(0.515861214373986 * 140 + 180,(-[MeasureAudioLevelSub08] * -0.889415886851699 * 140 + 180))) | LineTo 50.4,(min(0.523620720074162 * 140 + 180,(-[MeasureAudioLevelSub07] * -0.902794344955451 * 140 + 180))) | LineTo 43.2,(min(0.393897912810472 * 140 + 180,(-[MeasureAudioLevelSub06] * -0.679134332431848 * 140 + 180))) | LineTo 36,(min(0.379789670128821 * 140 + 180,(-[MeasureAudioLevelSub05] * -0.654809776084174 * 140 + 180))) | LineTo 28.8,(min(0.265963520406174 * 140 + 180,(-[MeasureAudioLevelSub04] * -0.458557793803749 * 140 + 180))) | LineTo 21.6,(min(0.2302013959206 * 140 + 180,(-[MeasureAudioLevelSub03] * -0.396898958483792 * 140 + 180))) | LineTo 14.4,(min(0.133997392140804 * 140 + 180,(-[MeasureAudioLevelSub02] * -0.231029986449662 * 140 + 180))) | LineTo 7.2,(min(0.0771235032046038 * 140 + 180,(-[MeasureAudioLevelSub01] * -0.132971557249317 * 140 + 180))) | LineTo 0,(min(-1.33531076820792e-016 * 140 + 180,(-[MeasureAudioLevelSub00] * 2.30225994518607e-016 * 140 + 180))) | LineTo 0,180 | ClosePath 1
Perl code (Thats a preview, I'll update it later, I have to work now, but some parts of other libraries have been pasted and little-to-no edited, and some comments might be useful as well.)

Code: Select all

#!/usr/bin/env perl

use strict;
use warnings;

use File::BOM;
use Math::Trig ':pi';

####################################################################################################

# Bands measured
print "How many bands?\n>";
my $bands_count = <STDIN>;
chomp $bands_count;

# Scale
print "Scale? (%)\n>";
my $scale = <STDIN>;
chomp $scale;

####################################################################################################

# File
my $ini_file_IN = '..\Variables\Default\Player.inc';
my $ini_file_OUT = '..\Variables\Player.inc';

# Reading
open my $VISUAL, '<:encoding(UTF-16)', $ini_file_IN or die;
my @file_content = <$VISUAL>;
close $VISUAL;
$file_content[0] =~ s/^\x{FEFF}//;

# Writing
open $VISUAL, '>:raw:encoding(UTF-16LE):via(File::BOM)', $ini_file_OUT or die;
my $print_next = 0;
my $print_what = '';

for (@file_content) {

    if (! $print_next) {
        print {$VISUAL} $_;
    } else {
        $print_next = 0;
        print {$VISUAL} (join ' | ', generate_content([($scale / 100), $bands_count, (1.8 * $scale), (360 / ($bands_count - 1)), 140, (($print_what eq 'linear') ? 1 : 0)])) . "\n";
    }

    if (/^; Visual (\w{4,6}ar)\s*$/) {
        $print_next = 1;
        $print_what = $1;
    }

}

close $VISUAL;
exit;

####################################################################################################

# Subroutine definition
#######################

sub generate_content {

    my @output;
    my $_multiplier = 1;

    # Due to the design, every line drawing needs two opposite lines
    # + = upper line, drawn left to right
    # - = lower line, drawn right to left
    # Second argument is boolean to indicate a vertical gap
    push @output, (
      (line($_[0], ['+', 0], $_multiplier)),
      (line($_[0], ['-', 0], $_multiplier)),
      (line($_[0], ['+', 1], $_multiplier)),
      (line($_[0], ['-', 1], $_multiplier))
    );

    if ($_[0][5]) {

        # Linear
        push @output, ('LineTo 0,' . ($_[0][2] * $_multiplier * $_[0][0]) . ' | ClosePath 1');
        unshift @output, ("VisualLinearA$_[0][1]=0," . ($_[0][2] * $_multiplier * $_[0][0]));

    } else {

        # Circular
        unshift @output, ("VisualCircularA$_[0][1]=0," . ($_[0][2] * $_multiplier * $_[0][0]));
        push @output, (
          ('LineTo 0,' . ($_[0][2] * $_multiplier * $_[0][0]) . " | ClosePath 1\nVisualCircularB$_[0][1]=0," . ($_[0][2] * ($_multiplier *= 0.999) * $_[0][0])),
          (line($_[0], ['+', 0], $_multiplier)),
          (line($_[0], ['-', 0], $_multiplier)),
          (line($_[0], ['+', 1], $_multiplier)),
          (line($_[0], ['-', 1], $_multiplier)),
          ('LineTo 0,' . ($_[0][2] * $_multiplier * $_[0][0]) . " | ClosePath 1\nVisualCircularC$_[0][1]=0," . ($_[0][2] * ($_multiplier *= 0.7) * $_[0][0])),
          (line($_[0], ['+', 0], $_multiplier)),
          (line($_[0], ['-', 0], $_multiplier)),
          ('LineTo 0,' . ($_[0][2] * $_multiplier * $_[0][0]) . ' | ClosePath 1')
        );

    }

    return @output;

}

# Subroutine definition
#######################

sub line {

    my @output;

    if ($_[1]->[0] eq '+') {
        for (my $x = 0; $x <= ($_[0][1] - 1); $x++) {
            push @output, push_line($_[0], $x, $_[1], $_[2]);
        }
    } else {
        for (my $x = ($_[0][1] - 1); $x >= 0; $x--) {
            push @output, push_line($_[0], $x, $_[1], $_[2]);
        }
    }

    return @output;

}

# Subroutine definition
#######################

sub push_line { return line_text($_[0], $_[1], (($_[1] < 10) ? "0$_[1]" : $_[1]), (($_[2][0] eq '+') ? '' : '-'), (($_[1] % 2 != (($_[2][0] eq '+') ? 1 : 0) && $_[2][1] == 1) ? 1.08 : 0.94), (($_[0][5]) ? $_[3] : ($_[3] * 2 * $_[0][0] * sin(pi / 180 * (180 + ((180 / $_[0][1]) * $_[1])))))); }

# Subroutine definition
#######################

sub line_text { return ('LineTo ' . ($_[1] * ($_[0][3]) * $_[0][0]) . ",(" . (($_[3] eq '') ? 'max' : 'min') . "(" . ((($_[3] eq '') ? 1 : -1) * 0.58 * ($_[5] * $_[4] * $_[0][0])) . ' * ' . $_[0][4] . " + " . ($_[0][2] * $_[0][0]) . ",($_[3]" . "[MeasureAudioLevelSub$_[2]] * " . ($_[5] * $_[4] * $_[0][0]) . ' * ' . $_[0][4] . " + " . ($_[0][2] * $_[0][0]) . ")))"); }
Also, if someone already created such or similar tools, tell me, so I don't update it for nothing!
Last edited by Bananorpion on March 6th, 2018, 1:49 am, edited 1 time in total.
User avatar
Bananorpion
Posts: 40
Joined: April 16th, 2017, 8:35 pm

Re: Convert Perl to Lua

Bananorpion » March 6th, 2018, 1:47 am

Also, because why the hell not, a picture of the skin using such visual. (Audio visualiser.)
Capture.PNG
You do not have the required permissions to view the files attached to this post.
User avatar
kyriakos876
Posts: 886
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Convert Perl to Lua

kyriakos876 » March 7th, 2018, 1:36 am

Bananorpion wrote:Also, because why the hell not, a picture of the skin using such visual. (Audio visualiser.)

Capture.PNG
If what I'm seeing was generated entirely by rainmeter I have one question. Is your CPU still okay?
User avatar
Bananorpion
Posts: 40
Joined: April 16th, 2017, 8:35 pm

Re: Convert Perl to Lua

Bananorpion » March 12th, 2018, 5:32 pm

kyriakos876 wrote:If what I'm seeing was generated entirely by rainmeter I have one question. Is your CPU still okay?
Seems like it. I just tested with an even more complex skin and the average CPU usage went from 3.5% to stabilize around 6.5%, on battery mode. I guess that's fair. Rainmeter is nicely optimized, I guess.
Feel free to try: https://forum.rainmeter.net/viewtopic.php?f=14&t=28060