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 / AGK v2 - dynamic function calls possible?

Author
Message
Multicoder
AGK Developer
9
Years of Service
User Offline
Joined: 25th Oct 2014
Location: Germany
Posted: 23rd Nov 2014 05:04
Hi there,

currently I try to put together some kind of interface framework with AppGameKit v2.
I created a type for buttons like this:


I think you already know what I try to achieve with onclick_callback$
I tried using onclick_callback$() and gosub onclick_callback$ but unfortunately both don't work.
Since I didn't find anything in the help files nor with the forum search, you are my last hope

Is there any way to call a function dynamicaly?
If it isn't possible the way I try to do it, is there any other way I can achieve my goal?

Thanky you in advance

Yes, I am aware that I sound like a caveman to native english speakers
Clonkex
Forum Vice President
13
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 23rd Nov 2014 06:15
As far as I know, this is not possible. It's a very good suggestion, so I'll add it to the AGK2 Feature Request thread

MikeHart
AGK Bronze Backer
20
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 23rd Nov 2014 10:14 Edited at: 23rd Nov 2014 10:15
I had the same problem translating my framework as I was coming from an OOP kind of language. But at the end, working with integer IDs and having a fixed set of callbacks, which are called depending if the object has a specific ID set, was doing just fine. That is the closest thing you can get in Tier1.
easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 23rd Nov 2014 21:45 Edited at: 23rd Nov 2014 21:50
Quote: "As far as I know, this is not possible. It's a very good suggestion"

I already added it

I do my interface like this:



Hope that makes sense Basically just use a global array for the buttons


EDIT: It's probably quite a bit easier now with AGKv2 because of the array sorting commands, this is how I did it with AGKv1


Audacia Games - Latest WIP - AUTOMAYTE 2.1, AppGameKit one click deploy to Android
"When you've finished 90% of your game, you only have 90% left"
Multicoder
AGK Developer
9
Years of Service
User Offline
Joined: 25th Oct 2014
Location: Germany
Posted: 23rd Nov 2014 21:53
Thank you for your answers!
I think, until delegates are possible in AppGameKit, I will stick with my AGK-like functions get_button_pressed(button_id) and get_button_state(button_id)

Yes, I am aware that I sound like a caveman to native english speakers

Login to post a reply

Server time is: 2024-05-08 12:57:40
Your offset time is: 2024-05-08 12:57:40