Edikosh998 Posted February 16, 2012 Share Posted February 16, 2012 Hi guys, I've got a problem with my script. What I want to do is to show random pictures (skin pictures) but when timer stops, show a last picture where Label recognizes its skin. function on_pushButton_clicked(button,state) if button == "left" and state == "up" then local timer = setTimer(girar,500,10) local timerDos = setTimer(girarDos,5000,10) local numero = math.abs(math.random(1,24)) local numeroDos = math.abs(math.random(1,24)) if isTimer(timer) and isTimer(timerDos) then picture = guiCreateStaticImage(381,32,178,222,tablaImagen[numero],false,gui["_root"]) pictureDos = guiCreateStaticImage(32,32,178,222,tablaImagen[numeroDos],false,gui["_root"]) guiSetText(gui["label"],tablaSkins[numero]) guiSetText(gui["label_2"],tablaSkins[numeroDos]) end end end function girar() guiSetVisible(gui["imagen"],false) gui["imagen_3"] = guiCreateStaticImage(32,32,178,222,tablaImagen[math.abs(math.random(1,24))],false,gui["_root"]) end function girarDos() guiSetVisible(gui["imagen_2"],false) gui["imagen_4"] = guiCreateStaticImage(381,32,178,222,tablaImagen[math.abs(math.random(1,24))],false,gui["_root"]) end The problem here is that the label shows the skin of pictureOne and pictureTwo (that's what i want). However, picture one and two doesn't appear when the timer starts. Link to comment
Kenix Posted February 16, 2012 Share Posted February 16, 2012 I not understand what you mean local gui = { } local timer function on_pushButton_clicked(button,state) if button == "left" and state == "up" then local nRnd,nRnd2 gui[ "imagen_3" ] = guiCreateStaticImage( 32,32,178,222,tablaImagen[ math.random( 1,24 ) ) ],false,gui["_root"] ) gui[ "imagen_4" ] = guiCreateStaticImage( 381,32,178,222,tablaImagen[ math.random( 1,24 ) ],false,gui["_root"] ) guiSetVisible( gui["imagen_3"],false ) guiSetVisible( gui["imagen_4"],false ) if isTimer( timer ) then killTimer( timer ) end timer = setTimer( function( ) nRnd,nRnd2 = math.random( 1,24 ) ,math.random( 1,24 ) guiStaticImageLoadImage( gui[ "imagen_3" ],tablaImagen[ nRnd ] ) guiStaticImageLoadImage( gui[ "imagen_4" ],tablaImagen[ nRnd2 ] ) end, 1000, 10 ) guiSetVisible( gui["imagen_3"],true ) guiSetVisible( gui["imagen_4"],true ) guiSetText( gui["label"],tablaSkins[ nRnd ] ) guiSetText( gui["label_2"],tablaSkins[ nRnd2 ] ) end end Maybe you mean this. P.S table tablaSkins and tablaImagen defined? Link to comment
Edikosh998 Posted February 16, 2012 Author Share Posted February 16, 2012 Although it didn't work (because its says that at guiSetText argument 2 is not string), It's hard to explain what I want due to the fact that my english is not good. I'll try one more time. What I would like to do, is like a roll script where first of all...2 images shows random pictures every second. When timer finishes, both labels have to show the number of the skin of the last picture that its appear ( that's why i make 2 pictures for timer and 2 pictures represented as the last image) . If you didnt get it, nevermind. Thanks anyway. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now