Jump to content

This script drives me crazy and nuts - HEEELP!


Pellape

Recommended Posts

Damn... I need your eyes as I am now blind, tired and empty as this script ends at State 12 or somewhere after it,

This used to work perfect until I added arrays and storing the positions of the bottles and now it ends here:

 

Possible course?

I start to suspect it is the same type of bug we addressed earlier. I cant find any bugs in my code. See my last comment in this message as well. I will remake some tomorrow. But do peek in case you can find something I did wrong.

50954567212_7a76b8c413_o.png

 

A short description about how the script is meant to work.

  1. You take a bottle from the Top Cabinet right of the rack
  2. You put the bottle at the floor at your position so the object becomes a game reference
  3. You move that bottle in to the rack
  4. New position is added so the next bottle ends up right to the previous one
  5. When a row is filled, I add a number to the z position and the row starts all over.

 

So when a bottle gets added, it also get stored in the array but that array is NULL, everything is NULL

 

I dump the scripts and go an play some games as my head is now completely empty. I do not have a clue what happens here right now:

scn PekFillRackWithBottles02SCR


array_var BottleArr

array_var BottlePosX
array_var BottlePosY
array_var BottlePosZ

array_var BottleAngX
array_var BottleAngY
array_var BottleAngZ

array_var BottleExistArr

Ref BottleRef
Ref BottleRef2
Ref StoredBottleRef
Ref BottleBaseRef
Ref EmptyRef
Ref BeastRef
Ref HandleRef

Float xPos
Float yPos
Float zPos

Float xAngle
Float yAngle
Float zAngle

Float StartX
Float StartY
Float StartZ

;Float RackPosAng

Short Button
Short TurnX
Short TurnZ
;Short Turn
Short BottlesAmmount
Short State
Short Rack
Short DoOnce
Short BottleIndex
Short BottleExist
Short UpdateArrays

Short BottleType
	; Beer 		1
	; Wine01 	2
	; Wine02 	3
	; Milk		4

Begin OnActivate

	Set State to -1
 
End


;;;;;;;;;;;;;;;;;;;;;;;;;;;


