Line, b+ hmm?

Blitz3D Forums/Blitz3D Beginners Area/Line, b+ hmm?

Apollonius(Posted 2003) [#1]
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?


ford escort(Posted 2003) [#2]
right, you can't store commands in a variable.
variables can only contain data.


Andy_A(Posted 2003) [#3]
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



ford escort(Posted 2003) [#4]
i don't see the point of making such a thing, why not just use the real command straight?


CS_TBL(Posted 2003) [#5]
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.


Barnabius(Posted 2003) [#6]
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


CS_TBL(Posted 2003) [#7]
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.