| 10-31-2006, 10:17 AM | #1 |
kay, the question is simple, how to convert a string into a rect ? i want to simpify this into a loop, thx JASS://On the left is the global variable, and on the right is the rect itself with the name of CreepCamp0X set udg_respawnsystem_Area[1] = gg_rct_CreepCamp01 set udg_respawnsystem_Area[2] = gg_rct_CreepCamp02 set udg_respawnsystem_Area[3] = gg_rct_CreepCamp03 set udg_respawnsystem_Area[4] = gg_rct_CreepCamp04 set udg_respawnsystem_Area[5] = gg_rct_CreepCamp05 set udg_respawnsystem_Area[6] = gg_rct_CreepCamp06 set udg_respawnsystem_Area[7] = gg_rct_CreepCamp07 set udg_respawnsystem_Area[8] = gg_rct_CreepCamp08 set udg_respawnsystem_Area[9] = gg_rct_CreepCamp09 set udg_respawnsystem_Area[10] = gg_rct_CreepCamp10 |
| 10-31-2006, 11:22 AM | #2 |
gg_rct_CreepCamp01
That is a global variable, and you can't splice globals' names such that you could loop them. So far as I'm aware, how you have it is the only way to do it. |
| 10-31-2006, 11:28 AM | #3 |
hmmph ic... i thought something like string2rect will work out, well guess not =| thanks !! |
| 10-31-2006, 11:30 AM | #4 |
Well.. I suppose that depends on what you're trying to do. If you need a rect to be a unique string, you can H2I() the rect and then I2S() the handle. That would give you a unique string for each rect. Notably, nothing in the code you posted suggests you even use strings. |
| 10-31-2006, 01:23 PM | #5 |
Your first post was correct on what he is trying to do. He would be wanting to do something like this: JASS:loop exitwhen i > 10 set udg_rect[i] = gg_Rect_CreepCamp+I2S(i) set i = i + 1 endloop And no, you can't do it :/ |
| 10-31-2006, 01:44 PM | #6 |
lol thats exactly what im trying to do, but it seems that all i was ended up to an error, so i came to confirm the stuff around here to proof that i'm wrong >_< |
| 10-31-2006, 06:29 PM | #7 |
You can use variables in strings through the value events.. who knows maybe you could pull something crazy off. |
