• 🏆 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!

[JASS] I2S does not work in AI script

Status
Not open for further replies.
Level 26
Joined
Feb 2, 2006
Messages
1,695
Hi,
I have this function defined in a custom common.ai:

JASS:
function NotifyOtherPlayers takes string message returns nothing
    call BlzDisplayChatMessage(Player(GetAiPlayer()), 0, message)
    call DisplayText(GetAiPlayer(), message)
endfunction

...

set expansions = GetLastData()
call NotifyOtherPlayers("I will build " + I2S(expansions) + " expansions!")

The chat message ingame will always show "I will build expansions!".
Why does the I2S not work in AI scripts?

The number of expansions can be sent as AI data from some GUI trigger. Is my only chance to show the correct number by moving the chat message to the GUI trigger instead of the AI script.

I am also not sure where the message goes with DisplayText?
 
Level 39
Joined
Feb 27, 2007
Messages
5,024
Probably needs to be defined in the script, just like how you can't use UnitAlive in normal scripts without re-defining it since it lives in common.ai. Add this to your custom common.ai:
JASS:
native I2S takes integer i returns string
I am also not sure where the message goes with DisplayText?
There are a few variants, too:
JASS:
native DisplayText    takes integer p, string str returns nothing
native DisplayTextI   takes integer p, string str, integer val returns nothing
native DisplayTextII  takes integer p, string str, integer v1, integer v2 returns nothing
native DisplayTextIII takes integer p, string str, integer v1, integer v2, integer v3 returns nothing
 
Status
Not open for further replies.
Top