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 / Function call from within another function

Author
Message
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 6th Dec 2012 22:27 Edited at: 6th Dec 2012 22:29
Hi,
Please run the following code:

The output is not correct. After the click the length of the vector length is calculated to 10.0. But it should be calculated to 1.0
If I change the function 'Normalize' as below then everything runs OK

but this is not good practice
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 6th Dec 2012 23:30
Calling functions from within functions works fine.

It is actually something screwy happening in the Vector2_Length function.

I tweaked your code to show different steps:


When you click the pointer, the testvec vector is set and it shows that the v.y value is changing to zero.

This is an issue related to passing a UDT variable twice. We've seen this intermittently and this bit of code shows the problem very nicely.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 7th Dec 2012 01:39 Edited at: 7th Dec 2012 02:28
I have to draw the same conclusion as Ancient lady.

My test code was a bit more extensive, but the findings are the same; in the nested call to "Vector2_Length", the Vector2.y value get's zapped for some reason -- a problem related to the UDT implementation in AGK.

Here's my test code (which I tested in AppGameKit 1076):


Here's a screenshot of the result:



This is another case demonstrating how flaky the UDT implementation in AppGameKit TIER1 Basic is.

I'd love to see this UDT issue fixed ASAP. I've encountered the same problem myself many times, which has caused me to avoid passing and returning UDT's to/from functions completely.

Another finding I happened to make, is that UDT's, like arrays, are given global scope, even when declared without the "global" keyword.

Here are some related reports from the AppGameKit issues list,
with my comments below:

http://code.google.com/p/agk/issues/detail?id=146
* Although stated as fixed in 107 series, definately NOT fixed in 1076.

http://code.google.com/p/agk/issues/detail?id=270
* Stated as fixed, yet appears NOT to be fixed.
* Perhaps someone should check these in the 108 beta series, and see if they ARE actually fixed or not. (I myself am still holding back on upgrading until a stable 108 release.)

Cheers,
AgentSam - the grumpy old software engineer who's very disappointed in AGK

Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Dec 2012 16:23
AgentSam, can you please post this as a bug in the google board with your code to demonstrate it?

Once you do, I'll get it onto the AppGameKit CT site and flag it as confirmed.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 7th Dec 2012 20:49
Ancient Lady, I just got back to checking this, and was about to post the issue, but I notice you already posted it. (Honestly, I was just going to do it, although I hate writing those reports.)

Thanks AL!

For completeness sake, here's a linkback to the issue entry:
Passing UDTs from one function to another STILL NOT WORKING

Sincerely,
AgentSam
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Dec 2012 20:50
No sweat. I just wanted to try my new bits on the AppGameKit CT site (better handling of code notations).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 4th Jan 2013 20:10
The issue still remains in the v1086

Login to post a reply

Server time is: 2024-11-24 06:21:01
Your offset time is: 2024-11-24 06:21:01