Begin GameMode

	If ( State == 0 )
		Return
	EndIf
	
	If ( DoOnce == 0 )
	
		let BottleArr := ar_Construct Array

		let BottlePosX := ar_Construct Array
		let BottlePosY := ar_Construct Array
		let BottlePosZ := ar_Construct Array

		let BottleAngX := ar_Construct Array
		let BottleAngY := ar_Construct Array
		let BottleAngZ := ar_Construct Array
		
		Let BottleExistArr := ar_Construct Array

		Set EmptyRef to 0
		
		let BottleArr[0] := EmptyRef

		let BottlePosX[0] := 0
		let BottlePosY[0] := 0
		let BottlePosZ[0] := 0

		let BottleAngX[0] := 0
		let BottleAngY[0] := 0
		let BottleAngZ[0] := 0

		let BottleExistArr[0] := 0
		
		Set BottleIndex to 1
		
		While ( BottleIndex < 46 )

			let BottleArr[BottleIndex] := 666

			let BottlePosX[BottleIndex] := 0
			let BottlePosY[BottleIndex] := 0
			let BottlePosZ[BottleIndex] := 0

			let BottleAngX[BottleIndex] := 0
			let BottleAngY[BottleIndex] := 0
			let BottleAngZ[BottleIndex] := 0
			
			let BottleExistArr[BottleIndex] := 0
			
			Set BottleIndex to BottleIndex + 1
		
		Loop

		MessageBoxEX "Make sure the 2 bottle racks are empty this first time. Do you want to fill them with Bottles?|No|Yes|Fix positions"
		Set State to 30
		Set UpdateArrays to 1
		
		Set DoOnce to 1
		
	ElseIf ( State == -1 )
		MessageBoxEX "Do you want to fill the rack with Bottles?|No|Yes|Fix positions"
		Set State to 30
		Set UpdateArrays to 1
	EndIf
	
	Set BottleIndex to 1
	
	If ( State == 20 )
		Set Button to GetButtonPressed
		
		If ( Button == 0 )
			Set State to 0
			Return
		ElseIf ( Button == 1 )
			Set State to 1
			Set Button to -1
		ElseIf ( Button == 2 )
			Set State to 30
			Set Button to -1
		EndIf
		
	EndIf
	
	If ( State == 1 )
		Set EmptyRef to 0
		Set BottleType to 0
		Set BeastRef to 666

		Set BottlesAmmount to DrinksCabinet01Ref.GetNumItems
	
		If ( BottlesAmmount == 0 )
			MessageBoxEX "Fill up the Upper Cabinet to the right of the rack with bottles"
			Set State to 0
			Return
		EndIf

		; Filling the upper Rack
		Set Rack to 1
		
		; x steps 10.85
		; z steps 13,37
		Set StartX to PekBottleRackRef.Getpos x - 32.52
		Set StartY to PekBottleRackRef.Getpos y - 3.1
		Set StartZ to PekBottleRackRef.Getpos z + 31.17
				
		Set TurnZ to 1
		Set TurnX to 1

		Set State to 2
	EndIf	
	
	If ( State == 2 )
		If ( TurnZ < 5 )
			If ( TurnX < 6 )

				Set BottleIndex to BottleIndex + 1
				;Scribe "BottleNumber = %0.0f" BottleIndex

				Let BottleExist := BottleExistArr[BottleIndex]
				
				If ( BottleExist == 0 )
					let BottleArr[BottleIndex] := EmptyRef

					let BottlePosX[BottleIndex] := 0
					let BottlePosY[BottleIndex] := 0
					let BottlePosZ[BottleIndex] := 0

					let BottleAngX[BottleIndex] := 0
					let BottleAngY[BottleIndex] := 0
					let BottleAngZ[BottleIndex] := 0
				EndIf

				Let StoredBottleRef := BottleArr[BottleIndex]


				If eval ( StoredBottleRef == BeastRef )
				ElseIf eval ( StoredBottleRef != EmptyRef )
					Let TurnX += 1
					Return
				EndIf
				
				Call PekCheckBottleTypesFUN
				
				
				;Beer and Mead bottles
				Set xPos to StartX + ( 10.85 * TurnX )
				Set yPos to StartY
				Set zPos to StartZ - ( 13.37 * TurnZ )
				
				Set xAngle to -92.5
				Set yAngle to 0
				Set zAngle to 135
				
				If ( BottleType == 2 )
					Set zPos to zPos + 1
					
					Set xAngle to -90
					Set zAngle to 165
				ElseIf ( BottleType == 3 )
					Set zPos to zPos + 1
					
					Set xAngle to -90
				ElseIf ( BottleType == 4 )
					Set xPos to xPos + 0.5
					Set yPos to yPos + 2
					Set zPos to zPos + 1
					
					Set xAngle to -90
				EndIf

				Set TurnX to TurnX + 1

				
				If eval ( BottleRef != EmptyRef )
					Player.PlaceAtMe BottleRef 1
					DrinksCabinet01Ref.RemoveItem BottleRef 1

					Set State to 3
					Return
				EndIf	

		
				
			Else
				Set TurnX to 1
				Set TurnZ to TurnZ + 1
			EndIf
		Else 
			Set State to 11
			Set Rack to 2
		EndIf
	EndIf
	
	If ( State == 3 )
		BottleRef.disable
		Set State to 4
		Return
	EndIf

	If ( State == 4 )
		BottleRef.enable
		Set State to 5
		Return
	EndIf	

	If ( State == 5 )

		;Printc "Bottle == %i %n", BottleRef, BottleRef
	
		set BottleRef2 to GetFirstRef 40 4
		While ( BottleRef2 )
			Set BottleBaseRef to BottleRef2.GetBaseObject
			If eval ( BottleBaseRef == BottleRef )
				Set BottleRef to BottleRef2
				Break
			EndIf
			
			Set BottleRef2 to GetNextRef
		loop
					
		If eval ( BottleRef != PekBottleRackRef || BottleRef == EmptyRef )
			BottleRef.SetPos x xPos
			BottleRef.SetPos y yPos
			BottleRef.SetPos z zPos
			
			BottleRef.SetAngle x xAngle
			BottleRef.SetAngle y yAngle
			BottleRef.SetAngle z zAngle
			
			let BottleArr[BottleIndex] := BottleRef

			let BottlePosX[BottleIndex] := xPos
			let BottlePosY[BottleIndex] := yPos
			let BottlePosZ[BottleIndex] := zPos

			let BottleAngX[BottleIndex] := xAngle
			let BottleAngY[BottleIndex] := yAngle
			let BottleAngZ[BottleIndex] := zAngle
			
			let BottleExistArr[BottleIndex] := 1			
		EndIf
		
		Set State to 6
		Return
	EndIf
	
	If ( State == 6 )
		BottleRef.disable

		Set State to 7
		Return
	EndIf

	If ( State == 7 )
		BottleRef.Enable
		
		If ( Rack == 1 )
			Set State to 2
		ElseIf ( Rack == 2 )
			Set State to 12
		EndIf
		
		Return
	EndIf
	
	;Filling the lower Rack

	; x steps 14
	; z steps 13,22
	If ( State == 11 )
	
		Set StartX to PekBottleRackRef.Getpos x - 35.3
		Set StartY to PekBottleRackRef.Getpos y + 8
		Set StartZ to PekBottleRackRef.Getpos z - 35.3
				
		Set TurnZ to 1
		Set TurnX to 1
		
		Set State to 12
	EndIf
	
	If ( State == 12 )
		
		If ( TurnZ < 5 )
			If ( TurnX < 5 )

				Let BottleIndex := + 1
				;Scribe "BottleNumber = %0.0f" BottleIndex

				Let BottleExist := BottleExistArr[BottleIndex]
				
				If ( BottleExist == 0 )
					let BottleArr[BottleIndex] := EmptyRef

					let BottlePosX[BottleIndex] := 0
					let BottlePosY[BottleIndex] := 0
					let BottlePosZ[BottleIndex] := 0

					let BottleAngX[BottleIndex] := 0
					let BottleAngY[BottleIndex] := 0
					let BottleAngZ[BottleIndex] := 0
				EndIf

				Let StoredBottleRef := BottleArr[BottleIndex]

				If eval ( StoredBottleRef == BeastRef )
				ElseIf eval ( StoredBottleRef != EmptyRef )
					Let TurnX += 1
					Return
				EndIf

				Call PekCheckBottleTypesFUN

				;Beer and Mead bottles
				Set xPos to StartX + ( 14 * TurnX )
				Set yPos to StartY - 15
				Set zPos to StartZ - ( 13.22 * TurnZ )
				
				Set xAngle to -90
				Set yAngle to 0
				Set zAngle to 135
				
				If ( BottleType == 2 )
					Set zPos to zPos + 1
					
					Set zAngle to 165
				ElseIf ( BottleType == 3 )
					Set zPos to zPos + 1
				ElseIf ( BottleType == 4 )
					Set xPos to xPos + 0.5
					Set yPos to yPos + 2
					Set zPos to zPos + 1
				EndIf

				Set TurnX to TurnX + 1
				
				If eval ( BottleRef != EmptyRef )
					Player.PlaceAtMe BottleRef 1
					DrinksCabinet01Ref.RemoveItem BottleRef 1

					let BottleArr[BottleIndex] := BottleRef

					let BottlePosX[BottleIndex] := xPos
					let BottlePosY[BottleIndex] := yPos
					let BottlePosZ[BottleIndex] := zPos

					let BottleAngX[BottleIndex] := xAngle
					let BottleAngY[BottleIndex] := yAngle
					let BottleAngZ[BottleIndex] := zAngle
					
					let BottleExistArr[BottleIndex] := 1

					Set State to 3
					Return
				EndIf
			Else
				Set TurnX to 1
				Set TurnZ to TurnZ + 1
			EndIf
		Else
			Set State to 0
			Set TurnZ to 1
		EndIf
		

	EndIf
	
	
	
	If ( State == 30 )

		Printc "Initiates positioning"

		Set EmptyRef to 0
		Set BeastRef to 666
		Set HandleRef to GetSelf
		
		Set BottleIndex to 1
		
		While (BottleIndex < 46 )

			Let StoredBottleRef := BottleArr[BottleIndex]
		
			If eval ( StoredBottleRef != EmptyRef || StoredBottleRef != BeastRef )
				set BottleRef2 to GetFirstRef 40 4
				While ( BottleRef2 )
					If eval ( BottleRef2 == StoredBottleRef && BottleRef2 != EmptyRef)
						let BottleExistArr[BottleIndex] := 1
						Break
					Else 
						let BottleExistArr[BottleIndex] := 0
					EndIf
					
					Set BottleRef2 to GetNextRef
				loop	

				Let BottleExist := BottleExistArr[BottleIndex]
				
				If ( BottleExist == 1 )
					If Eval ( BottleRef2 != HandleRef )
						Let xPos := BottlePosX[BottleIndex]
						Let yPos := BottlePosY[BottleIndex]
						Let zPos := BottlePosZ[BottleIndex]
						
						Let xAngle := BottleAngX[BottleIndex]
						Let yAngle := BottleAngY[BottleIndex]
						Let zAngle := BottleAngZ[BottleIndex]

						BottleRef2.SetPos x xPos
						BottleRef2.SetPos y yPos
						BottleRef2.SetPos z zPos
						
						BottleRef2.SetAngle x xAngle
						BottleRef2.SetAngle y yAngle
						BottleRef2.SetAngle z zAngle
					EndIf
				EndIf
			EndIf
			
			Printc "BottleIndex = %g - %i %n - Exist? %g" BottleIndex BottleRef2 BottleRef2 BottleExist
			Let BottleIndex += 1
		Loop
		
		If ( UpdateArrays == 1 )
			Set State to 20
			Set UpdateArrays to 0
		Else
			Set State to 0
		EndIf
	EndIf




