Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Color Maximite Calls
Author | Message | ||||
Questarian Newbie Joined: 06/04/2015 Location: United StatesPosts: 7 |
Hi! I'm fairly new to the color maximite and mmbasic (4.5), and I might have missed something in the manuals, but it seems mmbasic is a bit temperamental about entirely passing the results of complex expressions in command, function and sub arguments. For example something like: seek #1,(fn-1)*fontv*fonth+1+i*fonth fails fi=(fn-1)*fontv*fonth+1+i*fonth seek #1, fi works with user defined subs/functions, on a sub define as Sub Menu(x,y): Menu Int((hres-menuh)/2+offseth),Int((vres-menuv)/2+offsetv) works menu (hres-menuh)\2+offseth,(vres-menuv)\2+offsetv fails what was driving me nuts, it that it's not all the time, or with every commands/functions/sub. I've used a lot of complex expressions with line, pixel and for commands without any notable issues, and in smaller test programs the complex arguments appeared to work fine, but once it get to a certain size. and/or nested in routines, things seem to start getting particular... any thoughts? -John E. Bielak- |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1133 |
Hi and welcome! me too! But if you always use brackets Menu(x,y)
or Menu((hres-menuh)\2+offseth,(vres-menuv)\2+offsetv) then it should work fine! Regards Michael |
||||
hitsware Guru Joined: 23/11/2012 Location: United StatesPosts: 535 |
> always use brackets YES !!!! Not only with Basic. Keeps things tidy .......... |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9063 |
Welcome, Questarian. Love your avatar! Smoke makes things work. When the smoke gets out, it stops! |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3165 |
MMBasic does have some problems with processing the argument list to subroutines and functions. Especially when you have a function call in the argument list. The Micromite version has fixed this but I have not retrofitted the changes to the Maximite version yet (too many things to do). The workaround is to evaluate any arguments that might cause trouble to variables before calling the sub/fun and then just use the variables in the call. Geoff Geoff Graham - http://geoffg.net |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1133 |
@Geoff BTW. >argument list Micromites have some problems with spaces between function call and the first bracket. Menu(x,y) works
Menu (x,y) works not.
That's no problem if you know it but not easy to find if you not expect it. Regards Michael |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3165 |
An amazing amount of MMBasic is dedicated to catching errors and trying to give a useful error message. But there seems to be any number of fresh ways to trip up the interpreter. I will look at this one and see if I can catch it. Geoff Geoff Graham - http://geoffg.net |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1133 |
my 2c: Not worth the hassle when it comes at the expense of performance. Michael |
||||
Questarian Newbie Joined: 06/04/2015 Location: United StatesPosts: 7 |
Thanks! is part of my Theme... |
||||
Questarian Newbie Joined: 06/04/2015 Location: United StatesPosts: 7 |
That pretty much what i've been doing, breaking out the argument expressions to variables. it also helps breaking up long lines in smaller more manageable ones... It doesn't seem to affect every sub/function call so I've break them up when things start miss behaving. -John- |
||||
Print this page |