1. Sequence/Atom prob
- Posted by Paul Kerslake <paulk at UNISERVE.COM> Dec 02, 2000
- 452 views
------=_NextPart_000_0007_01C05C43.EC855860 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I've been having some problems with get_mouse() and if-then loops. = It seems that at the begining I need the variable assinged to = get_mouse() to be an atom, then to change to a sequence. Here's the = prog: object event event=3D-1 procedure mouseaction() while event=3D-1 do event=3Dget_mouse() if sequence(event) then if and_bits(event[1], 2) then --2's left down display_image({300,420},ufire2[2]) end if end if end while end procedure mouseaction() Can you help me out? Also, what exactly does and_bits do here? I had = to get it from the HTML documentation to get the mouse action to = work----I understand the rest, just not this. Thanks Thomas ------=_NextPart_000_0007_01C05C43.EC855860 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2> I've been having = some problems=20 with get_mouse() and if-then loops. It seems that at the begining I need = the=20 variable assinged to get_mouse() to be an atom, then to change to a = sequence.=20 Here's the prog:</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>object event</FONT></DIV> <DIV><FONT face=3DArial size=3D2>event=3D-1</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>procedure = mouseaction()<BR> while=20 event=3D-1 do<BR> =20 event=3Dget_mouse()<BR> if=20 sequence(event)=20 ; if=20 and_bits(event[1], 2) then --2's left=20 ;=20 ; =20 end if<BR> end=20 if<BR> end while<BR>end procedure</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>mouseaction()<BR></FONT></DIV> <DIV><FONT face=3DArial size=3D2> Can you help me out? = Also, what=20 exactly does and_bits do here? I had to get it from the HTML = documentation to=20 get the mouse action to work----I understand the rest, just not=20 this.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV> <DIV><FONT face=3DArial size=3D2>Thomas</FONT><FONT face=3DArial=20 ------=_NextPart_000_0007_01C05C43.EC855860--
2. Re: Sequence/Atom prob
- Posted by Jeffrey Fielding <JJProg at CYBERBURY.NET> Dec 02, 2000
- 443 views
On Sat, 2 Dec 2000, Paul Kerslake wrote: > Hi, > > I've been having some problems with get_mouse() and if-then loops. It > seems that at the begining I need the variable assinged to get_mouse() to be an > atom, then to change to a sequence. Here's the prog: > > object event > event=-1 > > procedure mouseaction() > while event=-1 do > event=get_mouse() > if sequence(event) then > if and_bits(event[1], 2) then --2's left down > display_image({300,420},ufire2[2]) > end if > end if > end while > end procedure > > mouseaction() > > Can you help me out? Also, what exactly does and_bits do here? I had to get > it from the HTML documentation to get the mouse action to work----I understand > the rest, just not this. > > Thanks > Thomas > Note: sequence s s = {1,2,3,-1} ? s = -1 This displays: {0,0,0,1} What you need to do is this: while integer(event) do instead of: while event = -1 do You could also use: while equal(event, -1) do But that's slightly less efficient (I think). Jeff