0 Members and 6 Guests are viewing this topic.
Here's the most optimized code I could come up with. Only while finding the top left corner does it fully calculate the position. The other corners reuse previously found values and conditionally add to them as necessary. Note that this will only work with the corner locations being calculated in the order below (although code can exist between calculations), and only for the player being at (45,29) due to optimizations tuned specifically to this coordinate.Code: [Select].Top Left29-Osub(D8)+J*[map_width]+(45-Nsub(D8)+I)+E→r₆.Top RightNsub(O00)→r₅+r₆.Bottom LeftOsub(O00)*[map_width]+r₆→r₆.Bottom Rightr₅+r₆Lbl D8 /2/2/2ReturnLbl O00 //2≠⁻2Return
.Top Left29-Osub(D8)+J*[map_width]+(45-Nsub(D8)+I)+E→r₆.Top RightNsub(O00)→r₅+r₆.Bottom LeftOsub(O00)*[map_width]+r₆→r₆.Bottom Rightr₅+r₆Lbl D8 /2/2/2ReturnLbl O00 //2≠⁻2Return
This is effectively what it does, only this is larger and slower.Code: [Select].Top Left29-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E.Top Right29-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+E.Bottom Left35-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E.Bottom Right35-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+E
.Top Left29-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E.Top Right29-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+E.Bottom Left35-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E.Bottom Right35-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+E
For this:Quote from: Runer112 on February 18, 2011, 05:22:09 pmHere's the most optimized code I could come up with. Only while finding the top left corner does it fully calculate the position. The other corners reuse previously found values and conditionally add to them as necessary. Note that this will only work with the corner locations being calculated in the order below (although code can exist between calculations), and only for the player being at (45,29) due to optimizations tuned specifically to this coordinate.Code: [Select].Top Left29-Osub(D8)+J*[map_width]+(45-Nsub(D8)+I)+E→r₆.Top RightNsub(O00)→r₅+r₆.Bottom LeftOsub(O00)*[map_width]+r₆→r₆.Bottom Rightr₅+r₆Lbl D8 /2/2/2ReturnLbl O00 //2≠⁻2ReturnQuote from: Runer112 on February 18, 2011, 07:05:44 pmThis is effectively what it does, only this is larger and slower.Code: [Select].Top Left29-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E.Top Right29-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+E.Bottom Left35-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E.Bottom Right35-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+EAlso wow, this topic grew fast...
How does the float{} function work? I've tried it, but everything after float{X} returned an error...
For(F,0,767{L3+F} or {L6+F}->{L6+F}End