Pipee20k Posted March 22, 2015 Posted March 22, 2015 Quiero hacer que aparezca un texto y se vaya escribiendo letra por letra hasta completarse. Algo como. T Te Tes Test Obviamente todo en la misma línea pero la idea es que el texto vaya apareciendo carácter por carácter; no sé si se entienda bien esto u.u
Tomas Posted March 22, 2015 Posted March 22, 2015 str = "Test" for i = 1,str:len() do print(str:sub(i)) end
Pipee20k Posted March 22, 2015 Author Posted March 22, 2015 ¿Me explicarías brevemente como utilizarlo con un DxDrawText?
Castillo Posted March 22, 2015 Posted March 22, 2015 Hice esta funcion para alguien que tambien me pregunto lo mismo hace tiempo, no se si aun funcionara. local texts = { } function dxDrawTextPerLetter ( text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, delay ) if ( not texts [ text ] ) then texts [ text ] = { index = 1, lastUpdate = getTickCount ( ) } end if ( texts [ text ] ) then dxDrawText ( text:sub ( 1, texts [ text ].index ), left, top, right, bottom, color or tocolor ( 255, 255, 255, 255 ), scale or 1, font or "default", alignX or "left", alignY or "top", clip, wordBreak, postGUI, colorCoded, subPixelPositioning ) if ( getTickCount ( ) - texts [ text ].lastUpdate >= ( delay or 60 ) ) then texts [ text ].index = ( texts [ text ].index + 1 ) texts [ text ].lastUpdate = getTickCount ( ) end end end Y para probarla: local sx, sy = guiGetScreenSize ( ) addEventHandler ( "onClientRender", root, function ( ) dxDrawTextPerLetter ( "Testing the function", 0, 0, sx, sy / 2, false, false, false, false, false, false, false, false, false, false, 50 ) end )
Bc# Posted March 24, 2015 Posted March 24, 2015 ¿No seria mas cómodo poner el delay de primer argumento? Quizá confundiría un poco pero te evitas tener que poner muchos argumentos innecesarios.
Castillo Posted March 24, 2015 Posted March 24, 2015 No es una funcion publica, la hice para alguien hace tiempo y asi quedo, si la queres con el delay de primer argumento, entonces lo cambias.
Recommended Posts