Jump to content


Photo

DSotSC script block loop...


  • Please log in to reply
4 replies to this topic

#1 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 27 April 2012 - 08:48 PM

I had some stutter issues with Imoen and so I applied the stutter test which displays which scripts are running and most likely to be causing the stutter. I found the problem and it was actually with something that I had done script wise and corrected it. However on my subsequent check after the fact. I kept getting a repeat run of a specific block in ar6600.bcs

After a little bit of tracking down the issue (running the cleanup batch from BWP is not advised -- it removes stuff needed to check whats going on) and then examining the installation files for DSotSC from my "lite" big world setup (since cleanup batch file removed everything from the 'insane' install), I found the repeating block....

IF
Global("Chapter","GLOBAL",2)
Global("RandomSpawn","GLOBAL",3)
THEN
RESPONSE #100
  SetGlobalTimer("RandomSpawnTime","GLOBAL",TWO_DAYS)
END
There is nothing being set to prevent this block from running again. The script can never get past this point. It's in a hold pattern so to speak waiting for an external source to change one of the two variables. The RandomSpawn would be the most likely to be changed

I think you could be ok adding in as an additional check
!GlobalTimerNotExpired("RandomSpawnTime","GLOBAL")
the double negative means that it is expired or it was never set.

In fact I will test this and see what happens...

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#2 Turambar

Turambar
  • Modder
  • 935 posts

Posted 28 April 2012 - 07:12 AM

Thanks, let me know. I don't have much time right now, but I'll check that ASAP.
I have indexed it in the bug report topic, so that it doesn't get forgotten

Turambar

Currently supporting: DSotSC for BGT, NTotSC - forum

Turambar's fixes and tweaks for BG2, BGT, DSotSC, NTotSC, SoBH and more!

 

Before posting questions (even regarding posts written by myself), please look at Jarno Mikkola's FAQs for the Megamods!
(how to correctly report CTDs)

 


vipersig.jpg


#3 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 29 April 2012 - 06:51 AM

thought about this some more... while the timer check i suggested will keep that block from looping. it still won't let it pass to the next block which is intended to reset certain variables after the timer has expired.

so flip the two blocks and add a timer check to the one that initiates the timer as in the following:
IF
GlobalTimerExpired("RandomSpawnTime","GLOBAL")
Global("Chapter","GLOBAL",2)
Global("RandomSpawn","GLOBAL",3)
THEN
RESPONSE #100
  SetGlobal("RandomSpawn","GLOBAL",0)
END
IF
!GlobalTimerNotExpired("RandomSpawnTime","GLOBAL")
Global("Chapter","GLOBAL",2)
Global("RandomSpawn","GLOBAL",3)
THEN
RESPONSE #100
  SetGlobalTimer("RandomSpawnTime","GLOBAL",TWO_DAYS)
END
Reason this works is that GlobalTimerExpired requires that the timer first exist, whereas !GlobalTimerNotExpired doesn't require the timer to exist.

Edited by Sasha Al'Therin, 29 April 2012 - 06:54 AM.

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#4 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 18 August 2012 - 02:02 AM

Flipping those 2 blocks made the (now) last block unreachable :P Because RandomSpawn is incremented to 3 in the blocks above those 2 blocks... Which means the timer is never reset and continues to remain expired.. which means... OMFG KOBOLD PARTY!!! :woot:

Might I suggest combining both blocks into one? :P
IF
	!GlobalTimerNotExpired("RandomSpawnTime","GLOBAL")
	Global("Chapter","GLOBAL",2)
	Global("RandomSpawn","GLOBAL",3)
THEN
	RESPONSE #100
		SetGlobal("RandomSpawn","GLOBAL",0)
		SetGlobalTimer("RandomSpawnTime","GLOBAL",TWO_DAYS)
END

Attached Files


"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#5 Turambar

Turambar
  • Modder
  • 935 posts

Posted 29 December 2012 - 09:04 AM

@sasha: thanks for reporting and investigating

@lollorian: I've come to the same conclusion

Fixed; ready for version 217 (which I plan to upload soon)

Turambar

Currently supporting: DSotSC for BGT, NTotSC - forum

Turambar's fixes and tweaks for BG2, BGT, DSotSC, NTotSC, SoBH and more!

 

Before posting questions (even regarding posts written by myself), please look at Jarno Mikkola's FAQs for the Megamods!
(how to correctly report CTDs)

 


vipersig.jpg