[SOLVED] How does KeyPress work?

Description: Internal scripting system of SMBX-38A Engine based on the simple VB-like language
Moderators: Lx Xzit, Yoshi021, 5438A38A, Semi-moderatos, Moderators

1gnacio25 M
Topic author, Good citizen
Good citizen
1gnacio25 M
Topic author, Good citizen
Good citizen
Age: 15
Reputation: 24
Posts: 31
Joined: 15 Mar 2021

Post #1by 1gnacio25 » 18 Jun 2021, 17:40

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
Last edited by 1gnacio25 on 23 Jul 2021, 6:35, edited 1 time in total.
Image

Victor ManuelMR M
Count
Count
Avatar
Victor ManuelMR M
Count
Count
Age: 21
Reputation: 155
Posts: 241
Joined: 7 Feb 2018

Post #2by Victor ManuelMR » 18 Jun 2021, 21:03

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
Image
[1.4.5] - Dream Team at The Challenging Portals:
Image


Return to “TeaScript”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest