|
Post by dw817 on Apr 20, 2009 10:40:12 GMT -5
Hi Tom:
I'm trying to make use of these:
sub inc(a):a=a+1:endsub sub dec(a):a=a-1:endsub function dec(a,b):a=a-b:return a:endfunction function inc(a,b):a=a+b:return a:endfunction function mul(a,b):a=a*b:return a:endfunction function mod(a,b):a=a %b:return a:endfunction function div(a,b):a=a/b:return a:endfunction sub dec(a,b):a=a-b:endsub sub inc(a,b):a=a+b:endsub sub mul(a,b):a=a*b:endsub sub mod(a,b):a=a %b:endsub sub div(a,b):a=a/b:endsub
unfortunately, none of these exist in B4GL, and when I declared dec above with one argument, it won't let me redefine it again with a 2nd argument. Further, I can't define a function separate from a sub if they share the same name.
here is a sample:
dec(a) .. a=a-1 dec(a,b) .. a=a-b a=mul(b,c) .. a=b*c a=mul(div(b,c),d) .. a=(b/c)*d etc.
Here is a line of code I am writing: function pntg(a,b):return div(mod(pnt(a,b),32),32):endfunction
which is the same as:
function pntg(a,b):return(pnt(a,b) %32)/32:endfunction
Please add these as listed above, if even just the INC and DEC. I think this will help other coders too with their operands and clarify sourcecode for complex calculations.
Thanks !
|
|