<div dir="ltr"><div><div><div><div><div><div><div>I wish I had thought of it earlier! However there are heaps of separate x and y variables everywhere which still makes XYPairs difficult to use.<br><br></div>BTW, I was surprised to learn that FB has destructuring assignment, which would be useful for converting back and forth between separate variables and XYPairs:<br><br></div><div>dim as integer x, y<br></div>let (x, y) = get_resolution().xy<br></div><div>(The .xy, which I just added, is unfortunately necessary because XYPair is a union, which can't be destructured directly)<br></div><div><br></div>Another thing worth mention, because it's already bitten me twice: FB's parser won't let you write the following<br></div>DIM pos as XYPair = (a + b) * 2<br></div>because brackets are assumed to be object initialisation (like {} in C), <br><br></div>Finally! I learnt yesterday that FB lets you return objects byref, which I find very useful in C++. Silly examples:<br><br>function battlemode() byref as integer<br>  return gen(genBattleMode)<br>end function<br>function genmax(ty as SpriteType) byref as integer<br>  return gen(genMaxHeroPic + ty)<br>end function<br><br>battlemode() = 1<br>(genmax(1)) = 14  'Exception: if exactly one argument, need extra brackets<br></div><div><div><div><div><br></div><div>You can return UDTs and strings too<br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 3 May 2017 at 02:46, James Paige <span dir="ltr"><<a href="mailto:Bob@hamsterrepublic.com" target="_blank">Bob@hamsterrepublic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">These are wonderful unions. As long as I can remember they exist, they are going to make for some cleaner code :)<br></div><div class="gmail-m_-9177342916648133105HOEnZb"><div class="gmail-m_-9177342916648133105h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 1, 2017 at 9:29 AM,  <span dir="ltr"><<a href="mailto:subversion@hamsterrepublic.com" target="_blank">subversion@hamsterrepublic.co<wbr>m</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">teeemcee<br>
2017-05-01 09:29:43 -0700 (Mon, 01 May 2017)<br>
165<br>
Add Slice.{Pos,ScreenPos,Size}, Frame.size, Surface.size, MouseInfo.pos, which are in union with the existing members<br>
<br>
Start to use these aliases around the codebase<br>
---<br>
U   wip/allmodex.bas<br>
U   wip/<a href="http://allmodex.bi" rel="noreferrer" target="_blank">allmodex.bi</a><br>
U   wip/common.rbas<br>
U   wip/scriptcommands.bas<br>
U   wip/slices.bas<br>
U   wip/<a href="http://slices.bi" rel="noreferrer" target="_blank">slices.bi</a><br>
U   wip/<a href="http://surface.bi" rel="noreferrer" target="_blank">surface.bi</a><br>
______________________________<wbr>_________________<br>
Ohrrpgce mailing list<br>
<a href="mailto:ohrrpgce@lists.motherhamster.org" target="_blank">ohrrpgce@lists.motherhamster.o<wbr>rg</a><br>
<a href="http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org" rel="noreferrer" target="_blank">http://lists.motherhamster.org<wbr>/listinfo.cgi/ohrrpgce-motherh<wbr>amster.org</a><br>
</blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
Ohrrpgce mailing list<br>
<a href="mailto:ohrrpgce@lists.motherhamster.org" target="_blank">ohrrpgce@lists.motherhamster.o<wbr>rg</a><br>
<a href="http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org" rel="noreferrer" target="_blank">http://lists.motherhamster.org<wbr>/listinfo.cgi/ohrrpgce-motherh<wbr>amster.org</a><br>
<br></blockquote></div><br></div></div>