[And I'll apologise in advance, having worked with HC, MC, LC, and OXT for 32 years]
WHAT is a frontScript?
WHAT might be the purpose of a frontScript?
WHERE do you put a fontScript?
Beginner Question #1: FrontScripts
Forum rules
Be kind.
Be kind.
- richmond62
- Posts: 4594
- Joined: Sun Sep 12, 2021 11:03 am
- Location: Bulgaria
- Contact:
Beginner Question #1: FrontScripts
https://richmondmathewson.owlstown.net/
- tperry2x
- Posts: 3049
- Joined: Tue Dec 21, 2021 9:10 pm
- Location: Somewhere in deepest darkest Norfolk, England
- Contact:
Re: Beginner Question #1: FrontScripts
A frontscript can be any object with an ID - for example, if you type "put the frontscripts", you'll get a list:
In essence, it's a list of priority in which things are processed. That's the purpose of it, to allow things to move along the message path (the order in which messages are dealt with).
As far as putting a frontScript, you don't really put it anywhere as it's already part of your stack.
You might wonder how you bring your script to the top of that list of the frontscripts. (so that it executes before anything else).
If you had a card script, you could do:
then if you run "put the frontscripts", you'll see your card is at the top of the list (top of the message path), which means this will be checked first.
Does that make sense?
Frontscripts are scripts that will be checked and processed before anything else. So, for example if something in the frontscripts has an "on opencard" handler (and has pass opencard), then the opencard message moves down the chain of things listed in the frontscripts until it gets to your card and checks the opencard message there.In essence, it's a list of priority in which things are processed. That's the purpose of it, to allow things to move along the message path (the order in which messages are dealt with).
As far as putting a frontScript, you don't really put it anywhere as it's already part of your stack.
You might wonder how you bring your script to the top of that list of the frontscripts. (so that it executes before anything else).
If you had a card script, you could do:
Code: Select all
insert the script of this card into front
Does that make sense?
- richmond62
- Posts: 4594
- Joined: Sun Sep 12, 2021 11:03 am
- Location: Bulgaria
- Contact:
Re: Beginner Question #1: FrontScripts
OK: So, nothing special really.
This:
is a frontScript (I assume).
Just that I have never called it that.
This:
Code: Select all
on preOpenStack
set this stack to the screenLoc
end preOpenStack
Just that I have never called it that.
https://richmondmathewson.owlstown.net/
- tperry2x
- Posts: 3049
- Joined: Tue Dec 21, 2021 9:10 pm
- Location: Somewhere in deepest darkest Norfolk, England
- Contact:
Re: Beginner Question #1: FrontScripts
No, as it's not inserting itself into the frontscripts - that's just a handler that is run by the engine before a stack is opened.
That's hard-coded to be checked on opening a stack, whereas inserting something into the frontscripts makes the list of things to check customisable.
You are going to ask me what the backscripts are now, I can feel it
The backscripts are the inverse of this - things in the backscripts execute AFTER the items in the frontscripts. AND after things that you've not added to the frontscripts. Say for example mouseup on a button. The frontscripts are checked first and their code run through, one item at a time. Then after those are all processed, the script in your button is run, then after that's done - all the things in the backscripts are checked one at a time and run through too.
You could think of it like pendingmessages, except you aren't having to continuously send [message] to [object] in [number] [milliseconds,seconds etc]
Things placed in the frontscripts and the backscripts remain being checked in the order shown by:
and
(you'll probably be surprised by the amount of things going on behind the scenes, particularly in the backscripts)
So, if you wanted to remove something from the backscripts (and keeping the example of a card script) - you can also do:
This is a handy method for loading user-plugins on-the-fly, without having to restart the IDE to see changes. It's what I was going to use if I ever made a customisable xTalk-language user plugins directory. My idea at one point was to use this method to allow users to create their own plugins in the tools palette, like actions / macros in photoshop for example. However I've shelved that idea as I'm focussed on trying to get the engines to at least compile at the moment. I'm trying to do one thing at a time, as otherwise there's too many to-do lists which become unmanageable.
That's hard-coded to be checked on opening a stack, whereas inserting something into the frontscripts makes the list of things to check customisable.
You are going to ask me what the backscripts are now, I can feel it
The backscripts are the inverse of this - things in the backscripts execute AFTER the items in the frontscripts. AND after things that you've not added to the frontscripts. Say for example mouseup on a button. The frontscripts are checked first and their code run through, one item at a time. Then after those are all processed, the script in your button is run, then after that's done - all the things in the backscripts are checked one at a time and run through too.
You could think of it like pendingmessages, except you aren't having to continuously send [message] to [object] in [number] [milliseconds,seconds etc]
Things placed in the frontscripts and the backscripts remain being checked in the order shown by:
Code: Select all
put the frontscripts
Code: Select all
put the backscripts
So, if you wanted to remove something from the backscripts (and keeping the example of a card script) - you can also do:
Code: Select all
remove the script of this card from back
Who is online
Users browsing this forum: No registered users and 0 guests