AceHart
Your Friendly Neighborhood Admin
- Reaction score
- 1,495
> At least you can delete that part of my post so I don't look like a fool
You sure that would help?
FWIW, here's a version using a "globals" block:
Clearly inferior to the all-in-one version.
> I fail to see how Ace code works
That's because it's Ace code...
The reason why the approach in post #4 can't work is because it ignored the following basic fact:
You need the code as data, and show it once as code and once inside itself.
Basically, a recursive display that reconstructs both the code (function) and the data (string) from just the data.
An additional difficulty is using " inside a string, and, worse, using \ inside a string.
Both need escaping.
And, well, when displaying that, it needs even more escaping...
Hence the abuse on substrings.
Still, with a bit of sitting down and thinking it through (i.e. start counting characters)...
" Never let the one that says it can't be done interrupt the one who's doing it. "
You sure that would help?
FWIW, here's a version using a "globals" block:
JASS:
globals
string s="globals
string s=\"\\
endglobals
function F takes nothing returns nothing
call DisplayTextToPlayer(GetLocalPlayer(),0,0,SubString(s,0,18) + SubString(s,0,17) + SubString(s,18,19) + SubString(s,17,19) + SubString(s,18,999) + SubString(s,17,18) + SubString(s,19,999))
endfunction"
endglobals
function F takes nothing returns nothing
call DisplayTextToPlayer(GetLocalPlayer(),0,0,SubString(s,0,18) + SubString(s,0,17) + SubString(s,18,19) + SubString(s,17,19) + SubString(s,18,999) + SubString(s,17,18) + SubString(s,19,999))
endfunction
Clearly inferior to the all-in-one version.
> I fail to see how Ace code works
That's because it's Ace code...
The reason why the approach in post #4 can't work is because it ignored the following basic fact:
You need the code as data, and show it once as code and once inside itself.
Basically, a recursive display that reconstructs both the code (function) and the data (string) from just the data.
An additional difficulty is using " inside a string, and, worse, using \ inside a string.
Both need escaping.
And, well, when displaying that, it needs even more escaping...
Hence the abuse on substrings.
Still, with a bit of sitting down and thinking it through (i.e. start counting characters)...
" Never let the one that says it can't be done interrupt the one who's doing it. "