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 Classic Chat / Assumed Command Mistakes

Author
Message
Increase
7
Years of Service
User Offline
Joined: 21st Feb 2017
Location:
Posted: 1st Oct 2019 15:24
M = CreateMemblock(1)

SetMemblockByteSigned(M,0,-128) : V1 = GetMemblockByteSigned (M,0)
SetMemblockByteSigned(M,0,128) : V2 = GetMemblockByteSigned (M,0)

Do : Print (V1) : Print (V2) : Sync() : Loop

// V1 Returns -127 instead of -128
// V2 Returns -128 instead of 127

___



Virtual Buttons Text Color can't be set

There seems to be a mistake in the variable assignment of virtual buttons, especially when buttons
are set active/inactive. E.g. when i clicked on button X, button Y was triggered after it was set inactive/active.
___

Next Loops leave wrong X Values :
e.g.
For x = 1 to 10 : Next x : Print (x) // Returns 11 instead of 10

___

Vertical Lines with DrawLine seem to be drawn wrong, and Draw Commands don't work on Android.

e.g.

DrawLine (10,10,20,10,ColorBeige,ColorBeige)
DrawLine (10,10,10,20,ColorBeige,ColorBeige)

sets the Y - Line one Pixel too high.




Worldwide optimal state system - ISBN 9783748157748
Weltweit optimales Staatssystem - ISBN 9783748159476
Loktofeit
AGK Developer
15
Years of Service
User Offline
Joined: 21st Jan 2009
Location: Sarasota, FL
Posted: 2nd Oct 2019 04:19
I didn't look at the other ones but that ForNext loop does exactly what you asked it to do.

Since the print statement is after the loop, it is returning the last number the loop comes to before exiting, which is 11.

If you had the print statement inside the loop, it would end at 10.
blink0k
Moderator
11
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 2nd Oct 2019 04:34 Edited at: 2nd Oct 2019 04:36
I agree with the V1 value. Documentation says the range is -128 to 127
The V2 value however is correct i think.

for/next is correct too

I would check your virtualresolution and Min/Mag filters as far as the lines are concerned.
Also colors with the newer versions require the alpha value so like this
AABBGGRR
Red is 0xFF0000FF
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 2nd Oct 2019 07:46
I know its been said
Quote: "For x = 1 to 10 : Next x : Print (x) // Returns 11 instead of 10"

but the reason for this returning 11 is because think of x being incremented by 1 until it is
greater than 10 that's is why it will print 11

fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Increase
7
Years of Service
User Offline
Joined: 21st Feb 2017
Location:
Posted: 2nd Oct 2019 09:23
@ loktofeit - Ok, i understand the "next" logic - But this was actually the only one where i thought opinions can split ; i just thought that the value should be limited to the given range ; but that's debateable and i am fine with the given explananition.

@ blink0k I don't the see the V2 value to be correct. Quote documentation -> " The given value will be truncated to the range -128 and 127. " - So when SetMemblockByteSigned(M,0,128) is set, V2 = GetMemblockByteSigned (M,0) should return 127 as it's the nearest, while SetMemblockByteSigned(M,0,-129) : V2 = GetMemblockByteSigned (M,0) should return -128 as it's the nearest.

I doubt it's About any filters - I checked an older AppGameKit Version on a seperate PC , and there occurs the same mistake - without any Settings beeing changed from the beginning - Did u try it ?
The used Colors include Alpha.

@fubarpk - see @ loktofeit
Worldwide optimal state system - ISBN 9783748157748
Weltweit optimales Staatssystem - ISBN 9783748159476
Increase
7
Years of Service
User Offline
Joined: 21st Feb 2017
Location:
Posted: 2nd Oct 2019 09:28
PS @ everyone : Don't try to pick the easiest one to teach ! Try to pick the hardest one to improve ! Otherwise AppGameKit will stay full of those small Bugs !
Worldwide optimal state system - ISBN 9783748157748
Weltweit optimales Staatssystem - ISBN 9783748159476
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 2nd Oct 2019 10:26 Edited at: 2nd Oct 2019 10:27
Quote: "So when SetMemblockByteSigned(M,0,128) is set, V2 = GetMemblockByteSigned (M,0) should return 127 as it's the nearest"

Actually it does return the nearest. This is a common thing in computer programming/logic and it is called overflow. If you look at a signed byte as a round analog clock that goes from -128 to 127, when it passes 127 it has gone a full round and will move on to -128, it can keep circling like this forever.

The For/Next loop thing, at For it will check if the value is within range, if it is, it will move on to the block inside the For/Next loop, when it hits next, it will increment the value with the specified increment, return to For which again will check if the value is within range. The reason why it is made like this is that something inside the For loop could also change the value that is being checked, not only the Next command can change the value.
13/0
Increase
7
Years of Service
User Offline
Joined: 21st Feb 2017
Location:
Posted: 2nd Oct 2019 11:29
That's proably because programmers tend to think too much in circles, because they didn't have sex in a while

SetMemblockByteSigned(M,0,-128) : V = GetMemblockByteSigned (M,0) -> should return 127 by this logic , but it Returns -127 still

This logic doens't ring true to me.

If I set SetMemblockByteSigned(M,0,-128) and it set -127 it's plain wrong.


Worldwide optimal state system - ISBN 9783748157748
Weltweit optimales Staatssystem - ISBN 9783748159476
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 3rd Oct 2019 09:52
I looks like a bug, setting SetMemblockByteSigned to -128 and reading it back gives -127, but setting it to 128 and reading it back gives -128. You should report this as a bug. I can confirm that I get the same result.
13/0
blink0k
Moderator
11
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd Oct 2019 11:13
It's all about the bits, 'bout the bits
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 3rd Oct 2019 11:39 Edited at: 3rd Oct 2019 11:43
Increase wrote: "
SetMemblockByteSigned(M,0,-128) : V1 = GetMemblockByteSigned (M,0)
SetMemblockByteSigned(M,0,128) : V2 = GetMemblockByteSigned (M,0)
Do : Print (V1) : Print (V2) : Sync() : Loop

// V1 Returns -127 instead of -128
// V2 Returns -128 instead of 127
"

Yes, confirmed, this is a bug in Wrapper.c (This can be seen on github)
The range of a signed byte should be -128 to 127

Existing Teir 2 C code @ Line 35800
if ( value > 128 ) value = 128; this Should be: if ( value > 127 ) value = 127;
if ( value < -127 ) value = -127; this should be: if ( value < -128 ) value = -128;

This explains the incorrect return of -128 for storing 128.

Increase wrote: "
Virtual Buttons Text Color can't be set
"

Not really a bug but a command to do that might be nice to have. Using sprites and texts to do buttons is another option,

Increase wrote: "
Next Loops leave wrong X Values :
"

This has been covered above and isnt a bug... the "next i" statement leaves i at 11

Increase wrote: "
Vertical Lines with DrawLine seem to be drawn wrong, and Draw Commands don't work on Android.
"


The draw commands do work on android on at least 4 different devices I have tried them on? What device is that doesnt draw lines?

The Y offset is an issue though and is something to do with compensating for the virtual resolution vs screen pixels and then rounding a result. It does look to be a bug to me too. The offset issue seems to be present on both windows and android.

Login to post a reply

Server time is: 2024-04-26 23:19:05
Your offset time is: 2024-04-26 23:19:05