End

The function that pulls bottles from the top containers on the right side, the Top Cabinet

scn PekCheckBottleTypesFUN

string_var Path
string_var CompPatch

Ref BottleRef
Ref BottleBaseRef
Ref EmptyRef

Float RNDBottleFL

Short BottleType
Short RNDBottleSH
Short BeerTurnCOBL
Short BottlesAmmount
Short ItemType
Short Turn

Short BottleType
	; Beer 		1
	; Wine01 	2
	; Wine02 	3
	; Milk		4
	
	
Begin Function {}

	Label 0

	Set EmptyRef to 0
	Set BottleType to 0

	Set BottlesAmmount to DrinksCabinet01Ref.GetNumItems + 1
	Set RNDBottleFL to Rand 0 BottlesAmmount
	Set RNDBottleSH to RNDBottleFL

	Set BottleRef to DrinksCabinet01Ref.GetInventoryObject RNDBottleSH

	If eval ( BottleRef != EmptyRef || BottleRef == DrinksCabinet01Ref)
		Set ItemType to GetObjectType BottleRef
	EndIf
	
	If ( ItemType != 40 )
		Set BottlesAmmount to BottlesAmmount + 1
		Set Turn to BottlesAmmount
		Scribe "Item Type == %.0f - BottleRef = %i %n" ItemType BottleRef BottleRef
		While ( Turn > -1 )
			Scribe "Turn = %.0f", Turn
			Set BottleRef to DrinksCabinet01Ref.GetInventoryObject Turn
			Scribe "BottleRef = %i %n" BottleRef BottleRef
			If eval ( BottleRef != EmptyRef || BottleRef == DrinksCabinet01Ref)
				Set ItemType to GetObjectType BottleRef
				;Set BottleBaseRef to BottleRef.GetBaseObject
				Scribe "Bottle = %i %n - ItemType Type = %.0f", BottleRef, BottleRef, ItemType
				If eval ( BottleRef != cobBevFlin || BottleRef != cobBevGreef )
					If  eval (BottleRef != cobBevMazte || BottleRef != cobBevShein ) 
						If eval ( BottleRef != PotionSkooma || BottleRef != cobBevSujamma )
							If Eval ( BottleRef != cobBevTelvanniBugMusk || BottleRef != cobBevTea )
								If Eval ( BottleRef != cobSalDrinkHoney ) 
									If ( ItemType == 40 )
										break
									EndIf
								EndIf
							EndIf
						EndIf
					EndIf
				EndIf
			EndIf
			Set Turn to Turn - 1
		Loop
		
		Set BottlesAmmount to BottlesAmmount - 1
		If ( Turn <= 0 )
			MessageBoxEX "Fill up the Upper Cabinet to the right of the rack with bottles"
			Set PekFillRackRef.State to 0
			Return
		EndIf
	EndIf

	If eval ( BottleRef != EmptyRef || BottleRef == DrinksCabinet01Ref)
		Let Path := GetModelPath BottleRef
		Scribe "Path = %z", Path
	EndIf

	Set BeerTurnCOBL to 1

	While ( BeerTurnCOBL < 15 )
		Let CompPatch := ToString BeerTurnCOBL
		If ( BeerTurnCOBL < 10 )
			Let CompPatch := "clutter\Booze\BEER!bottle0" + CompPatch + ".nif"
		Else
			Let CompPatch := "clutter\Booze\BEER!bottle" + CompPatch + ".nif"
		EndIf
		
		If Eval ( Path == CompPatch )
			Set BottleType to 1
			Break
		EndIf
		Set BeerTurnCOBL to BeerTurnCOBL + 1
	Loop
	
	Let CompPatch := ToString "Clutter\AleBottle.NIF"
	If Eval ( Path == CompPatch )
		Set BottleType to 1
	EndIf
	
	Let CompPatch := ToString "Clutter\BeerBottle.NIF"
	If Eval ( Path == CompPatch )
		Set BottleType to 1
	EndIf
	
	Let CompPatch := ToString "Clutter\MeadBottle.NIF"
	If Eval ( Path == CompPatch )
		Set BottleType to 1
	EndIf

	Let CompPatch := ToString "clutter\milkbottle.nif"
	If Eval ( Path == CompPatch )
		Set BottleType to 4
	EndIf
	
	Let CompPatch := ToString "clutter\Booze\BEER!Mead.nif"
	If Eval ( Path == CompPatch )
		Set BottleType to 1
	EndIf
	
	Let CompPatch := ToString "clutter\Booze\BEER!Cider.nif"
	If Eval ( Path == CompPatch )
		Set BottleType to 1
	EndIf
	
	Let CompPatch := ToString "Clutter\winebottle01.NIF"
	If Eval ( Path == CompPatch )
		Set BottleType to 2
	EndIf
	
	Let CompPatch := ToString "Clutter\winebottle02.NIF"
	If Eval ( Path == CompPatch )
		Set BottleType to 3
	EndIf
	
	Let CompPatch := ToString "Clutter\winebottle03.NIF"
	If Eval ( Path == CompPatch )
		Set BottleType to 2
	EndIf

	If ( BottleType == 0 )
		Goto 0
	EndIf 
	
	Set PekFillRackRef.BottleType to BottleType
	Set PekFillRackRef.BottleRef to BottleRef

