I created a S2T converter, so Blizzard might as well add in a S2T function.
What this does: Allows you to convert String to Text, which has numerous useful functions.
How it's done:
Each letter has an integer value assigned to it with the exclusion of zeroes (they are number dividers).
So if i type in "abc", the conversion will convert that to "102030"
A bit more on the zeroes:
If I type in zbz, the game will give me 26 (z) 2 (b) 26 (z).
Now, you might think everything is fine.. But what happens when the searcher for a two finds the number "26". To the machine, it thinks it found a "2", but we don't need that. The zeroes prevent that.
Note: There are no numbers which contain a zero value which are linked to the letters.
But wait.. Another problem.
If I convert "zzzzz", the number will fk up!
That's because the number limits are −2,147,483,648 to 2,147,483,647 in sc2 and "zzzzz" generates "260260260260260", which causes it to flip over to the negative side, which fks the whole thing up.
So what this code does is essentially:
Get input from player
Dissect input to every 4 chars
Send those four chars through S2I then I2T (S2T)
Put together the chars
I am sleepy as hell, so I'll finish here (after uploading map and a screenie).
Hope you guys enjoy - and no need to give credit.
I didn't implement the periods, thats why they don't show
Just came back to mapping, they didn't have it back then so I thought to make it.. Guess i just wasted time.
I'll leave this on here for anyone who's interested though.
Just came back to mapping, they didn't have it back then so I thought to make it.. Guess i just wasted time.
I'll leave this on here for anyone who's interested though.
It was present from day 1, just TextToString is missing :)
Data Table - Save (Screen button 1) as "Value" in the Global data table
Variable - Set Text = (Text of ("Value" from the Global data table) for 1)
"Value" is a string, which can be read by text.
00:00:02.19 Trigger Error in 'gt_S2TCore_Func': Could not get 'text' from parameter in 'UIDisplayMessage' (value: 65535)
@obliviron: Go
Even if it should work, text is localized and might include different text for different players in the same game. Setting a string variable to such a converted text would probably desync the game in this case, causing strange bugs or immediate disconnects or even a crash.
Look man I haven't mapped in 8 months, this shit is blurry.
Also, for some reason it didn't upload to last post, should upload here.
Edit: Keuken, that may actually be beneficial.. back in wc3 they had maps where people had to do something or they were desynced, and now it is much easier to give people admin and vip statuses.
the task is to convert TEXTS to STRINGS, not the other way around.
in your map you convert a string (chat message) to a text with a strange method. everyone can do that with the string to text method.
I can see how he might be confused since the Convert Game Text function says it looks up the game string value
his input is a string and his output a text.
also its obvious that Convert Game Text returns a text because otherwise you could not even select that function when working with a text variable.
what Convert Game Text does is that it looks up the text value for the specified string path. its useful to read out ability tooltips for example.
Hello fellow Sc2mapians.
I created a S2T converter, so Blizzard might as well add in a S2T function.
What this does: Allows you to convert String to Text, which has numerous useful functions.
How it's done:
Each letter has an integer value assigned to it with the exclusion of zeroes (they are number dividers).
So if i type in "abc", the conversion will convert that to "102030"
A bit more on the zeroes:
If I type in zbz, the game will give me 26 (z) 2 (b) 26 (z).
Now, you might think everything is fine.. But what happens when the searcher for a two finds the number "26". To the machine, it thinks it found a "2", but we don't need that. The zeroes prevent that.
Note: There are no numbers which contain a zero value which are linked to the letters.
But wait.. Another problem.
If I convert "zzzzz", the number will fk up!
That's because the number limits are −2,147,483,648 to 2,147,483,647 in sc2 and "zzzzz" generates "260260260260260", which causes it to flip over to the negative side, which fks the whole thing up.
So what this code does is essentially:
Get input from player
Dissect input to every 4 chars
Send those four chars through S2I then I2T (S2T)
Put together the chars
I am sleepy as hell, so I'll finish here (after uploading map and a screenie).
Hope you guys enjoy - and no need to give credit.
I didn't implement the periods, thats why they don't show
Whats wrong with the StringToText() native? o_0
Just came back to mapping, they didn't have it back then so I thought to make it.. Guess i just wasted time.
I'll leave this on here for anyone who's interested though.
It was present from day 1, just TextToString is missing :)
oh haha..
ok thanks kuken
To everyone: I will update this with the reverse function once I get some sleep, It should be very easy.
Don't bother, I am pretty sure its impossible.
It would be very nice......
Maybe you were confused. There is a S2T native, but no T2S function.
Make a T2S and I be happy.
I am half done kueken, If you have opened the map you would see how it works and that it is possible.
Edit: yes, grenegg, kueken cleared that up for me
@obliviron: Go
Hurry up! I wanna save players names in banks!
EDIT: Even better! Give people named kezaron 20000000 minerals!
Checking another native..
Edit: You don't need T2S for giving people admin
Edit 2: Ok I found one -
Data Table - Save (Screen button 1) as "Value" in the Global data table
Variable - Set Text = (Text of ("Value" from the Global data table) for 1)
"Value" is a string, which can be read by text.
00:00:02.19 Trigger Error in 'gt_S2TCore_Func': Could not get 'text' from parameter in 'UIDisplayMessage' (value: 65535)
Still looking, chances are slim though.
dont waste your time, you cant convert texts to strings.
and yes, S2T existed since day 1.
and no, you dont store a string in the data table, you store a dialog item.
@obliviron: Go Even if it should work, text is localized and might include different text for different players in the same game. Setting a string variable to such a converted text would probably desync the game in this case, causing strange bugs or immediate disconnects or even a crash.
Ok, I found it.
Download map below for the thing. You can see that it takes one argument of text and one of string.
@Mille25: Go
Look man I haven't mapped in 8 months, this shit is blurry.
Also, for some reason it didn't upload to last post, should upload here.
Edit: Keuken, that may actually be beneficial.. back in wc3 they had maps where people had to do something or they were desynced, and now it is much easier to give people admin and vip statuses.
Edit 2: Now I can get some sleep..
@obliviron: Go
it seems like you are a little bit confused.
the task is to convert TEXTS to STRINGS, not the other way around.
in your map you convert a string (chat message) to a text with a strange method. everyone can do that with the string to text method.
I can see how he might be confused since the Convert Game Text function says it looks up the game string value
@obliviron: Go
Wrong map?
Edit: Naw, just really tired
his input is a string and his output a text.
also its obvious that Convert Game Text returns a text because otherwise you could not even select that function when working with a text variable.
what Convert Game Text does is that it looks up the text value for the specified string path. its useful to read out ability tooltips for example.
Wow.. I realize my mistake, my bad.
No, grenegg, I was confused with the (game text for (entered chat string)).
Looking for more ways.
Lock this thread and get yourself some sleep man.
Well at least get some sleep.