Jump to content

Please help me get this simple script working


irswat

Recommended Posts

  • Replies 135
  • Created
  • Last Reply

Top Posters In This Topic

Well, debug messages can take up more time than the actual processing. I have a mod I am updating where I used debug messages to let me know if one aspect was working properly. The processes had completed but I had a massive wall of text slowly displaying in the upper left corner. Debug.trace statements will be faster as they show only in the papyrus log. But removing all debug statements is best as none of those process will then run. In a nutshell, one step towards optimization is to use as few notification statements as possible.

 

As far as drive thrashing, I suppose it is possible. Tho it depends on what all else the user has running on their system. It can very well be the case that by itself it is fine but when added with other stuff things happen. Always seems to be the last mod added that people claim is the cause of their problems rather than realizing that perhaps they've simply put too much in for their system to handle.

Link to comment
Share on other sites

I need a clever way to make sure the RevokeBladeCheck only triggers once a day. I have this, but I realize now that if someone waits for 24 hours this logic will fail.

note: RevokeTemperedBladeCheck initializes at 0

 

;RevokeTemperedBladeCheck: this is to ensure the check for the previous time period only occurs once
	;0=flag for duskfang check needs to be performed
	;1=it's daytime and check for duskfang has been performed
	;2=it's nighttime and check for dawnfang needs to be performed
	;3=it's night time check for dawnfang has been performed
	if (TimeofDay>=6.0 && TimeofDay<18.0)
		DayTime=1
		if RevokeTemperedBladeCheck==3
			RevokeTemperedBladeCheck=0
		endif
		if RevokeTemperedBladeCheck==0
			RevokeTemperedBlade(TimeofDay)
			RevokeTemperedBladeCheck=1
		endif
		ItsDayTime()
	elseif ((TimeofDay>=18.0 && TimeofDay<=24.0)||(TimeofDay<6.0))
		DayTime=0
		if RevokeTemperedBladeCheck==1
			RevokeTemperedBladeCheck=2
		endif
		if RevokeTemperedBladeCheck==2 || RevokeTemperedBladeCheck==0
			RevokeTemperedBlade( TimeofDay)
			RevokeTemperedBladeCheck=3
		endif
		ItsNightTime()
	endif 

 

 

Edited by irswat
Link to comment
Share on other sites

When the player first gets the weapons use GetCurrentGameTime and store the result in a variable. Then when checking to temper or revoke use it again to compare against the first.

i.e.

 

Float StartTime

Float CurrentTime

Float EndTime

Bool RunOncePerDay = false

 

;when player first gets weapon

StartTime = Utility.GetCurrentGameTime()

EndTime = StartTime + 1

 

;later during the check to temper or revoke within the current day

If Utility.GetCurrentGameTime() < (EndTime) && RunOncePerDay == false

RunOncePerDay = true

;if player waits too long

ElseIf Utility.GetCurrentGameTime() >= EndTime

RunOncePerDay = false

 

;and when tempering or revoking

StartTime = Utility.GetCurrentGameTime()

EndTime = StartTime + 1

 

EDIT: GetCurrentGameTime() uses game days, thus the adding of 1 to StartTime is 24 hours later. Added some more stuff as I thought about the logic a bit more.

Edited by IsharaMeradin
Link to comment
Share on other sites

I have some stupid bug in here and I can't find the cause.

So I add dawnfang to my inventory. I go get 12 kills. I get the (fine) tempered blade. I wait a couple hours until it is night. Then I wait 12 hours until it is day. The script returns and equips the (fine) dawnfang as it's supposed to, but it also adds an untempered dawnfang. If anyone is interested in helping me debug this I'll pm the plugin.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...