End
				

Have fun reading this crap.... :wink: I will give you a cup of Dwemer Coffee if you find out what is wrong.

 

Here is what Conscribe wrote last time I ran this script:

Loaded "MigFea.ini" (generic)
Loaded "MigFea - Custom Trainers.ini" (generic)
===============================================
Game Instance : 1 | Time : 02-18-2021 00-17-14
===============================================
HSB:Inserting status bars into HUD
Debug statements toggled off for mod 31
GetFontLoaded >> 15
GetFontLoaded >> 15
HSB:Updated values from ini file
=====
==  Game Loaded
Loaded "Fundament.ini" (generic)
CA: Settings loaded from Data\Ini\Custom Autosave.ini
Loaded "Bundlement.ini" (generic)
EH:Updated values from ini file in data\ini\.
Loaded "MigFEA.ini" (generic)
Loaded "MigFEA - Custom Scribe Items.ini" (generic)
Frostcrag Reborn: no sound plugins active
ef's Ultimate Shopkeeper Mod loaded .ini settings
Initiates positioning
BottleIndex = 2 - 00000000 <no name> - Exist? 0
BottleIndex = 3 - 00000000 <no name> - Exist? 0
BottleIndex = 4 - 00000000 <no name> - Exist? 0
BottleIndex = 5 - 00000000 <no name> - Exist? 0
BottleIndex = 6 - 00000000 <no name> - Exist? 0
BottleIndex = 7 - 00000000 <no name> - Exist? 0
BottleIndex = 8 - 00000000 <no name> - Exist? 0
BottleIndex = 9 - 00000000 <no name> - Exist? 0
BottleIndex = 10 - 00000000 <no name> - Exist? 0
BottleIndex = 11 - 00000000 <no name> - Exist? 0
BottleIndex = 12 - 00000000 <no name> - Exist? 0
BottleIndex = 13 - 00000000 <no name> - Exist? 0
BottleIndex = 14 - 00000000 <no name> - Exist? 0
BottleIndex = 15 - 00000000 <no name> - Exist? 0
BottleIndex = 16 - 00000000 <no name> - Exist? 0
BottleIndex = 17 - 00000000 <no name> - Exist? 0
BottleIndex = 18 - 00000000 <no name> - Exist? 0
BottleIndex = 19 - 00000000 <no name> - Exist? 0
BottleIndex = 20 - 00000000 <no name> - Exist? 0
BottleIndex = 21 - 00000000 <no name> - Exist? 0
BottleIndex = 22 - 00000000 <no name> - Exist? 0
BottleIndex = 23 - 00000000 <no name> - Exist? 0
BottleIndex = 24 - 00000000 <no name> - Exist? 0
BottleIndex = 25 - 00000000 <no name> - Exist? 0
BottleIndex = 26 - 00000000 <no name> - Exist? 0
BottleIndex = 27 - 00000000 <no name> - Exist? 0
BottleIndex = 28 - 00000000 <no name> - Exist? 0
BottleIndex = 29 - 00000000 <no name> - Exist? 0
BottleIndex = 30 - 00000000 <no name> - Exist? 0
BottleIndex = 31 - 00000000 <no name> - Exist? 0
BottleIndex = 32 - 00000000 <no name> - Exist? 0
BottleIndex = 33 - 00000000 <no name> - Exist? 0
BottleIndex = 34 - 00000000 <no name> - Exist? 0
BottleIndex = 35 - 00000000 <no name> - Exist? 0
BottleIndex = 36 - 00000000 <no name> - Exist? 0
BottleIndex = 37 - 00000000 <no name> - Exist? 0
BottleIndex = 38 - 00000000 <no name> - Exist? 0
BottleIndex = 39 - 00000000 <no name> - Exist? 0
BottleIndex = 40 - 00000000 <no name> - Exist? 0
BottleIndex = 41 - 00000000 <no name> - Exist? 0
BottleIndex = 42 - 00000000 <no name> - Exist? 0
BottleIndex = 43 - 00000000 <no name> - Exist? 0
BottleIndex = 44 - 00000000 <no name> - Exist? 0
BottleIndex = 45 - 00000000 <no name> - Exist? 0
BottleIndex = 46 - 00000000 <no name> - Exist? 0
sv
PekFillRackWithBottles02SCR->BottleArr = 97.0000
PekFillRackWithBottles02SCR->BottlePosX = 104.0000
PekFillRackWithBottles02SCR->BottlePosY = 106.0000
PekFillRackWithBottles02SCR->BottlePosZ = 107.0000
PekFillRackWithBottles02SCR->BottleAngX = 108.0000
PekFillRackWithBottles02SCR->BottleAngY = 109.0000
PekFillRackWithBottles02SCR->BottleAngZ = 110.0000
PekFillRackWithBottles02SCR->BottleExistArr = 111.0000
PekFillRackWithBottles02SCR->BottleRef = (FF40E993)
PekFillRackWithBottles02SCR->BottleRef2 = (FF40E993)
PekFillRackWithBottles02SCR->StoredBottleRef = (020016D7)
PekFillRackWithBottles02SCR->BottleBaseRef = (020016D7)
PekFillRackWithBottles02SCR->EmptyRef = (00000000)
PekFillRackWithBottles02SCR->BeastRef = (00000000)
PekFillRackWithBottles02SCR->HandleRef = (730632E0)
PekFillRackWithBottles02SCR->xPos = 1114.7000
PekFillRackWithBottles02SCR->yPos = 2105.0000
PekFillRackWithBottles02SCR->zPos = 1871.9800
PekFillRackWithBottles02SCR->xAngle = -90.0000
PekFillRackWithBottles02SCR->yAngle = 0.0000
PekFillRackWithBottles02SCR->zAngle = 135.0000
PekFillRackWithBottles02SCR->StartX = 1100.7000
PekFillRackWithBottles02SCR->StartY = 2120.0000
PekFillRackWithBottles02SCR->StartZ = 1885.2000
PekFillRackWithBottles02SCR->Button = -1
PekFillRackWithBottles02SCR->TurnX = 1
PekFillRackWithBottles02SCR->TurnZ = 1
PekFillRackWithBottles02SCR->BottlesAmmount = 44
PekFillRackWithBottles02SCR->State = 0
PekFillRackWithBottles02SCR->Rack = 2
PekFillRackWithBottles02SCR->DoOnce = 1
PekFillRackWithBottles02SCR->BottleIndex = 1
PekFillRackWithBottles02SCR->BottleExist = 1
PekFillRackWithBottles02SCR->UpdateArrays = 0
PekFillRackWithBottles02SCR->BottleType = 1
Initiates positioning
BottleIndex = 2 - FF40E993 Stag's Leap Pale Bock - Exist? 1
BottleIndex = 3 - 00000000 <no name> - Exist? 0
BottleIndex = 4 - 00000000 <no name> - Exist? 0
BottleIndex = 5 - 00000000 <no name> - Exist? 0
BottleIndex = 6 - 00000000 <no name> - Exist? 0
BottleIndex = 7 - 00000000 <no name> - Exist? 0
BottleIndex = 8 - 00000000 <no name> - Exist? 0
BottleIndex = 9 - 00000000 <no name> - Exist? 0
BottleIndex = 10 - 00000000 <no name> - Exist? 0
BottleIndex = 11 - 00000000 <no name> - Exist? 0
BottleIndex = 12 - 00000000 <no name> - Exist? 0
BottleIndex = 13 - 00000000 <no name> - Exist? 0
BottleIndex = 14 - 00000000 <no name> - Exist? 0
BottleIndex = 15 - 00000000 <no name> - Exist? 0
BottleIndex = 16 - 00000000 <no name> - Exist? 0
BottleIndex = 17 - 00000000 <no name> - Exist? 0
BottleIndex = 18 - 00000000 <no name> - Exist? 0
BottleIndex = 19 - 00000000 <no name> - Exist? 0
BottleIndex = 20 - 00000000 <no name> - Exist? 0
BottleIndex = 21 - 00000000 <no name> - Exist? 0
BottleIndex = 22 - 00000000 <no name> - Exist? 0
BottleIndex = 23 - 00000000 <no name> - Exist? 0
BottleIndex = 24 - 00000000 <no name> - Exist? 0
BottleIndex = 25 - 00000000 <no name> - Exist? 0
BottleIndex = 26 - 00000000 <no name> - Exist? 0
BottleIndex = 27 - 00000000 <no name> - Exist? 0
BottleIndex = 28 - 00000000 <no name> - Exist? 0
BottleIndex = 29 - 00000000 <no name> - Exist? 0
BottleIndex = 30 - 00000000 <no name> - Exist? 0
BottleIndex = 31 - 00000000 <no name> - Exist? 0
BottleIndex = 32 - 00000000 <no name> - Exist? 0
BottleIndex = 33 - 00000000 <no name> - Exist? 0
BottleIndex = 34 - 00000000 <no name> - Exist? 0
BottleIndex = 35 - 00000000 <no name> - Exist? 0
BottleIndex = 36 - 00000000 <no name> - Exist? 0
BottleIndex = 37 - 00000000 <no name> - Exist? 0
BottleIndex = 38 - 00000000 <no name> - Exist? 0
BottleIndex = 39 - 00000000 <no name> - Exist? 0
BottleIndex = 40 - 00000000 <no name> - Exist? 0
BottleIndex = 41 - 00000000 <no name> - Exist? 0
BottleIndex = 42 - 00000000 <no name> - Exist? 0
BottleIndex = 43 - 00000000 <no name> - Exist? 0
BottleIndex = 44 - 00000000 <no name> - Exist? 0
BottleIndex = 45 - 00000000 <no name> - Exist? 0
BottleIndex = 46 - 00000000 <no name> - Exist? 0
Initiates positioning
BottleIndex = 2 - FF40E993 Stag's Leap Pale Bock - Exist? 1
BottleIndex = 3 - 00000000 <no name> - Exist? 0
BottleIndex = 4 - 00000000 <no name> - Exist? 0
BottleIndex = 5 - 00000000 <no name> - Exist? 0
BottleIndex = 6 - 00000000 <no name> - Exist? 0
BottleIndex = 7 - 00000000 <no name> - Exist? 0
BottleIndex = 8 - 00000000 <no name> - Exist? 0
BottleIndex = 9 - 00000000 <no name> - Exist? 0
BottleIndex = 10 - 00000000 <no name> - Exist? 0
BottleIndex = 11 - 00000000 <no name> - Exist? 0
BottleIndex = 12 - 00000000 <no name> - Exist? 0
BottleIndex = 13 - 00000000 <no name> - Exist? 0
BottleIndex = 14 - 00000000 <no name> - Exist? 0
BottleIndex = 15 - 00000000 <no name> - Exist? 0
BottleIndex = 16 - 00000000 <no name> - Exist? 0
BottleIndex = 17 - 00000000 <no name> - Exist? 0
BottleIndex = 18 - 00000000 <no name> - Exist? 0
BottleIndex = 19 - 00000000 <no name> - Exist? 0
BottleIndex = 20 - 00000000 <no name> - Exist? 0
BottleIndex = 21 - 00000000 <no name> - Exist? 0
BottleIndex = 22 - 00000000 <no name> - Exist? 0
BottleIndex = 23 - 00000000 <no name> - Exist? 0
BottleIndex = 24 - 00000000 <no name> - Exist? 0
BottleIndex = 25 - 00000000 <no name> - Exist? 0
BottleIndex = 26 - 00000000 <no name> - Exist? 0
BottleIndex = 27 - 00000000 <no name> - Exist? 0
BottleIndex = 28 - 00000000 <no name> - Exist? 0
BottleIndex = 29 - 00000000 <no name> - Exist? 0
BottleIndex = 30 - 00000000 <no name> - Exist? 0
BottleIndex = 31 - 00000000 <no name> - Exist? 0
BottleIndex = 32 - 00000000 <no name> - Exist? 0
BottleIndex = 33 - 00000000 <no name> - Exist? 0
BottleIndex = 34 - 00000000 <no name> - Exist? 0
BottleIndex = 35 - 00000000 <no name> - Exist? 0
BottleIndex = 36 - 00000000 <no name> - Exist? 0
BottleIndex = 37 - 00000000 <no name> - Exist? 0
BottleIndex = 38 - 00000000 <no name> - Exist? 0
BottleIndex = 39 - 00000000 <no name> - Exist? 0
BottleIndex = 40 - 00000000 <no name> - Exist? 0
BottleIndex = 41 - 00000000 <no name> - Exist? 0
BottleIndex = 42 - 00000000 <no name> - Exist? 0
BottleIndex = 43 - 00000000 <no name> - Exist? 0
BottleIndex = 44 - 00000000 <no name> - Exist? 0
BottleIndex = 45 - 00000000 <no name> - Exist? 0
BottleIndex = 46 - 00000000 <no name> - Exist? 0
Initiates positioning
BottleIndex = 2 - FF40E993 Stag's Leap Pale Bock - Exist? 1
BottleIndex = 3 - 00000000 <no name> - Exist? 0
BottleIndex = 4 - 00000000 <no name> - Exist? 0
BottleIndex = 5 - 00000000 <no name> - Exist? 0
BottleIndex = 6 - 00000000 <no name> - Exist? 0
BottleIndex = 7 - 00000000 <no name> - Exist? 0
BottleIndex = 8 - 00000000 <no name> - Exist? 0
BottleIndex = 9 - 00000000 <no name> - Exist? 0
BottleIndex = 10 - 00000000 <no name> - Exist? 0
BottleIndex = 11 - 00000000 <no name> - Exist? 0
BottleIndex = 12 - 00000000 <no name> - Exist? 0
BottleIndex = 13 - 00000000 <no name> - Exist? 0
BottleIndex = 14 - 00000000 <no name> - Exist? 0
BottleIndex = 15 - 00000000 <no name> - Exist? 0
BottleIndex = 16 - 00000000 <no name> - Exist? 0
BottleIndex = 17 - 00000000 <no name> - Exist? 0
BottleIndex = 18 - 00000000 <no name> - Exist? 0
BottleIndex = 19 - 00000000 <no name> - Exist? 0
BottleIndex = 20 - 00000000 <no name> - Exist? 0
BottleIndex = 21 - 00000000 <no name> - Exist? 0
BottleIndex = 22 - 00000000 <no name> - Exist? 0
BottleIndex = 23 - 00000000 <no name> - Exist? 0
BottleIndex = 24 - 00000000 <no name> - Exist? 0
BottleIndex = 25 - 00000000 <no name> - Exist? 0
BottleIndex = 26 - 00000000 <no name> - Exist? 0
BottleIndex = 27 - 00000000 <no name> - Exist? 0
BottleIndex = 28 - 00000000 <no name> - Exist? 0
BottleIndex = 29 - 00000000 <no name> - Exist? 0
BottleIndex = 30 - 00000000 <no name> - Exist? 0
BottleIndex = 31 - 00000000 <no name> - Exist? 0
BottleIndex = 32 - 00000000 <no name> - Exist? 0
BottleIndex = 33 - 00000000 <no name> - Exist? 0
BottleIndex = 34 - 00000000 <no name> - Exist? 0
BottleIndex = 35 - 00000000 <no name> - Exist? 0
BottleIndex = 36 - 00000000 <no name> - Exist? 0
BottleIndex = 37 - 00000000 <no name> - Exist? 0
BottleIndex = 38 - 00000000 <no name> - Exist? 0
BottleIndex = 39 - 00000000 <no name> - Exist? 0
BottleIndex = 40 - 00000000 <no name> - Exist? 0
BottleIndex = 41 - 00000000 <no name> - Exist? 0
BottleIndex = 42 - 00000000 <no name> - Exist? 0
BottleIndex = 43 - 00000000 <no name> - Exist? 0
BottleIndex = 44 - 00000000 <no name> - Exist? 0
BottleIndex = 45 - 00000000 <no name> - Exist? 0
BottleIndex = 46 - 00000000 <no name> - Exist? 0
Initiates positioning
BottleIndex = 2 - FF40E993 Stag's Leap Pale Bock - Exist? 1
BottleIndex = 3 - 00000000 <no name> - Exist? 0
BottleIndex = 4 - 00000000 <no name> - Exist? 0
BottleIndex = 5 - 00000000 <no name> - Exist? 0
BottleIndex = 6 - 00000000 <no name> - Exist? 0
BottleIndex = 7 - 00000000 <no name> - Exist? 0
BottleIndex = 8 - 00000000 <no name> - Exist? 0
BottleIndex = 9 - 00000000 <no name> - Exist? 0
BottleIndex = 10 - 00000000 <no name> - Exist? 0
BottleIndex = 11 - 00000000 <no name> - Exist? 0
BottleIndex = 12 - 00000000 <no name> - Exist? 0
BottleIndex = 13 - 00000000 <no name> - Exist? 0
BottleIndex = 14 - 00000000 <no name> - Exist? 0
BottleIndex = 15 - 00000000 <no name> - Exist? 0
BottleIndex = 16 - 00000000 <no name> - Exist? 0
BottleIndex = 17 - 00000000 <no name> - Exist? 0
BottleIndex = 18 - 00000000 <no name> - Exist? 0
BottleIndex = 19 - 00000000 <no name> - Exist? 0
BottleIndex = 20 - 00000000 <no name> - Exist? 0
BottleIndex = 21 - 00000000 <no name> - Exist? 0
BottleIndex = 22 - 00000000 <no name> - Exist? 0
BottleIndex = 23 - 00000000 <no name> - Exist? 0
BottleIndex = 24 - 00000000 <no name> - Exist? 0
BottleIndex = 25 - 00000000 <no name> - Exist? 0
BottleIndex = 26 - 00000000 <no name> - Exist? 0
BottleIndex = 27 - 00000000 <no name> - Exist? 0
BottleIndex = 28 - 00000000 <no name> - Exist? 0
BottleIndex = 29 - 00000000 <no name> - Exist? 0
BottleIndex = 30 - 00000000 <no name> - Exist? 0
BottleIndex = 31 - 00000000 <no name> - Exist? 0
BottleIndex = 32 - 00000000 <no name> - Exist? 0
BottleIndex = 33 - 00000000 <no name> - Exist? 0
BottleIndex = 34 - 00000000 <no name> - Exist? 0
BottleIndex = 35 - 00000000 <no name> - Exist? 0
BottleIndex = 36 - 00000000 <no name> - Exist? 0
BottleIndex = 37 - 00000000 <no name> - Exist? 0
BottleIndex = 38 - 00000000 <no name> - Exist? 0
BottleIndex = 39 - 00000000 <no name> - Exist? 0
BottleIndex = 40 - 00000000 <no name> - Exist? 0
BottleIndex = 41 - 00000000 <no name> - Exist? 0
BottleIndex = 42 - 00000000 <no name> - Exist? 0
BottleIndex = 43 - 00000000 <no name> - Exist? 0
BottleIndex = 44 - 00000000 <no name> - Exist? 0
BottleIndex = 45 - 00000000 <no name> - Exist? 0
BottleIndex = 46 - 00000000 <no name> - Exist? 0


