tperry2x wrote: ↑Sat Jun 22, 2024 8:16 pm
In short, I'm wondering how you get an externalised function to be treated like one embedded inside the engine.
If it doesn't need any arguments then maybe you could just have it be a 'command' handler instead of function handler, and can still set the result and the 'it' values.
But there's no way that I've found to create a new
'global/engine level property' from a script, it seems that's exclusively the domain of the engine. Like you I've used globals to get something similar to global property (like 'selectedSoundFont' used by my general music library), the difference is in readability of scripts because 'the' is the token that indicates a property. With a global I can't 'put THE selectedSoundFont', but I can 'put selectedSoundFont'.
Now that I think of it there might be a way I suppose to make a new 'global property' like with those .tsv tab separated value files, I think I did do some experimenting with a 'properties.txt' file.
And to answer Richmond's question more specifically... no you can't override internal engine functions/commands, or keywords, or even some words that are simply reserved by the engine (deprecated nor 'for future use'), although you can set some of those that are 'stubs' or 'has no effect / for compatibility'(with other xTalks) keywords, sometimes with arbitrary values. Extension Builder language doesn't allow overriding any of the Engine's keywords/commandNames/functionNames either as far as I can tell.
This will get you a list of most of them... in the message box paste:
Code: Select all
put the functionNames; put cr & the commandNames after msg;put cr & the PropertyNames after msg
One of the things I really like about the way 'HyperCard Simulator' works is that the top-level (second level below interpreter in its message path) 'SimScript' functions that you add can be called as if they're 'global properties' (ie with 'the' in front of the function name and no ( parentheses ) needed. So I have a function that uses a mix of xT and JS, 'function darkMode' which returns a boolean and I can use it like 'if
the darkMode then ...'
HyperCard (and OpenXION) allowed you to override almost
every keyword in the interpreter, which came in handy but could also get confusing (I used to override the 'play' command in HC). In OpenXION I was easily able to overide ask/answer with AppleScripts/Python script to implement graphical UI dialogs instead of its internal text/console based dialogs.
I read a very old discussion about allowing this sort of thing from MetaCard Mail List archive, at least with some keywords, but that obviously never happened.