Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Chat / Virtual button held down but variable does not inc or dec even though in a Do/Loop

Author
Message
yoda333
5
Years of Service
User Offline
Joined: 3rd Apr 2012
Location:
Posted: 13th Aug 2017 05:21 Edited at: 13th Aug 2017 05:22
Hello
I have some virtual buttons that increment or decrement a variable when pressed once. If I hold down the button, I would like to continue changing the variables value
and sync the screen to reflect this. For some reason this doesn't appear to work correctly.

My website for testing is here
[href=http://webtesting4livesite.com/ ]http://webtesting4livesite.com/ [/href]
to get a better idea of what I'm trying to do.

Thanks yoda333

+ Code Snippet
fubarpk
AGK Developer
12
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 13th Aug 2017 06:28 Edited at: 13th Aug 2017 07:10
integer GetButtonState( index )

1 is returned if down 0 otherwise

and your code only needs one sync preferable just before the loop command
using sync that much will kill any frame rate

try something like the following
+ Code Snippet

also
Quote: "elseif isn't always the solution"

elseif is great if you have a new condition to check true
but for your example there is no point as its better to use
when there is multiple conditions and multiple states

+ Code Snippet

an example of when case cant be used and elseif is the better choice
+ Code Snippet

GOODLUCK with your project
fubar
yoda333
5
Years of Service
User Offline
Joined: 3rd Apr 2012
Location:
Posted: 13th Aug 2017 07:06
Thanks fubrpk

GetVirtualButtonState(1) = 1 does the trick.



Cheers
yoda333

Login to post a reply

Server time is: 2017-10-24 01:23:09
Your offset time is: 2017-10-24 01:23:09