[Request?]So is there something in TeaScript that detects keys?

Description: Have idea for a script, but you can't make it? Post it here!
Moderators: Yoshi021, Lx Xzit, 5438A38A, Semi-moderatos, Moderators

Avian947
Topic author, Passerby
Passerby
Avian947
Topic author, Passerby
Passerby
Reputation: 0
Posts: 2
Joined: 9 Sep 2016

Post #1by Avian947 » 9 Sep 2016, 15:54

I downloaded the 1.4.3 update and found the example levels also updated. The one in the 'Read Only Level' folder showing a key detection feature drew my attention. I have been looking for a key-detecting function for a long time, and unlike the tetris level, this level doesn't lock the player's position thus might have used a more direct way to detect keys. (additionally, this level can detect much more keys than just arrow keys!)
The level is locked so I can't see the scripts, but I'm pretty confident that this level used some scripts with (intentionally?) undocumented variables or functions and I'm now trying to guess them on my own and the following names are confirmed to be INCORRECT.

Code: Select all

Sysvals:
sysval(key)
sysval(keypressed)
sysval(pressedkey)
sysval(player1key)
sysval(keydown)
sysval(keyA)
sysval(keyB)
...
sysval(keyZ)
Player properties: (a kinda silly try)
Char(1).key
Char(1).keypressed
Char(1).pressedkey
Char(1).keydown
Functions:
(not tested yet)


I wonder if anyone on this forum did some similar researches on this. :hi:

UPDATE
The function has been found.(Thanks to Catskart!!!)
viewtopic.php?p=8348#p8348
Last edited by Avian947 on 12 Sep 2016, 13:41, edited 1 time in total.

Catskart M
Count
Count
Avatar
Catskart M
Count
Count
Age: 20
Reputation: 144
Posts: 260
Joined: 29 Nov 2015
Location: France

Post #2by Catskart » 9 Sep 2016, 20:13

I don't like this mentality to hide always more things who are unlockable by hard minigames. (It was fun the firsts time, but now it's annoying that don't use these features because we haven't fitness or time about mathematic or enigma...)
Sorry for the rude post but when a feature which you want since long month ago and finnaly it unlockable by minigame, that's what.

Avian947
Topic author, Passerby
Passerby
Avian947
Topic author, Passerby
Passerby
Reputation: 0
Posts: 2
Joined: 9 Sep 2016

Post #3by Avian947 » 10 Sep 2016, 4:18

Catskart wrote:I don't like this mentality to hide always more things who are unlockable by hard minigames. (It was fun the firsts time, but now it's annoying that don't use these features because we haven't fitness or time about mathematic or enigma...)
Sorry for the rude post but when a feature which you want since long month ago and finnaly it unlockable by minigame, that's what.
I assume key detection is probably not unlocked by minigames. Accidentally, I found the TxtCreate function exists and works fine in version 1.4 (original), far before the release of script example levels. Maybe (hopefully) it is just an undocumented feature hidden by developers for some reason.
BTW, why there are so many encryption thingies in the game? Minigames, map packaging, hidden functions and now read-only levels. We even constantly receive updates for them!

Catskart M
Count
Count
Avatar
Catskart M
Count
Count
Age: 20
Reputation: 144
Posts: 260
Joined: 29 Nov 2015
Location: France

Post #4by Catskart » 11 Sep 2016, 19:17

Okay, so it took me some hours (Key=A, Keypressed=S, Key(A)=1...) , But I found this function by chance. :shout:
So, the syntax is

Code: Select all

KeyPress(Key)
where "Key" is the ASCII value for keys.
To example, "If KeyPress(65) then" it's "If player press A key".

But I found only the keys of keyboard, I don't found the value of SMBX input.

EDIT : I discovert something with KeyPress !

KeyPress(-1) is the X position of the mouse pointer.
KeyPress(-2) is the Y position of the mouse pointer.
Last edited by Catskart on 11 Sep 2016, 23:03, edited 1 time in total.

Lx Xzit M
Moderator
Moderator
Avatar
Lx Xzit M
Moderator
Moderator
Reputation: 254
Posts: 578
Joined: 9 Nov 2015
Website

Post #5by Lx Xzit » 11 Sep 2016, 22:51

I tried that ^ but it will cause this error "Syntax error in the expression"
I've noticed something interesting:

Code: Select all

if keypress() then


This code won't causes errors in the game, however, whatever I insert in the parenthesis don't seems work. I guess this case is similar to the statuses: if you insert a wrong value the game will ignore it without causing error. So I think this code leads to something.
VISIT MY YOUTUBE CHANNEL! LX XZIT
Join our 38A Discord server!

Image

Catskart M
Count
Count
Avatar
Catskart M
Count
Count
Age: 20
Reputation: 144
Posts: 260
Joined: 29 Nov 2015
Location: France

Post #6by Catskart » 11 Sep 2016, 22:54

It's not keypress but PRESSKEY.
You should add an ASCII value to select keys.
Last edited by Catskart on 11 Sep 2016, 23:06, edited 1 time in total.

Lx Xzit M
Moderator
Moderator
Avatar
Lx Xzit M
Moderator
Moderator
Reputation: 254
Posts: 578
Joined: 9 Nov 2015
Website

Post #7by Lx Xzit » 11 Sep 2016, 22:57

I tried with the code "Presskey" and this happened:
Image
This is what I meant
VISIT MY YOUTUBE CHANNEL! LX XZIT
Join our 38A Discord server!

Image

Catskart M
Count
Count
Avatar
Catskart M
Count
Count
Age: 20
Reputation: 144
Posts: 260
Joined: 29 Nov 2015
Location: France

Post #8by Catskart » 11 Sep 2016, 23:05

Holy sh*t, I was wrong with the syntax. :facepalm:
Yes it's Keypress.


Return to “Script requests”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest