- Joined
- Dec 11, 2014
- Messages
- 2,004
JASS:
function Talk takes string s, unit u, real dur, sound snd returns nothing
local integer slength = StringLength(s)
local integer i = GetUnitTypeId(u)
local integer i2 = 0
local integer i3 = 1
local timer t = CreateTimer()
local string news = "\n\n\n\n\n\n" + s + "\n\n\n\n\n\n\n\n\n\n\n\n"
if slength > 50 then
set i2 = R2I(I2R(slength) / 50)
loop
exitwhen i3 > i2
set news = SubString(news, i3 - 1, i3 * 50) + "\n" + SubString(news, i3 * 50, slength)
set i3 = i3 + 1
endloop
endif
//native DisplayTimedTextToPlayer takes player toPlayer, real x, real y, real duration, string message returns nothing
call DisplayTimedTextToPlayer(Player(0), 0.8, 0.1, dur, news)
//native SetCinematicScene takes integer portraitUnitId, playercolor color, string speakerTitle, string text, real sceneDuration, real voiceoverDuration returns nothing
call SetCinematicScene(i, PLAYER_COLOR_RED, null, null, dur, dur)
//call TransmissionFromUnitWithNameBJ(GetPlayersAll(), u, null, snd, null, bj_TIMETYPE_SET, dur, false)
call TimerStart(t, dur, false, function ClearTextMessage)
set t = null
set news = null
endfunction
This is one of my first tries on JASS, I'm still a Noob
Alright.
If I type in:
-
Custom script: call Talk("Gear Beard meh bleh feh da google addict :D I saw sb sbing sb lolz meh feh da sup :Der heh yoblow yubuslaviu cake i <3 it thralla w00t dat jury. Zoo!", gg_unit_H000_0012, 100.00, null)
It will return:
How can i fix it? As you see it seems a bit random, and instead of creating a Line Break in 50 letters, it's in 44-47 IIRC.
Any help is highly appreciated.