a problem... - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html) +--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html) +--- Thread: a problem... (/thread-334.html) |
a problem... - Placeborick - 03-04-2003 im still learning...slowly getting better learning from mistakes etc. iv just learned how to define objects using the : Code: TYPE atype What i want to do is have type1's damage integer taken away from type 2's HP. Im not sure of the proper syntax to get this to work. Can anyone help with this? a problem... - Agamemnus - 03-04-2003 types are not useful unless you are doing bitmap load.save stuff Listen, just use a.hp and a.damage. You don't need type. n = 100 'amount DIM a.hp(n) as INTEGER, a.damage(n) as INTEGER i = 56 a.hp(i) = a.hp(i) - a.damage(i) a problem... - na_th_an - 03-04-2003 Quote:types are not useful unless you are doing bitmap load.save stuff But using types is better. If you have to pass all those values to a SUB, you only have to do Code: SUB dummy(a() AS mytype) ' this using types instead of Code: SUB dummy(a.hp() AS INTEGER, a.damage() AS INTEGER ... ... ...) TYPEs are one of the most useful things in QB. Funny, in addition to na_th_an's comment, I've never used... - Glenn - 03-04-2003 a user-defined type when loading or saving a bitmap. a problem... - Agamemnus - 03-04-2003 :| a problem... - toonski84 - 03-04-2003 i'd have to say bitmaps are more of an array/allocated memory page thing. type arrays are for making your program more organized, efficient and humanly comprehensible. a problem... - Neo - 03-04-2003 Argh, I don't even use types for loading and saving bitmaps. Since the header of the BMP contains lot of nonsense, you can just do Code: DO very often a problem... - Zap - 03-06-2003 I agree that types are a good thing, unless you use string, because they have to have a predefined length. That sucks :barf: . Im guessing that the solution is to use types if you have many values, or need to have many of many values (Cryptic, but like NPC's, you create a template using type, and DIM as many as you need.). Else you should use normal variables, and maybe group them like Agamemnus said. /Zap |