IdEal question.

Blitz3D Forums/Blitz3D Beginners Area/IdEal question.

Galdy(Posted 2011) [#1]
When Creating an instance of a type,


"WD_Animation.ObjectAnimation=New ObjectAnimation"


IDEal puts the "WD_Animation.ObjectAnimation" portion in red.


The code is working fine, but IdEal is treating it like a variable name that has not been declared turning it red. I don't get it. Usually it only turns an undeclared variable red. Anyone know what's up?


Charrua(Posted 2011) [#2]
because it isn't declared!

you have to declare it as Local or Global (as you wish or need)

Local myLocalVar.ObjectAnimation

;and then (or in the same declaration sentence if you wish)
myLocalVar=New ObjectAnimation



Juan

Last edited 2011


Adam Novagen(Posted 2011) [#3]
IDEal is weird with types. What Charrua said is partially true. However, Blitz does not require a type to be declared as a global to be used through out the program. i.e. something like this:

Type TheThing
    Field X,Y
End Type

TheThing.TheThing = New TheThing


Function TestTheThings()


For TheThing.TheThing = Each TheThing
    X = X = 1
    Y = Y + 1
Next


End Function
TheThing was never declared as a global type, but the For...Next loop will still find it and update it without a MAV. IDEal isn't quite this smart, however, so to get around it, just do the following:
Type TheThing
    Field X,Y
End Type

Global TheThing.TheThing = New TheThing
Delete TheThing


Function TestTheThings()


For TheThing.TheThing = Each TheThing
    X = X = 1
    Y = Y + 1
Next


End Function
This declares a single TheThing as a global Type. Even though it's deleted immediately afterwards, all instances of the TheThing Type will now be recognized correctly by the editor.


Yasha(Posted 2011) [#4]
Actually the above example highlights correctly in my IDEal. Did you accidentally turn Strict off while writing it? (It wouldn't be much good if it made such obvious mistakes...)

Pedant time: Types are always global in B3D, because a Type is a compile-time construct. A variable has a type, and a scope which can be local or global; and it can hold objects of a given type, which are heap-allocated and thus of dynamic extent. There's no such thing as a "global type" or "local type", nor can types be created or deleted. And yes this is a big deal: referring to objects as types makes no more sense than calling them "functions", or calling all your functions "operating systems".

Last edited 2011


Galdy(Posted 2011) [#5]
Hey Thanks guys. I now understand,