Help - Search - Members - Calendar
Full Version: Variables In Variable Names
Scenyx Entertainment Community > Xbox1 Forums > Dashboard Forums > Official MediaXMenu (MXM) Forum > MXM WIP Beta forum
geniusalz
This doesn't seem to work:
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.
BenJeremy
Hmmmm.... I'll have to take a look at the parser for that.
koldfuzion
you could also use

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.
BenJeremy
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.
koldfuzion
im still an idiot.

updated sample to BJ's recommendation.


i can see that posing a problem with his code if the mine is set at "position" 11

not impossible to work around thoough.. would just have to do some string functions instead of IF# mine == 11


edit 4,222 : but not if the mine was set at position 1_1... still, a string comparison though. smile.gif
BenJeremy
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
koldfuzion
i didnt really think that far ahead. just tried to find somethng that worked.

but thats why you are in the drivers seat and the rest of us are chasing the car. smile.gif
flattspott
I ran into a similar issue in the FileManager.
geniusalz
I see what you mean about bad form, but by chance, I guess, I have a 10x10 board 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
geniusalz
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?
geniusalz
Third post.. oh well

Think it's this:

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 );
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.