dockscreen from code

This is a moderated forum that collects tutorials, guides, and references for creating Transcendence extensions and scripts.
Post Reply
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

One thing I could never do is call up a dockscreen from an <invoke>.

When I tried last time, a good while ago, it just crashed. Is there some trick i'm missing?
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

copy paste the code from George's barrels? (or the longzhou sphere?) that should work- I think.
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

There is no real way to do it via script (without hackage).

You can of course use the built in invoke functionality of a usable item, by having the useScreen attribute set, but if you want to do stuff from script, and use (scrShowScreen gScreen ...) the game crashes.

The reason is that the global gScreen has not been set to anything before we have entered a screen. So, ideally it should never be used when outside of a screen. Hower, there is really only ever one screen, so if it has already been set, you can reuse it for the rest of the session. You can use the trick from this snippet to make it work:

http://transcendence.pastebin.com/f1b2845ab

.]
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

a very evil hack :D
I think that we need a system to call a screen from script, it could be used to fake a radio communication system for example by popping-up a dockscreen with the image of the bridge of the other ship, just like communications in Star Control 2 than can happen in the middle of the fight, or as soon as you recon a ship.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

digdug wrote:a very evil hack :D
I think that we need a system to call a screen from script.
Indeed. Having a standardised way of doing this would be very cool.
digdug wrote:it could be used to fake a radio communication system for example by popping-up a dockscreen with the image of the bridge of the other ship, just like communications in Star Control 2 than can happen in the middle of the fight, or as soon as you recon a ship
The only downside I can see is that a DS popping up in the middle of battle can be potentially lethal, since time does not stop time. I don't think I would like to have this feature available outside of an action triggered explicitly by me.

.]
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

so, what we need is to freeze time too, even if an abuse of this kind of dockscreens can fragment a bit too much the space-fighting experience.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

digdug wrote:so, what we need is to freeze time too, even if an abuse of this kind of dockscreens can fragment a bit too much the space-fighting experience.
That can already be done via script. What we really cant do, is show a screen when gScreen is not set yet. Hopefully this will appear in 1.0 or further on. Ticket time perhaps?
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

thanks all for the help, I thought about the standard usescreen attribute, but with an emergency use device sifting through 10 tons of usables could potentially be fatal. I will try that hack and see how it goes, unless there is a usekey attribute.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

On a related note, I did some sniffing around last night, and discovered what i think is the earliest way at getting at gScreen. It might not be totally relevant to this thread, but it has to do with dockscreens and script, so what the heck. Example here:

http://transcendence.pastebin.com/f3649c964

.]
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

very clever! :D
<OnObjDocked> can run scrShowScreen gScreen and pop up your dockscreen, but because OnObjDocked is a station event, you registered the playership to the station with objRegisterForEvents to get the event to the playership! :shock:

and ... teleported! :D
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

digdug wrote:very clever! :D
<OnObjDocked> can run scrShowScreen gScreen and pop up your dockscreen, but because OnObjDocked is a station event, you registered the playership to the station with objRegisterForEvents to get the event to the playership! :shock:

and ... teleported! :D
:D That sounds way more magical that what is actually going on.

To recap:

A global station reponds to <OnGlobalSystemCreated> by spawning a local station in the system as soon as the system is created. This local system in turn, has the <OnObjDocked> xml event present, calling a function, (OnObjDocked). The first thing this station does, is to register for events with the playership. Now, the moment we dock with a station, (OnObjDocked) is triggered. The real cool thing, is that we can use gScreen here, even though the player has never had a screen open before. So... gScreen is always set inside <OnObjDocked> !!

Basically it allows us to reliably hijack the players dockscreen.

.]
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

in your Globals function, if you sysFindObject stations at 1 ls from the playership, can you actually get the station the gPlayership is docking to ?
If so, we can hijack ANY dockscreen with some script work ?
Post Reply