Jump to content

Why isn't this working?


Recommended Posts

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 by Offtherails
Link to comment
Share on other sites

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 by Arron Dominion
Link to comment
Share on other sites

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...