xboxscene.org forums

OG Xbox Forums => Official MediaXMenu (MXM) Forum => Dashboard Forums => MXM WIP Beta forum => Topic started by: geniusalz on June 01, 2004, 06:10:00 PM

Title: Variables In Variable Names
Post by: geniusalz on June 01, 2004, 06:10:00 PM
CODE
Set cursorX 1
Set cursorY 1
Set blah%cursorx%%cursory% success
msgbox %blah{cursorx}{cursory}%


But this works:
CODE
Set cursorX 1
Set blah%cursorx% success
msgbox %blah{cursorx}%


Just to let you know, this caused me lots of grief... back to using XMLs for arrays
Doing minesweeper, by the way.
Title: Variables In Variable Names
Post by: BenJeremy on June 01, 2004, 06:48:00 PM
Hmmmm.... I'll have to take a look at the parser for that.
Title: Variables In Variable Names
Post by: koldfuzion on June 01, 2004, 06:53:00 PM
QUOTE

Set cursorx 1
Set cursory 1
SET XY %cursorx%_%cursory%
SET ARRAY1_1 success
msgbox %ARRAY{XY}%


which would work...dunno if its what you need.. just went by your example.
Title: Variables In Variable Names
Post by: BenJeremy on June 01, 2004, 06:58:00 PM
Actually, it would be bad form to squash two variables together like that....


X=11 and Y=1

or X=1 and Y=11

Given the above, there is no difference in the example.

I would recommend putting an underscore between them.
Title: Variables In Variable Names
Post by: koldfuzion on June 01, 2004, 07:02:00 PM
smile.gif
Title: Variables In Variable Names
Post by: BenJeremy on June 01, 2004, 07:12:00 PM
QUOTE (koldfuzion @ Jun 1 2004, 11:02 PM)
im still an idiot.

updated sample to BJ's recommendation.

Well, it wasn't a direct response to your post, but rather a general observation of good practices. wink.gif
Title: Variables In Variable Names
Post by: koldfuzion on June 01, 2004, 07:15:00 PM
smile.gif
Title: Variables In Variable Names
Post by: flattspott on June 01, 2004, 09:03:00 PM
I ran into a similar issue in the FileManager.
Title: Variables In Variable Names
Post by: geniusalz on June 01, 2004, 10:08:00 PM
tongue.gif (but I will probably have different sizes for difficulty levels)

kf's example would work.  But xml doesn't need an extra line tongue.gif

And I have a superstition xml is faster than just using tons of variables, for a 2d array (non-linear search as opposed to linear search, unless the variable routines do smart searching)

<ignore this>
1
--1
--2
--3
2
--1
--2
--3
3
--1
--2
--3

1_1
1_2
1_3
2_1
2_2
2_3
3_1
3_2
3_3
Title: Variables In Variable Names
Post by: geniusalz on June 02, 2004, 07:20:00 AM
In windows minesweeper, whenever a '0' box (without any adjacent mines) is clicked, a whole area 'opens up', for all adjacent '0' boxes.

Wondering how to do the recursion in script, without using an array as a makeshift stack to keep track of the recursion.  Any ideas?
Title: Variables In Variable Names
Post by: geniusalz on June 02, 2004, 06:07:00 PM
QUOTE
CStdString GetTrueEnvName( LPCTSTR szVar,  TMapStrings * pLocal )
{
...
  iPos = sReturn.Find( _T('{') );
  tcEndChar = _T('}');
   }
   if ( iPos > -1 )
   {
  // OK, find end bracket...
  int iEndPos = sReturn.ReverseFind( tcEndChar );