Offtherails Posted April 17, 2015 Share Posted April 17, 2015 (edited) My Papyrus limitations laid bare, for all to see I'm trying to put together a script that will retrieve and log the player's current location. Eventually, other data too. But the location's the part that's driving me up the wall right now. Scriptname trackerScript extends Quest {third time's the charm!} Actor Property PlayerREF Auto float posX float posY float posZ float Heading Event OnInit() RegisterForSingleUpdate(1.0) EndEvent Event OnUpdate() RegisterForSingleUpdate(10.0) ;update every 10 seconds posX = PlayerREF.GetPositionX() ;get X position posY = PlayerREF.GetPositionY() ;get Y position Debug.TraceUser("myLogFile", PlayerREF + ":" + posX + ":" + posY) ;log data Debug.Notification(PlayerREF + ":" + posX + ":" + posY) ;quick check in-game EndEvent If I forget about the PlayerREF property, and just use Game.GetPlayer().GetPositionX() then it works fine. But I want this to be as lightweight as possible, and I've got a feeling that knowing why PlayerREF doesn't work is ultimately more important than just getting the numbers into the log file. The crazy thing is, I've had this thing working perfectly in the past. I could spin a yarn about hard drive crashes, SWAT teams, lightning strikes and the like, but the truth is I've gone and reinstalled Skyrim without backing up my scripts. Twice. The less said about that, the better. So - with a note of desperation - what on Earth have I forgotten to do this time? Edited April 17, 2015 by Offtherails Link to comment Share on other sites More sharing options...
DavidJCobb Posted April 18, 2015 Share Posted April 18, 2015 You auto-filled the PlayerRef property in the CK, right? Link to comment Share on other sites More sharing options...
Offtherails Posted April 18, 2015 Author Share Posted April 18, 2015 Yes, it's auto-filled. Property type: Actor, Cell: (any), Reference: <space>PlayerRef ('Player'). Baffling. Link to comment Share on other sites More sharing options...
ArronDominion Posted April 18, 2015 Share Posted April 18, 2015 (edited) Just as something to try: In your OnInit, could you set Player Red to equal Game.GetPlayer() and see if that works? Also make sure on the String concats that there are no spaces between the plus and your strings to concatenate. Edited April 18, 2015 by Arron Dominion Link to comment Share on other sites More sharing options...
Offtherails Posted April 18, 2015 Author Share Posted April 18, 2015 Thanks Arron; I tried what you suggested. No change. Link to comment Share on other sites More sharing options...
Offtherails Posted April 18, 2015 Author Share Posted April 18, 2015 The most extraordinary thing's just happened. I rebuilt the esp from scratch and tested it on a clean save. It's working perfectly, for reasons I can't begin to fathom. I'm positive I didn't do anything differently this time; maybe it's just Bethesda Voodoo at work. Now I'm trying to figure out how to export the player's name to the log. Game.GetPlayer() and PlayerREF both print [Actor < (00000014)>] to the log. I've tried imitating quest WEJS28 (the assassin ambush, carrying a letter from Astrid naming the PC), filling a ReferenceAlias property on the quest. All I get in the log is: [ReferenceAlias <alias PlayerRef on quest SkymapHelperQuest (B1000D62)>] ...which isn't quite what I'm after. Any ideas anyone? Link to comment Share on other sites More sharing options...
ArronDominion Posted April 19, 2015 Share Posted April 19, 2015 Printing an object such as an Actor will print out its object type and the internal id in use at the time. To print out an object name requires SKSE. If you are using SKSE check this page out: http://www.creationkit.com/GetName_-_Form Link to comment Share on other sites More sharing options...
Offtherails Posted April 19, 2015 Author Share Posted April 19, 2015 You... are a legend. Thankyou so much. Link to comment Share on other sites More sharing options...
Recommended Posts