Damn, it did store a bottle at Index 2.... :wink: Fantastic

 

I just got one idea, and it is to exchange all set to let for all OBSE functions but I do that tomorrow as that way, We can get offset when the let function fails. I did read some of the now old script and found a lot of set that can be exchanged.

Edited by Pellape
Link to comment
Share on other sites

I couldn't yet look through the entirety of the work flow, but do check your "BottleIndex" in all States. It's very often increased like in a loop, but only very rarely reset to start over. Especially there's one loop situation in State 2 where it starts with an increment, but "BottleIndex" was previously already set to "1", so this loop will always start at "2", as can also be seen in the output above. Don't think that's intentional or is it?

 

Though I'm wondering... The printout above is coming from State 30 only, not the one where I'm seeing "BottleIndex" be "2" at the start. And yet, even though it neither starts at "2" nor is allowed to reach "46" within the loop, that's what the printout says. Is this perhaps just a timing problem, "printc" firing shortly "after" the increment before it in code took place? It's pretty weird either way.

 

And there's one line right at the start of State 12: "Let BottleIndex := + 1", which either isn't correct syntax to begin with or won't do what I think you want it to do. If it "does" accept the "+ 1" and won't take it as an error, then it will simply set "BottleIndex" to "1". It does look like it's intended as another increment though, which types like this it won't do. Increment in an OBSE statement is "Let BottleIndex += 1", or as you previously did "Let BottleIndex := BottleIndex + 1".

 

