raitos Posted February 25, 2013 Share Posted February 25, 2013 Hi Skyrim Modders, I am a complete newcomer to the Skyrim modding scene. I have a specific question: is it possible to set any state or call system functions from Papyrus? My use case is this: for an upcoming company hack day, I want to create a Skyrim plugin that sends push notifications to a mobile app when a player enters a city or completes an achievement. The concept being that your in-game actions can alert your IRL friends. I think this would be kind of neat and would like to see it in Steam generally. In order to make this happen, I need to get that information outside of the game world and onto the computer... somehow. I don't care if it is just setting an integer in a settings file in the Skyrim folder, I just need to get the message out somehow. I can write a helper program to monitor for changes and send the push notifications (for the purpose of the demo, I can setup some pre-packaged messages like { "0": "Craig just arrived in Solitude.", "1": "Craig just arrived in Riften." } It's just a demo after all. My research has come up blank. I found something promising in SKSE, but it looks like nothing is written outside of the game: http://www.creationkit.com/SetGameSettingString_-_Game This doesn't need to work in a production mod, it is just for this demo. So if there are script functions that only work when you are developing, I'll take 'em. If you guys have any other ideas about how to message from the game to an outside script, I'll take that. I am guessing there is not going to be a way to do this, however, for obvious reasons. :) Thanks!Craig Link to comment Share on other sites More sharing options...
raitos Posted February 25, 2013 Author Share Posted February 25, 2013 Heck, if you can parse the player's location from a save file, I'll even take that. That would presumably take no modding work at all, just knowledge of the Skyrim save file structure. Does anything like that exist? Will do some googling myself. Link to comment Share on other sites More sharing options...
brisid Posted February 25, 2013 Share Posted February 25, 2013 Turn on script debugging and use debug.trace() to write to the papyrus log? Link to comment Share on other sites More sharing options...
raitos Posted February 25, 2013 Author Share Posted February 25, 2013 Turn on script debugging and use debug.trace() to write to the papyrus log? Oh! Does that right out to a log file? I read that and assumed it just meant a console log. Sweet. I will try that out, thanks! I am open to other ideas just in case this doesn't work out. ;) Link to comment Share on other sites More sharing options...
scrivener07 Posted February 25, 2013 Share Posted February 25, 2013 Tracing to the main skyrim log can get messy because of all the other trash that gets sent there. Lucky for you its possible to create your own logs. Heres the reference to get started. This writes the file to your disk and opens an output stream from skyrim to the userlog. I think you can create multiple user logs.http://www.creationkit.com/OpenUserLog_-_Debug This function can be used write in that output stream.http://www.creationkit.com/TraceUser_-_Debug And this will close the output steam but you really dont need to use this because Skyrim will do it automatically when appropriate http://www.creationkit.com/CloseUserLog_-_Debug In order to get Skyrim to use debug logs of any kind you need to enable it in your skyrim.ini. Add this [Papyrus] bEnableLogging=1 bEnableTrace=1 bLoadDebugInformation=1 Link to comment Share on other sites More sharing options...
raitos Posted February 25, 2013 Author Share Posted February 25, 2013 scrivener07, you prove that the true heros are found outside of the game. Thanks a bunch! Link to comment Share on other sites More sharing options...
scrivener07 Posted February 25, 2013 Share Posted February 25, 2013 Post back if you get something working. Sounds interesting Link to comment Share on other sites More sharing options...
raitos Posted March 2, 2013 Author Share Posted March 2, 2013 https://github.com/crw/skypush Pretty hacky, but it basically works. I am not that thrilled with the resolution of the location updates. I can't figure out what objects fire what events. Also, it took me forever to find this information: Skyrim Script Extender (SKSE) provides a GetName method to most objects! If you need to get the pretty name of a Location, this is how you do it! Other forum posters suggested creating tables of references to the locations you are interested in, linking them in the Creation Kit. Not only is this a giant pain, I could not get the Creation-Kit-linked Location properties to have any value other than None for the main locations (WindhelmLocation, for example.) I did not figure out what was going on with that. Not sure if specific Locations are None until you get close enough to load them into memory, at which point they would have the right reference? I do not know enough about the system to really get it. Overall an interesting experience. Papyrus is curious, I wonder why they didn't use Lua. My main criticism would be that the documentation is a bit difficult to understand, or missing information. It is pretty unclear what objects fire which Events. I rarely saw Events firing when I thought I would. It might be because I was focusing only on the Papyrus docs, but some information about the availability of objects and references given player location in the game world would be helpful. Overall it was fun, though. :) Thanks for your help scrivener07! Link to comment Share on other sites More sharing options...
Recommended Posts