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 / Does a function have a maxumum of 9 parameters?

Author
Message
Abiz
11
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 8th Dec 2012 02:09
Looks like it.
With 10 args it ignores the 10th, and with 11 args it crashes Windows.

I had this:


And I just didn't understand why 'sensor' was always empty. Until I removed the 'visible' argument, and then it worked.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 8th Dec 2012 02:26
definitely yes ...
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 8th Dec 2012 03:12
Yeah it's a limitation currently. I believe you can get around it by passing a UDT as a variable to the function (with all properties set accordingly within the UDT), although it's a little convoluted.
Abiz
11
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 8th Dec 2012 04:18
I'm a novice user of AppGameKit, and I don't understand why these limitations aren't mentioned in the documentation. It took me 1,5 hours to find the problem. The least I would expect is that you get an error when you try to use the function with too many arguments, instead of AppGameKit ignoring argument #10.

Don't get me wrong: I'm still enthousiastic about AppGameKit but these 'little' things take so much time to find.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 8th Dec 2012 04:20
It is only a limitation in Tier 1 programming.

Quote: "
I believe you can get around it by passing a UDT as a variable to the function"


You have to be very careful about this. You can only pass a UDT into one level of functions. If you try to pass the same one to another function from within the first function, you can run into problems. This issue was recently re-posted into the issue board because it still exists, even though they say it was fixed.

So, don't do something like this:


You cannot be sure whether the values that appear in the second function for the passed UDT will be correct.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 8th Dec 2012 04:48 Edited at: 8th Dec 2012 04:49
And here's a link to the related AppGameKit issue list entry. This topic was first reported about a year ago, near the beginning of AGK's life..

AGK ISSUE REPORT #39: Passing more then 9 variables to a function create corrupt data

And yes... all of these problems with UDTs, and no warnings from the compiler when the number of function parameters is exceeded, are very typical for AppGameKit Tier 1 Basic. (It is a bloody miracle that Tier1 works at all.)

Cheers,
AgentSam - The grumpy old software engineer who is very disappointed in AGK

Login to post a reply

Server time is: 2024-04-28 17:49:41
Your offset time is: 2024-04-28 17:49:41