Maybe I'll be able to give it a closer look again later, when there's break or I'm done with work, and after a good night morning's sleep.

Link to comment
Share on other sites

That's interesting. You hadn't any issues using SetPos?

As it doesn't work as clean as MoveTo or PositionCell.

 

I would have rather used something like that,

            Let zAngle *= 0.01745 ;=> You need this as PositionCell doesn't use degrees for the ZAngle, but radians'
            BottleRef.PositionCell xPos, yPos, zPos, zAngle, <Your CellName>
            BottleRef.SetAngle x xAngle ;=> Not sure if PositionCell takes over the x and y angle, but if not then this should do it.
            BottleRef.SetAngle y yAngle

but if it works fine for you then that's good.
Guess SetPos only causes issues on static object, not on activateable ones.

 

Like moving a static brick or stone with SetPos will move it visually, but its collision still stays at the default position.

Having a stone in front of a cave entry for example. Moving it with SetPos will still give you an invisible collision in front of the entry. XD

 

 

 

I also like to use PositionCell to move a thing from one cell to another.

While "MoveTo" works well for moving NPCs to a specific marker, moving objects to markers may cause issues as markers are big and objects (like shoes for example XD) are tiny.

 

Therefore I like to use PositionCell in that regard.

 

BUT, it doesn't work as good as it should.

 

