Page 1 of 1

[SOLVED] How does KeyPress work?

Posted: 18 Jun 2021, 17:40
by 1gnacio25
Im making an script that makes a variable change value when a key is pressed, but when i press it, nothing happens. I already activated the script via events and still nothing.

Code: Select all

if char(1).alive = 1 and keypress(-18) then
if val(Counter) = 5 then
val(Counter) = 4
end if
end if

Posted: 18 Jun 2021, 21:03
by Victor ManuelMR
1gnacio25 wrote:Im making an script that makes a variable change value when a key is pressed, but when i press it, nothing happens. I already activated the script via events and still nothing.

Code: Select all

if char(1).alive = 1 and keypress(-18) then
if val(Counter) = 5 then
val(Counter) = 4
end if
end if

The Right would be this:

Code: Select all

if char(1).alive = 1 and keypress(-18) = -1
if val(Counter) = 5 then val(Counter) = 4
end if


Only when the keypress is alone :

Code: Select all

 if keypress(-18) then
 'code
 end

Or

Code: Select all

 if keypress(-18) = -1 then
 'code
 end