Custom Type question

BlitzMax Forums/BlitzMax Beginners Area/Custom Type question

Topdecker(Posted 2005) [#1]
I have a custom type that is working well and is reasonably complex given my 3 or 4 days of experience with BlitzMax, having a number of fields, a method, and a function.

The problem/question that I have is this - lets say that I want a global effect to impact all members of my custom type. For instance, maybe I want to adjust something simple, like the visibility for all the member elements.

Is it possible to have a variable that all members of a type share without using the GLOBAL keyword? Optionally, is there a way to set the value to a field for all member variables of a given type? If so, quick example or reference to an example would be appreciated.

Thanks!

Tim


Dreamora(Posted 2005) [#2]
Type example
   global alpha:float ' this global only exists within type
                      ' and is shared for all instances
                      ' can be accessed from outside with example.alpha

end type


thats the only possibility and is exactly there for what you want it to use. (most common use is a list to which all instances are added ... for simple instance management a la B3D)

There are as well type constants btw if you need them for something.


Who was John Galt?(Posted 2005) [#3]
I think that is what u want, TopDecker - it's only global within the type *I think*


Topdecker(Posted 2005) [#4]
Dreamora & Falken -

Yep, using GLOBAL inside the type took care of it and removed at least 3 lines of code from my program.

Thank you guys, I really appreciate it! I am really starting to dig BlitzMax and having community help is a real blessing.

Tim