• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

GetWTSString

Status
Not open for further replies.
Level 2
Joined
Jul 24, 2007
Messages
199
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.

EDIT: 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_1235
where 1235 is the number of added string.

My 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.
 
Last edited:
Status
Not open for further replies.
Top