Macro Toolworks Products Discussion Forums :: Suggestions & Bug Reports
Welcome Guest   
 Subject :possible bug in var_oper?.. 11-01-2012 15:01:32 
glenmcd
Joined: 09-08-2010 03:52:46
Posts: 5
Location
check out this test macro:
(vtest1,"(15790320/65536)",CALC_EXPRESSION,"0","", "0")
(-100,-100,"%vtest1%","Message",1,0,0,1)

The answer should be 240, as I don't want anything after the decimal point.
But it returns 241.

You'll notice above that there's no command var_oper or msg.
It seems that the forum software is eating these. eek

EDIT: I'm using V7.4.8 of Macro Toolworks Pro

EDIT 2 17th Jan 2012: Okay what I'm trying to do is use display_getpixel and then
seperating out the individual colors so that I can look for relationships between
them and do the necessary processing in each case. To get the colors out I would
normally use "mod" but I didn't see that in MTW. So I'm doing a formula that does
divides, multiplies and subtractions to fake the modulo operator. Starting with
vColor I want the top 8 bits. So vColor-((vColor/65536)*65536) should work.
But because the result of vColor/65536 is not correct (is it rounding up??),
I end up with a negative number. I guess I could ask for a decimal place and then
use int etc. Maybe there is a simpler way for this particular case, but I'm still
thinking that rounding up is not appropriate when no decimal places are asked for,
which basically means dealing in integers. I'm planning a bunch of macros using
getpixel and processing the colors so I'm hanging out for a solution here if
anyone can help thanks.
IP Logged
Last Edited On: 16-01-2012 23:14:35 By glenmcd for the Reason
 Subject :Re:possible bug in var_oper?.. 21-02-2012 13:25:15 
hugblue@hotmail.com
Joined: 13-10-2010 01:09:07
Posts: 100
Location: sweden
hi glenmcd ..

could you come with some more info. is interested myself. in using getpixel and in seeing your method. thz. and the code you wrote here made no sense.

and i would like to test your example. some more.
IP Logged
 Subject :Re:Re:possible bug in var_oper?.. 21-02-2012 15:46:04 
glenmcd
Joined: 09-08-2010 03:52:46
Posts: 5
Location
hugblue@hotmail.com Wrote on 21-02-2012 13:25:15:
hi glenmcd ..

could you come with some more info. is interested myself. in using getpixel and in seeing your method. thz. and the code you wrote here made no sense.

and i would like to test your example. some more.
Sorry but I've deleted the macro since. The macro in my first post
includes parameters but not the actual command name, because the forum software
ate them. I haven't found a way of including them in a way that sticks.
when you use getpixel, it returns you a number that includes the various color
components (red blue green), x1, x256 and x16536. To seperate I was trying to use
modulo 256 and modulo 16536. As I haven't been able to get that to work without
the rounding, one of my local friends suggested maybe use binary logic (ANDing)
might work. But it's been a while and I'm kinda off doing other things now.
Will possibly return to same bit later.
IP Logged
 Subject :Re:possible bug in var_oper?.. 21-02-2012 21:52:39 
hugblue@hotmail.com
Joined: 13-10-2010 01:09:07
Posts: 100
Location: sweden
Hi Glenmcd.

But thz. Anyway.
Let me know when you get back to it again.

Brian (Hugblue)
IP Logged
Page # 


Powered by ccBoard


Login and share your experience - send messages to forums and add comments to samples, commands and other resources.



Account is free of charge, easy to setup.