AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Constant 2-D array syntax *solved* (https://forums.alliedmods.net/showthread.php?t=57150)

purple_pixie 06-29-2007 06:53

Constant 2-D array syntax *solved*
 
This has been causing me some serious headache ...

I'm trying to create a constant 2-D array of floating point values.

So something like:
ARRAY[0][0]=0.0
ARRAY[0][1]=0.1
ARRAY[0][0]=0.0
ARRAY[1][0]=1.0

And usually I get an error, but my latest attempt at guessing the syntax just made unexpected errors in amxxpc.exe :D

Now this works fine for an array of strings, which we all know is really a 2-d array:

Code:
new const STR_ARRAY[2][3] = { "abc" ,"def" }



So one would naturally assume that for a "real" 2-d array:

Code:
new const Float:Array[2][2] = { { 0.0 , 0.1 } ,{ 0.0 , 1.0 } }



But this just crashes the compiler ^^

Anyone care to show me quite how easy this is / how stupid I'm being?

EDIT: Arggh ... I figured it.

The actual array I used was a lot bigger than that, and I had 30/0 and not 30.0 as one of the values.

They sooo shouldn't be so close together ... and the compiler should so be able to spot div0 ... *sigh*

And goddamit does editing posts screw up your "small" tags ...

Lee 06-29-2007 13:08

Re: Constant 2-D array syntax *solved*
 
Quote:

Originally Posted by purple_pixie (Post 496130)
And goddamit does editing posts screw up your "small" tags ...

Quote:

Originally Posted by Lee (Post 456609)
Go to UserCP, Edit Options, at the bottom, change Enhanced Interface to Standard Editor.

This is also a workaround for the broken Pawn/Small tags, and obviously why Freecode wasn't seeing the behaviour I described.



All times are GMT -4. The time now is 21:26.

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