As if you move an object from one cell to another via a quest script, while the player is NOT in the target destination the object not appear there.

Therefore I had to make sure the object only gets moved when the player is in the target cell.

if Player.GetInCell <Target Cell>
object.PositionCell blabla
endif

Works fine then. :smile:

 

 

 

 

 

 

About the issues, I couldn't find any problem either at first look. :sad:

Will check again, but I guess direct debugging with

printc "BIndex: %.0f, Bottle: %n, State: %.0f" BottleIndex, BottleRef, State

and also with much more variables will help you out.

 

Hm, you may be aware of much better way to debug things. ^^

I am oldschool in that regard.

Putting in my own debug messages at specifc places in the script and check the results ingame.

 

When I am really mad at the script I sometimes put in

printc "f*** YOU!"

God beware I ever forget to delete these debug messages. ^^

 

 

Luckily the CS(E) allows you to search for "PrintC" and it will list all entities that use this command. So cleaning out self-made debug messages should be easy then.

Link to comment
Share on other sites

Me too. I agree with you both. :smile:

Very good you did point that setpos thing out as well JustChill. When I move stuff to my self using moveto, like my portals or stuff I do summon with my Summon Stuff spell, I let the blink a frame, enable and disable as then the collision will appear. I will move loads of stuff later on from my dummy cell to cells all over Cyrodiil when I make the collecting quests, to fill the whole bloody house with stuff, turning it into a museum, exactly or rather similar to Legacy of the Dragonborn

