Problem with accessing variable names in AppGameKit is that variable names are replaced with integer identifiers when you compile the program, making access to those variables by the engine faster and more efficient. Most programming languages are like that. Usually when someone wants the functions you are talking about, a scripting language is used such as LUA. Has anyone created a scripting language module for AppGameKit? It would be a handy thing to have.
If your requirements are simple enough, you might be able to roll your own, or even use some of the built in functions of AppGameKit like toJSON and fromJSON. Here is george++ example redone using JSON string.
// Project: hi
// Created: 2018-07-01
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "hi" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
//generic damage type
type tDamage
dmg_health as integer
dmg_strength as integer
dmg_coin as integer
endtype
//The entity type
type tEntity
health as integer
strength as integer
coin as integer
endtype
//function to apply damage to entity
function ApplyDamage(ent ref as tEntity, damage ref as tDamage)
ent.health = ent.health + damage.dmg_health
ent.strength = ent.strength + damage.dmg_strength
ent.coin = ent.coin + damage.dmg_coin
endfunction
anydamage as tDamage
anyentity as tEntity
//Use JSON to define the player
//give player 20 health, 20 strength, and 10 coins
anyentity.fromJSON('{"health":20,"strength":20,"coin":10}')
//use JSON to add damage to the character.
//loses 10 health, 5 strength, and drops 2 coins
anydamage.fromJSON('{"dmg_health":-10,"dmg_strength":-5,"dmg_coin":-2}')
ApplyDamage(anyentity, anydamage)
//now a pickpocket takes 5 coins from the player
anydamage.fromJSON('{"dmg_coin":-5}')
ApplyDamage(anyentity,anydamage)
do
Print( anyentity.health )
print( anyentity.strength )
print( anyentity.coin )
Sync()
loop
You could have the JSON strings supplied by the player and read from a file, or the strings could be created by the editor using parameters supplied by the player.