lguiconsole

Discussion of Inner Space

Moderators: Lavish Software Team, Moderators

Post Reply
agitated
GamingTools Subscriber
Posts: 30
Joined: Sat Apr 28, 2007 5:05 pm

lguiconsole

Post by agitated » Thu Feb 07, 2008 7:51 pm

I need a quick example of how to echo text from a script to a LavishGUI console.

I read the wiki but I just don't get it.

One script relays info to a master script in the uplink. The master script then parses and relays again to a 3rd script. This 3rd script needs to update a LavishGUI console with the text.

As usual, any guidance is appreciated :)

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Fri Feb 08, 2008 12:01 am

It's fairly simple actually.

I assume you've seen the [[LavishGUI:lguiconsole_(Data_Type)|lguiconsole datatype wiki page]], but there's the link anyway to help follow along. If not, then let me quickly mention that there's 2 wiki pages for each type of element -- one for the XML and behavior information, and one for the LavishScript object information.

So, from this we see that the lguiconsole datatype has an Echo method, so once we get access to the lguiconsole object, then all we do is obj:Echo["Stuff to echo!"]

This means the question is now, how do we access the lguiconsole object for a console element we've loaded. We start at the [[LavishGUI:Top-Level Objects]] page (from the main [[LavishGUI]] page), and specifically to the [[LavishGUI:UIElement (Top-Level Object)|UIElement TLO]], which may be ever so slightly misleading as it says it returns lguielement, whereas it actually returns whatever type of element is being accessed. This TLO is best used with the desired UI element's [[LavishGUI:Elements#Notes_on_Element_Names|Fully-Qualified Name]].
The element's Fully-Qualified Name (FQN) is made up of the element name and each of its parents' names (from this element to its outermost parent), separated by the @ character. For example, if an element named "Output" resides in a top-level element named "Console", the element's FQN is "Output@Console".
The example FQN is exactly that of the main console used in the uplink or any session. So, let's put this all together for a test:

Code: Select all

UIElement[Output@Console]:Echo["Hello World!"]
And voila! The text is output directly to the "Output@Console" console element.

So now all you need to do is successfully relay it. I would use an atom rather than relaying the sequence, so something like..

Code: Select all

atom(global) myecho(string output)
{
    UIElement[Output@Console]:Echo["${output.Escape}"]
}
Then just make sure that the parameter to myecho is quoted since this is expecting 1 parameter rather than any number, as echo takes. It can of course be done but it's easiest just to quote the parameter in this case.

agitated
GamingTools Subscriber
Posts: 30
Joined: Sat Apr 28, 2007 5:05 pm

Post by agitated » Fri Feb 08, 2008 10:37 am

Thank you for the explanation, works great of course :)

Post Reply