Jump to content

Alpha Set :D


#Paper

Recommended Posts

Posted

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

Posted

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 

  • Moderators
Posted
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 :wink:

Posted
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?

  • Moderators
Posted

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 ??

Posted
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

  • Moderators
Posted

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 :mrgreen:

And it was not rather fluid so a modified it for you :D :

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

Posted
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 :mrgreen:

And it was not rather fluid so a modified it for you :D :

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"? xD

  • Moderators
Posted

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 ^^

Posted
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 :D

P.S: Have you skype?

  • Moderators
Posted

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 )

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...