YouDoNotKnowMyName Posted January 21, 2021 Share Posted January 21, 2021 Good morning everybody! I know that you can do some cool stuff with actionscript.And I know that you can do some cool stuff with papyrus scripts. But how can I "send" a variable from a actionscript-script to a papyrus script? For example, I want to set up a custom terminal where the user can enter some text. (can easily be done in actionscript).And I want to have a script attached to taht terminal that will control some "in-game" stuff (enable and disable things, ...) based on what text was entered into the actionscript-thing. So, how would this be done? I have found some mods that have "user entered text", like the "journal of the sole survivor" mod, but that does everything (except giving the player the holotape) in actionscript and doesn't actually "interface" with the "papyrus scripting system" ... Any help would be appreciated ... Link to comment Share on other sites More sharing options...
Reneer Posted January 21, 2021 Share Posted January 21, 2021 Check out OnHolotapeChatter which might provide exactly what you want. Link to comment Share on other sites More sharing options...
YouDoNotKnowMyName Posted January 21, 2021 Author Share Posted January 21, 2021 Check out OnHolotapeChatter which might provide exactly what you want.Ok, that is the papyrus-script-side of the "communication", the "recieving" of information ...But what do I need to use in the actinscript to "send stuff" to the script? Link to comment Share on other sites More sharing options...
DieFeM Posted January 21, 2021 Share Posted January 21, 2021 I asked time ago to Scrivener07 about this same question, didn't tried it myself so I don't have experience implementing it, but he points out the key for this end (SendExternalEvent), that's how the conversation went: Scrivener07:We can send events with all custom parameters from AS3 to Papyrus.its called ExternalEvent DieFeM:Hmmm, interesting... I'm intrigued, how does it work?Is there any example in one of your other projects? Scrivener07:Yea, I use the XSE.as API.https://github.com/F4CF/Creation-Framework/blob/dbfee0c169f8ed7ea685c0f3d6d71e22bc603b6f/System.XSE/Interface/Source/System.XSE/System/UI/Menus/VisorMenu/VisorMenu.as#L61-L65After a hud overlay gets loaded on the UI I send an event to papyrus. DieFeM:So, I've been looking at this, but there's something I don't quite understand, where is defined the "callback" function, the one that receives the event, because I see the as3 sends an event with:XSE.SendExternalEvent(AssetLoadedEvent, true, client); And that this variable contains a script path private const AssetLoadedEvent:String = "System_UI_VisorMenu_AssetLoadedEvent";But then I check the script in papyrus and there's a function bool Function Send(ScriptObject sender, AssetLoadedEventArgs e) How do I define the name of the function that receives the event, or is it always called Send?? Scrivener07:Its not a script path or anything special. Its more of an event ID which is a const string. Papyrus will listen for an event of that name. DieFeM:So, where can I see an example of the papyrus side of this event? Scrivener07:https://github.com/F4CF/Creation-Framework/blob/master/System.XSE/Scripts/Source/System.XSE/System/UI/Visor/Menu.psc DieFeM:Ok, I see, now it makes sense: string AssetLoadedEvent = "System_UI_VisorMenu_AssetLoadedEvent" const ... RegisterForExternalEvent(AssetLoadedEvent, "OnAssetLoaded") ... Event OnAssetLoaded(bool success, string instance) thank you btw Link to comment Share on other sites More sharing options...
YouDoNotKnowMyName Posted January 22, 2021 Author Share Posted January 22, 2021 (edited) I asked time ago to Scrivener07 about this same question, didn't tried it myself so I don't have experience implementing it, but he points out the key for this end (SendExternalEvent), that's how the conversation went: Scrivener07:We can send events with all custom parameters from AS3 to Papyrus.its called ExternalEvent DieFeM:Hmmm, interesting... I'm intrigued, how does it work?Is there any example in one of your other projects? Scrivener07:Yea, I use the XSE.as API.https://github.com/F4CF/Creation-Framework/blob/dbfee0c169f8ed7ea685c0f3d6d71e22bc603b6f/System.XSE/Interface/Source/System.XSE/System/UI/Menus/VisorMenu/VisorMenu.as#L61-L65After a hud overlay gets loaded on the UI I send an event to papyrus. DieFeM:So, I've been looking at this, but there's something I don't quite understand, where is defined the "callback" function, the one that receives the event, because I see the as3 sends an event with:XSE.SendExternalEvent(AssetLoadedEvent, true, client); And that this variable contains a script path private const AssetLoadedEvent:String = "System_UI_VisorMenu_AssetLoadedEvent";But then I check the script in papyrus and there's a function bool Function Send(ScriptObject sender, AssetLoadedEventArgs e) How do I define the name of the function that receives the event, or is it always called Send?? Scrivener07:Its not a script path or anything special. Its more of an event ID which is a const string. Papyrus will listen for an event of that name. DieFeM:So, where can I see an example of the papyrus side of this event? Scrivener07:https://github.com/F4CF/Creation-Framework/blob/master/System.XSE/Scripts/Source/System.XSE/System/UI/Visor/Menu.psc DieFeM:Ok, I see, now it makes sense: string AssetLoadedEvent = "System_UI_VisorMenu_AssetLoadedEvent" const ... RegisterForExternalEvent(AssetLoadedEvent, "OnAssetLoaded") ... Event OnAssetLoaded(bool success, string instance) thank you btw Thanks for that!I will check those examples out! Edited January 22, 2021 by YouDoNotKnowMyName Link to comment Share on other sites More sharing options...
YouDoNotKnowMyName Posted January 22, 2021 Author Share Posted January 22, 2021 JACKPOT!!!1 I just looked on Scrivener's github page and there is LOTS OF GOOD STUFF there!He has lots of "framework stuff" for scripting and UI ...I think this will be VERY usefull! Link to comment Share on other sites More sharing options...
Recommended Posts