Line, b+ hmm?
Blitz3D Forums/Blitz3D Beginners Area/Line, b+ hmm?
| ||
Can't store in a variable a Line 0,0,0,10? global draw_line = line 0,0,0,10 how come we cant store commands in a variable? |
| ||
right, you can't store commands in a variable. variables can only contain data. |
| ||
Well, since you know you're going to draw a line, and you already know the coordinates. What difference will it make between having a Global store a function or just calling a DrawLine() function with your already known coords?. Sometimes you need to take a step back to get a better view of the forest, instead of only seeing trees. Global Draw_Line 0,0,0,10 ; -vs.- DrawLine() ... Function DrawLine() Line 0, 0, 0, 10 End Function |
| ||
i don't see the point of making such a thing, why not just use the real command straight? |
| ||
It mainly depends on the architecture of your whole app. If you make a function that plots some hardcoded window (a rect with text inside) then you only need that rect command once, while the coords come from the function arguements. For the rest you'll use the window-function to do this. So, you don't gain alot in terms of readability and portability if you use such a macro mechanism here, purely for a single instance. If you want to have this mechanism because you think you really need it, then I can assure you that you're doing something wrong at another place, in a way that the situation makes you *think* you need this mechanism. |
| ||
Perhaps he is mixing macros with variables? Kaisuo, do a search on the forum. I am sure there is at least one preprocessor which will do macros for you... Barney |
| ||
Dunno if I should have mentioned the word 'macro' here. In Povray you can do something like:#declare brown=color rgb<.8,.4,0> and then use it as: color brown However, I wouldn't mix-up a script-language with a traditional language. |