OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Resources Beta Testing & Submission => Topic started by: hoz on 16 Oct 2007, 16:15:22

Title: The PlayingCard Library (ACCEPTED)
Post by: hoz on 16 Oct 2007, 16:15:22
This card library is modeled after the popular cards32.dll, if you've ever worked with cards32.dll then you will find this very similar. For those who don't know, the card library is meant as a helper for building card games, since this is written for Armed Assault, you can create playing cards type games using this simple library.


Included:
52 playing cards

Functions for:
      *returning card value
      *returning card suit
      *returning card text name
      *returning a shuffled deck
      *returning a custom shuffled deck
      *returning card back image path
      *returning cardimage path

Download CardLibrary (http://www.ofpec.com/ed_depot/index.php?action=details&id=438&game=ArmA)
Enjoy!
Title: Re: The PlayingCard Library
Post by: Spooner on 16 Oct 2007, 18:22:46
Nice work, mate!

One thing though, in making it work like the windows dll, you are making it less pleasant to use for those of us that haven't used it in the dll form or that would prefer a more ArmA-native syntax. e.g. I think that:
Code: [Select]
["rtnCardTxtName", 32] call CardLib;

should be something like:
Code: [Select]
[32] call CardLibCardName;
(You might also like to make an OFPEC tag CARD_ or something, instead of using the CardLib prefix?)

If you changed the calling methods this way, then running CardLib.sqf would instead load the cardlib (as in "LoadLib" event) and set up all the necessary functions.

I noticed that you use local constants a lot, which you might as well use #defines for. Not something I'd usually hassle anyone about, but since you are already a programmer, I thought I'd point that out.
Title: Re: The PlayingCard Library
Post by: hoz on 17 Oct 2007, 16:07:20
I thought about using a TAG, but I didn't think the library would be that popular. I know its not a very good reason, if I do update the Library part I will use a tag.