Drake. These 2 ways of incrementing stuff is exactly the same:

Set Variable to Variable + 1
Let Variable += 1

The later one is more equal to how to increment stuff in C

Variable++;

We see them here: OBSE Operators

 

Drake. I do think that when I set the BottleIndex to 1, might be a mistake, I did find it at another position as well and it makes no sense. I will take a look at it. I could have made a function with some of the code in state 2 and 12 as they are very similar.

 

One possible solution

Otherwise, as I did mentioned in the last line of all that text is, that I will exchange every set with a let, in those cases an OBSE command is used and that way we might get offset info in the console. I do suspect I encounter the container bug or the ghost object somewhere in my script. Kat and Idle are hunting the ghost object and it is most likely an Oblivion bug, if I make a wild guess.

 

JustChill: You see that I also have debug info in my function, debug info I forgot to delete and I use scribe there, so if I had published this, if it worked as it was meant too, the other players would have had crashes in the kitchen or a rack filler that wouldn't done anything, not added a single bottle. I will add printc debug info now every where. Those 2 racks have 46 bottles all together but stops at bottle 27, so I must compare state 2 and state 12 with eachothers as bottle 1-25 gets added in the top rack at state 2 and that works great as you can see and bottle 26-46 gets added to the lower rack in state 12 and there it goes wrong as this picture clearly also show:

50954567212_7a76b8c413_o.png

 

 

I must also add that it looks so damn cool when the bottles gets added. I should make a video of it. It adds approx 2 bottles per second and every bottle sound like a bottle as well, so it clinks a lot inside the rack.

 

CLINK

CLINK

CLINK

CLINK

CLINK

CLINK

CLINK

CLINK

...

 

So why only 2 bottles per second?? Well I do have somewhere between 10-20 fps in the kitcken and as you see, the script takes several frames to run as I keep exit it, so it takes 5-10 frames to run all states. I have not counted, as it is an exact number of course, but you get the picture I guess. I make a video later and add it here. :D

Edited by Pellape
Link to comment
Share on other sites

 

Very good you did point that setpos thing out as well. When I move stuff to my self, like my portals or stuff I do summon with my Summon Stuff spell, I let the blink a frame, enable and disable as then the collision will appear.

 

Ah, sorry for overlooking that.

I see it's State 3 and 4 where you fix the collision.

 

I guess with PositionCell you could skip these 2 states at all. :D

 

 

I would love to see a video about. :wink:

I've made a similar case, just with the exception of having really items in it. As in my case, these are just static objects. XD

It's rather a container which dynamically showcases its inside in New Vegas:

.

You are also NOT allowed to put anything else into the container than the items for which it is desired.

 

These are poorly scripted... I mean I wrote a dumb amount of script, while I could lower it down.

But this mod was one of the first where I freely programmed without the support of my mentor and after all, it just works. ^^

Link to comment
Share on other sites

Well I love relative math, as the bottles gets added to the rack from the rack position, which also mean that if I have 2 racks added elsewhere, with the same angle, I can use this script again as it is. I only need to change the container ref.

 

Positioncell is not relative but I could get where the rack is but setpos is not relative anyway and then use its position as base with some adjustment, I can use positioncell from that position. This require some investigations of course. I will use that function later in my quests. I do not like radians but I did use it at some point but I forgot where.

Link to comment
Share on other sites

You can convert degrees to radians by multiplying the variable that holds the degree amount with 0.01745. :smile:

Except it might be good to convert the outcome in a float with only 4 decimal values, even though I am not sure if using floats with more decimal values is bad for PositionCell.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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