StarCraft® II

[HELP] Getting StringID from text variable

This is not converting text to string.

The problem:

I could really use a function (or be pointed in the right direction to find one, create one) to get a StringID (Param/Value) from a Text Variable.

At the moment, when you set a text variable it sets it to a Param/Value of random hex value.

I would like the ability to call the current Param/Value of a text variable and get it as a string.

What I am trying to do:

Create two sets of tooltips that are interchangable on the fly - a basic and advanced version of tooltips (like D3). It is possible but at the moment I have to create a text variable and then create another string variable and manually enter the Param/Value into it.

What I wish to do is to bypass the middleman and not have to create another set of string variables and update them manually everytime we add an ability.

That way I can use a Catalog field value set based upon the gamelink (array) and the corresponding (StringIDFromText(array)).

I thought I would be smart and create a global temp_text variable and set it to whatever I needed to set it as, and use the Param/Value/5419DC47 whenever needed. However, when you change the variable (set a new text value to it) it does not change that Param Value (as I presume it would have) and instead leaves it as default.

I have been working on this problem for a few hours and about half a dozen people have inputted ideas but as of yet we have yet to figure out a solution save the workaround mentioned above.

Thanks in advance :)

EDIT>>

It would look something like this:

Options Function;
Return Type; String
Parameters (text variable)

Get String ID from text

Return String
Edited by Dogmai on 10/31/2012 9:35 AM PDT
Reply Quote
I believe the following would be considered a better workaround and should work entirely. I double-checked most aspects of it before posting, but I've never implemented the whole thing in a published map. Some may consider it a better solution (even provided getting the string ID of a text variable were available) to your problem than what you're trying to do, but others would probably not.

You can create text items with arbitrary IDs (barring any character restrictions that probably exist, just follow how Blizzard does it and you should be safe.), if you open the text/string list in an external text editor. Simply use IDs matching a consistent format such as Unit/[UnitID]/TooltipBasic, Unit/[UnitID]/TooltipAdvanced, so you can computationally arrive at the appropriate text ID for whatever object you need to on the fly.

There are actually three different text list files that I'm aware of, namely ObjectStrings.txt, GameStrings.txt, and TriggerStrings.txt. I believe GameStrings is intended to be where text that will be visible in game is found, and may be the only one accessible at runtime. In other words, I would put my custom strings in GameStrings.txt to be most confident of success.

If you don't know this, save the map as Component Folder format to access the text list files. They should be under [locale].SC2Data/LocalizedData/ . They're just plaintext formatted very simplistically, and you will even be able to edit your arbitrary text strings in the Text Module after creating them, but for some reason IDs for text created directly from said Module are prescribed.

If this happens to be the same map where you had localization concerns, I imagine a mechanism similar to Xuzaca's answer applies here as well, which is probably organizationally advantageous and simpler trigger-wise compared to defining the texts as trigger variables when working with many locales.
Edited by TheFed on 10/31/2012 11:09 AM PDT
Reply Quote

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Forums Code of Conduct

Report Post # written by

Reason
Explain (256 characters max)
Submit Cancel

Reported!

[Close]