Type Information
Blitz3D Forums/Blitz3D Beginners Area/Type Information
| ||
H! Must I always use type playerdata field a field b end type For player.playerdata = Each playerdata player\a = 10 Next Oke I have like above and when I do this: print player.playerdata\a ;I get an error Is it btw possible to do something like this For player.playerdata = player.playerdata\a = 10 player\a = 10 Next I want to know everything about the type, Where can I find more information ? |
| ||
one thing i do for a type if it's for say my player(if im only using a few of them and create them all manually), i'd create a function for creating the type as usual ie player1.player = CreatePlayer.player(x#,y#,z#) player2.player = CreatePlayer.player(x#,y#,z#) player3.player = CreatePlayer.player(x#,y#,z#) player4.player = CreatePlayer.player(x#,y#,z#) now if i wanted to know all the values for a certain player i would just do text 0,10," player one's health " + player1\health text 0,20," player two's health " + player2\health simple example but it saved me alot of messing around trying to access certain types or having to go thru them all. |
| ||
@GC-Martijn, remember to define a global pointer to your type: type playerdata field a field b end type GLOBAL PLAYER.PLAYERDATA ;here is the global pointer This is ok: For player.playerdata = Each playerdata player\a = 10 Next Oke I have like above and when I do this: print player.playerdata\a ;I get an error Because you should write, instead: print player\a Is it btw possible to do something like this For player.playerdata = player.playerdata\a = 10 player\a = 10 Next Sorry, I don't get the meaning of: For player.playerdata = player.playerdata\a = 10 It looks like this: For <type_pointer> = <wrong_syntax> = 10 Which is a complete nonsense. Perhaps you want to make a loop and perform an action only to the player elements that have the 'a' field value equal to 10 ? In this case: for player.playerdata = each playerdata if player\a = 10 then ;whatever you need endif next I want to know everything about the type, Where can I find more information ? Repeat - read the paper manual - read the tutorials @ www.blitzcoder.com - experiment - ask on this forum - ask @ blitzcoder forun Until you have mastered type structure. ;-) Hope this helps, Sergio. |
| ||
A this I need : :)GLOBAL PLAYER.PLAYERDATA ;here is the global pointer now it works and yes I was meaning to make a loop and perform an action only to the player elements that have the 'a' field value equal to 10. Thanks, btw I can - read the paper manual because I buy the software online (live in the netherlands) |