#Paper Posted March 3, 2011 Share Posted March 3, 2011 I want to make a funny window: function setMajorAlpha () local getAlpha = guiGetAlpha(wndShop) guiSetAlpha(wndShop, tonumber(getAlpha + 0.1)) end function setMinorAlpha () local getAlpha = guiGetAlpha(wndShop) guiSetAlpha(wndShop, tonumber(getAlpha - 0.1)) end function ShowHide (key, keyState) local getAlpha = guiGetAlpha(wndShop) if getAlpha == 0.1 then setTimer(setMajorAlpha, 500, 6) elseif getAlpha == 0.6 then setTimer(setMinorAlpha, 500, 6) end end bindKey("F10", "down", ShowHide) When i press F10 the Alpha doesn't changes it's the same: 0.1 Link to comment
Castillo Posted March 3, 2011 Share Posted March 3, 2011 Any errors? i'm lazy right now. Link to comment
Nikula Posted March 4, 2011 Share Posted March 4, 2011 What's the problem excatly, is the window opening? Do /debugscript 3 in your server, and post the errors there. Link to comment
Wojak Posted March 4, 2011 Share Posted March 4, 2011 Did you set the default alpha? guiSetAlpha(wndShop, 0.6)) after wndShop cteation also try to secure the condition more if getAlpha <= 0.1 then setTimer(setMajorAlpha, 500, 6) elseif getAlpha >= 0.6 then setTimer(setMinorAlpha, 500, 6) end Link to comment
Moderators Citizen Posted March 6, 2011 Moderators Share Posted March 6, 2011 Did you set the default alpha? guiSetAlpha(wndShop, 0.6)) after wndShop cteation also try to secure the condition more if getAlpha <= 0.1 then setTimer(setMajorAlpha, 500, 6) elseif getAlpha >= 0.6 then setTimer(setMinorAlpha, 500, 6) end I'm agree, if you put an outputChatBox( "Alpha: "..getAlpha ), you will can noticed that it's not exactly 0.6 or 0.1 but something like 0.599863 or IDK So the Alpha is never exactly 0.6 or 0.1 Wojak is right, but change a little thing: if getAlpha <= 0.13 then setTimer(setMajorAlpha, 500, 6) elseif getAlpha >= 0.57 then setTimer(setMinorAlpha, 500, 6) end It's more secure like that Link to comment
#Paper Posted March 6, 2011 Author Share Posted March 6, 2011 if getAlpha <= 0.13 then setTimer(function () guiSetAlpha(wndShop, getAlpha + 0.1) end, 500, 6) elseif getAlpha >= 0.57 then setTimer(function () guiSetAlpha(wndShop, getAlpha - 0.1) end, 500, 6) end This can works? Link to comment
Moderators Citizen Posted March 6, 2011 Moderators Share Posted March 6, 2011 I don't know I never this kind of script. but I think that you ave to put a ; after your guiSetAlpha But why you can't test it yourself ?? Link to comment
#Paper Posted March 6, 2011 Author Share Posted March 6, 2011 I don't know I never this kind of script.but I think that you ave to put a ; after your guiSetAlpha But why you can't test it yourself ?? I have some problems whit my Video Card... T_T Link to comment
Moderators Citizen Posted March 6, 2011 Moderators Share Posted March 6, 2011 (edited) lol ok so I'm gonna test it for you Edited March 6, 2011 by Guest Link to comment
Moderators Citizen Posted March 6, 2011 Moderators Share Posted March 6, 2011 So I test it and it works but I changed 2 things ( and we don't need the ; ^^ ): You have to get the Alpha each time instead of the variable getAlpha because if the getAlpha value is ( for exemple ) 0.3, the server gona make guiSetAlpha(wndShop, 0.3+ 0.1) So the Alpha is always 0.4 do you understand ? I'm sure that you understand And it was not rather fluid so a modified it for you : setTimer(function () guiSetAlpha(wndShop, guiGetAlpha( wndShop )+0.02) end, 100, 30) and setTimer(function () guiSetAlpha(wndShop, guiGetAlpha( wndShop )-0.02) end, 100, 30) It works perfectly on my own server Link to comment
#Paper Posted March 7, 2011 Author Share Posted March 7, 2011 So I test it and it works but I changed 2 things ( and we don't need the ; ^^ ):You have to get the Alpha each time instead of the variable getAlpha because if the getAlpha value is ( for exemple ) 0.3, the server gona make guiSetAlpha(wndShop, 0.3+ 0.1) So the Alpha is always 0.4 do you understand ? I'm sure that you understand And it was not rather fluid so a modified it for you : setTimer(function () guiSetAlpha(wndShop, guiGetAlpha( wndShop )+0.02) end, 100, 30) and setTimer(function () guiSetAlpha(wndShop, guiGetAlpha( wndShop )-0.02) end, 100, 30) It works perfectly on my own server ye i understand and i fixxed it, but, why i can't set the time of the timer under "50"? Link to comment
Moderators Citizen Posted March 7, 2011 Moderators Share Posted March 7, 2011 have you see this on the wiki ? I think it's because the internal clock of the server is maybe 50 ms ? So 1 cycle = 50 ms But I'm not sure ^^ Link to comment
qaisjp Posted March 7, 2011 Share Posted March 7, 2011 lol, I wonder, Why do people put the ";"? Link to comment
proracer Posted March 7, 2011 Share Posted March 7, 2011 Because people first used C++ or any other similiar programming language but you can write it in Lua too if you want. Link to comment
#Paper Posted March 7, 2011 Author Share Posted March 7, 2011 have you see this on the wiki ?I think it's because the internal clock of the server is maybe 50 ms ? So 1 cycle = 50 ms But I'm not sure ^^ Ty P.S: Have you skype? Link to comment
Moderators Citizen Posted March 7, 2011 Moderators Share Posted March 7, 2011 No I don't have skype because I have some problems with my Network when I call a guy. But I have mumble with a local server ( if you want to speak in your mic ) and msn ( see my profile ) 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