| 07-19-2009, 10:31 AM | #1 |
Hi, I need a function that retrieves string data from the wts file (you know, "TRIGSTR_####"). I used this one: JASS:function Sweep takes integer i returns string call SetPlayerName(Player(12), "TRIGSTR_"+I2S(i)) return GetPlayerName(Player(12)) endfunction (supposed i>99) but it fails on long strings. The "TRIGSTR_####" string must contact with user interface to turn into its wts data - be displayed or set into such place where user can see it. QuestSetTitle, LeaderboardSetLabel etc. Tried to set/get leaderboard and multiboard titles, but they also fail. If I could get quest description, or what... Maybe I can use something like GetObjectName or GetLocalizedString in some special way? And, saving into gamecache also didn't work... Help please. |
| 07-19-2009, 10:39 AM | #2 |
Try something like this JASS:function GetWTSString takes integer x returns string return x+1 return null endfunction It'll fail when new patch comes out tho |
| 07-19-2009, 10:44 AM | #3 |
get localized string do its job Bobo_The_Kodo Patch have stringhash functons, soo, with little modifications it will work anyway. |
| 07-19-2009, 08:01 PM | #4 |
Sorry. This function actually works for all strings. The problem was the way I modified the .wts file, so I'll tell how to do it properly to avoid wasting time by other dudes like me. So, to add a string to your wts file, you do the following. 1. In WE, File > Export text and save it as wts file. 2. Open this file with a text editor (notepad, wordPad, word or whatever you like). 3. The file consists of such data: Code:
STRING 1234
{
Text
}Scroll to the end of file and add a string to it, with the number equal to number of last found string + 1. Save the file. 4. In WE, File > Import text and select your modified file. 5. IMPORTANT! If you save your map just now, the added string may disappear because you didn't use it anywhere. So, add somewhere a commented text like this: JASS: // TRIGSTR_1235My function Sweep allows me to avoid typing "TRIGSTR_####" in the map script, so WE doesn't know whether I use the triggerstring of a certain number. |
