| 01-26-2007, 06:22 AM | #1 |
Is it? I want something like if mapname()="(4)LostTemple" |
| 01-26-2007, 08:45 AM | #2 |
function I2Sx takes integer I returns string return I return 0 endfunction string Id is 3 |
| 01-26-2007, 08:46 AM | #3 |
It's not possible to detect it, however melee maps (I assume this is what you want it for) have it stored as one of the strings in the table. This means you can easily get it, but the problem is that the actual id varies from map to map. Well anyway if you really need this you can always loop through first 100 strings using the function from the post above checking if any of them matches the map name you want and set some boolean value there so that you can check it later. |
| 01-26-2007, 01:20 PM | #4 |
map name always have id 3... or 4 any way in in first 7 strings |
| 01-26-2007, 01:50 PM | #5 |
Not really from what I see... Lost Temple has it set to 10. |
| 01-26-2007, 02:21 PM | #6 |
It seems like you're talking about two different tables. The jass string table is the one DioD is referring to and his idea should work if the map name is the first string created when the Jass VM runs. The WTS string table can have the map name at any position so it is not as reliable. (i.e if you modify the names of some units before changing the name of the map) |
| 01-26-2007, 03:13 PM | #7 | |
Quote:
Well I'm just going to use it for melee map A.I so yeah. You're suggesting that I loop through the first 100 data in the memory? What table are you talking about? EDIT : I just tried to loop a little bit of data and it seems that it displays ALL of my A.I's data, and not the map's... *sigh* and it made Warcraft crash after certain point and quit. JASS:set i = 0 loop call DisplayDebugPlain(I2Sx(i)) call Sleep(1) set i = i + 1 exitwhen i == 100 endloop |
| 01-26-2007, 05:44 PM | #8 |
Most of the times, Diod 's method is right. But it is also possible to use what WEU does to detect author/string etc, using "TRIGSTR_" I actually doubt diod's method would ever fail unless you have a custom config function (which probably never happens) or blizzards updates blizzard.j (hell freezes) |
| 01-26-2007, 05:47 PM | #9 |
Isn't the name of a map, you know, a constant throughout an entire game of a map? So couldn't you know... Type it in normally? Or am I completely missing the use of this? |
| 01-26-2007, 05:50 PM | #10 |
I would dare to say that it is some sort of 'protection' you can blame him, I once got the same idea, found the way to do it and Pitzermike copied it and added to WEU. It could also be a pretty odd thing to do in a campaign. |
| 01-26-2007, 06:29 PM | #11 |
It's not a protection, I'm going to use it for a MELEE A.I (similar to AMAI) so I don't get to modify the map itself. That's why I need to know what map the A.I plays so I can adjust strategies specific to that map. That's all I need. Unfortunately, I don't know how to do it. |
| 01-27-2007, 06:11 AM | #12 |
Anyone? It would help immensely if I could do this. DioD's method only returns the A.I's own strings, and not the map's. |
| 01-27-2007, 10:56 AM | #13 |
If it is for AI then you are kind of screwed since it can't use TRIGSTR either As far as I know, AMAI needs a custom blizzard.j so you should try Diod's thing there. |
| 01-27-2007, 04:47 PM | #14 |
Well apparently, the TRIGSTR_ strings display fine but is stored as TRIGSTR and not the real name of the map. This function always return "GOT IT!!!!" even on Lost Temple or some other map. JASS://=========================================================================== function InitZAI takes nothing returns nothing local integer i = 0 local boolean exitLoop = false local string s loop set s = I2Sx(i) if s == "Twisted Meadows" then call DisplayDebugPlain("GOT IT!!!!!!!!!!!!!") set exitLoop = true elseif s == "Lost Temple" then call DisplayDebugPlain("FOUND TEMPLE!") set exitLoop = true endif set i = i + 1 exitwhen i == 50 exitwhen exitLoop endloop endfunction |
| 01-27-2007, 06:05 PM | #15 |
To use TRIGSTR you first have to work around using the SetPlayerName native (you may temporarily use it on Player(14) |
