Product Chat / Scancode and P. Is it a BUG

Author
Message
Mortt
8
Years of Service
User Offline
Joined: 16th May 2016
Location:
Posted: 22nd Jan 2017 11:53
Hi all.
I am setting up, or rather trying to set up key "P" to display sprite
code is simple
If GetScancode == 25 then
SetSpritePosition(left_hand, 10,50)

But it is not working.
I have same for main_map using "M" and it works fine.
Whats wrong?

Is it a BUG or another BUG.
Don't understand why P doesnt work.

Any help would be appreciated.
(Custom) Intel i7 3.3 Mhz. 16 GB fast ram. EVGA Nvidia 560 Ti 4GB. Dell US27 2560 x 1440. AOC 24 1920 x 1080. Awesome.
Next G. Card EVGA GeForce GTX 970 Superclocked ACX 2.0 Gaming 4GB GDDR5 PCIe3.0 Graphics Card.
Would Like EVGA NVIDIA GeForce GTX 1080 8GB GDDR5X PCIe3.0 Graphics Card
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 22nd Jan 2017 14:21
I've tried this code and it works; notice your missing () in "GetScancode" statement, it should be "GetScancode()"



hth

3com

Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 22nd Jan 2017 15:09
Small tipp: Vars should never start with Set or Get. this are most of the time functions and need () at the end.
So it should be
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
Mortt
8
Years of Service
User Offline
Joined: 16th May 2016
Location:
Posted: 22nd Jan 2017 15:09
I can get the "P" scan code
but it will not display the sprite.
The "M" code 50, works perfect
but the "P" doesnt.

Code below
[_code]
if GetScancode() == 50 then -- "M"
SetSpritePosition(main_mapspr, 40,60)
if GetScancode() == 25 then
SetSpritePosition(left_handspr, 10,50) --"P"
[_/code]
(Custom) Intel i7 3.3 Mhz. 16 GB fast ram. EVGA Nvidia 560 Ti 4GB. Dell US27 2560 x 1440. AOC 24 1920 x 1080. Awesome.
Next G. Card EVGA GeForce GTX 970 Superclocked ACX 2.0 Gaming 4GB GDDR5 PCIe3.0 Graphics Card.
Would Like EVGA NVIDIA GeForce GTX 1080 8GB GDDR5X PCIe3.0 Graphics Card
PM
Mortt
8
Years of Service
User Offline
Joined: 16th May 2016
Location:
Posted: 22nd Jan 2017 15:25
Sorted.

Simple mistake.

Had the two If without end untill the end of script.
So it was reading the first If then it saw the second IF as part of the same.
So it did not excecute the second If. As no END was after the first IF.

Works perfectly now. Cool
Thanks for your guys input. It helped me to scan through my code and spot the error.
(Custom) Intel i7 3.3 Mhz. 16 GB fast ram. EVGA Nvidia 560 Ti 4GB. Dell US27 2560 x 1440. AOC 24 1920 x 1080. Awesome.
Next G. Card EVGA GeForce GTX 970 Superclocked ACX 2.0 Gaming 4GB GDDR5 PCIe3.0 Graphics Card.
Would Like EVGA NVIDIA GeForce GTX 1080 8GB GDDR5X PCIe3.0 Graphics Card
PM

Login to post a reply

Server time is: 2024-11-24 18:34:38
Your offset time is: 2024-11-24 18:34:38