I have an input screen thats dynamically generated, looks like...
junkVar||Set the number for each spell to memorize|LABEL|TEXT=FALSE##0spellIndex|1|Charm Monster|TEXT|WIDTH=6##1spellIndex|0|Cure Serious Wounds|TEXT|WIDTH=6##2spellIndex|2|Dispel Magic|TEXT|WIDTH=6##3spellIndex|0|Displacement|TEXT|WIDTH=6##4spellIndex|0|Fireball|TEXT|WIDTH=6##5spellIndex|0|See Invisibility|TEXT|WIDTH=6##6spellIndex|0|Terrible Remorse|TEXT|WIDTH=6##7spellIndex|0|Unadulterated Loathing|TEXT|WIDTH=6
...and this displays just fine. However, after I press okay, I want to cycle through each of the "1spellIndex", "2spellIndex", etc, etc variables and do something with whatever the user entered.
But I get an error when I even try to do..
[broadcast(1spellIndex)]
...let alone try to cycle through each of them. I know how many there are to cycle through, given the users input, so I'm not worried about trying to access, say, "7spellIndex" if it only goes up to 6.
Is there a way to skin this cat that I'm not seeing? Thanks!
Input not returning variables
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
Re: Input not returning variables
Try changing the name format. I don't know if this is the problem but standard variable naming practice is to not use a number as the first character.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Input not returning variables
I'll give that a whirl, thanks!
Re: Input not returning variables
Had to do some additional tweaking, but got it all squared away...thanks!
Re: Input not returning variables
Hmmm...revisiting this thread, sorry about that.
I have this generating right, the input screen shows up just fine...
[h : inputStr = inputStr + "##si" + indexCounter + "|" + skillValue + "|" + skill + "|TEXT|WIDTH=3"]
...but I can't access the variables that get generated, not dynamically anyway.
So I can call...
[r : si6]
...and get back what I had entered in this variable in the input box. But I can't do...
[FOR(i,0,indexCounter), code : {
[r : "si" + i]
}]
...and of course, i get back "si1", "si2", etc, etc....NOT what was set in these variables.
Is there a way to achieve this?
I have this generating right, the input screen shows up just fine...
[h : inputStr = inputStr + "##si" + indexCounter + "|" + skillValue + "|" + skill + "|TEXT|WIDTH=3"]
...but I can't access the variables that get generated, not dynamically anyway.
So I can call...
[r : si6]
...and get back what I had entered in this variable in the input box. But I can't do...
[FOR(i,0,indexCounter), code : {
[r : "si" + i]
}]
...and of course, i get back "si1", "si2", etc, etc....NOT what was set in these variables.
Is there a way to achieve this?
Re: Input not returning variables
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Input not returning variables
Thank you!!! Didn't realize eval worked for this kind of scenario! Perfect!