Raised This Month: $12 Target: $400
 3% 

dDimension 1.1


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-04-2011 , 08:25   dDimension 1.1
Reply With Quote #1

dDimension 1.1

dDimension provides a limited array system for unlimited dimensions, see the example below. Please, do read the include file before asking for further information.

Code:
/*     Introduction to dDimension 1.1 */ #include <amxmodx> #include <ddimension> #define PLUGIN "dDimensionExample" #define VERSION "1.0" #define AUTHOR "SnoW" /*     Arrays can be created as global */ public plugin_init( ) {     register_plugin( PLUGIN, VERSION, AUTHOR );         f( ); } f( ) {     /* >         c{ } creates dDimension array                 Arrays have always be created at the beginning of a statement ( See how the new/static must be inside the form )     */         c{ new Float:MyDArray[ 3 ][ 3 ][ 3 ][ 3 ][ 3 ] }, Float: fCount;            /* <         When creating array it is forbidden to not specify a tag, so if no tag is wanted _: can be used     */         /* >         d{ } loads dDimension array     */     for( new d1; d1 < 3; d1++ )     for( new d2; d2 < 3; d2++ )     for( new d3; d3 < 3; d3++ )     for( new d4; d4 < 3; d4++ )     for( new d5; d5 < 3; d5++ )         d{ MyDArray[ d1 ][ d2 ][ d3 ][ d4 ][ d5 ] } = fCount += 1.0;             /* >         p{ } passes dDimension array to function                 Notice the space missing in the form end, this is right as all characters after the name are forbidden, the very same with g{ }     */         f2( p{ MyDArray} ); } /* >     g{ } initializes the array passed         Notice the tag outside of the form, only c{ } accepts tags inside the form */ f2( Float: g{ MyPassedDArray} ) {     for( new d1; d1 < 3; d1++ )     for( new d2; d2 < 3; d2++ )     for( new d3; d3 < 3; d3++ )     for( new d4; d4 < 3; d4++ )     for( new d5; d5 < 3; d5++ )         server_print( "%f", d{ MyPassedDArray[ d1 ][ d2 ][ d3 ][ d4 ][ d5 ] } );    }

Developing

The syntax is horrible for my opinion, yet I couldn't come with anything more reasonable. Write a better one and I will be happy to move to that one.

Adding warnings for index out of bounds should be easy, somehow I found that tagof isn't working as it should be ( at least not in our pawn version ), so I'm currently believing that tag mismatch warnings will never be achieved.

I appreciate you developing dDimension. Even if you just used it, add a post below as I will be working with the system only if someone uses it. Thank you for co-operating.
Attached Files
File Type: inc ddimension.inc (1.5 KB, 326 views)
SnoW is offline
Send a message via MSN to SnoW
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-04-2011 , 08:27   Re: dDimension 1.1
Reply With Quote #2

Res
SnoW is offline
Send a message via MSN to SnoW
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode