TobiPL Posted September 6, 2019 Report Share Posted September 6, 2019 Jesteście prawdziwą Perełką !... Lubię przeglądać nowości w programowania, każdego tygodnia wyszukują C++ Kurs oraz C++ Poradnik na YouTube i ustawiam filtr na ostatni tydzień Od niedawna zacząłem interesować się również forami... Jakim cudem jest tak wiele postów sprzed ponad 2/4 lat !... na pierwszych stronach są widoczne posty z 2013 roku... powinniście zareklamować skuteczniej swoje Formu :x... Co prawda ma sporo niedociągnięć oraz braków jednak wygląda zdecydowanie lepiej niż cpp0x czy inne beznadziejne fora... Jednak aby nie być oskarżonym o bezwartościowy post... to OK... Mam taki problem że mi to się nie kompiluje... Kompilator wywala błąd i nie umiem znaleźć powodu :)... ahh ja !... Ja !... CZEMU?... Ktoś mi odpowie?... jest to Język Skryptowy Papyrus dla Bethesdy... Scriptname QLG_Script_SwitchLight extends ObjectReference { Script to Light Up all Lights in List and turn them out after Time This script is created by TobiPL for Braverock 3 } Import Sound ;===- Base Info. -===; ;Created: 2019-03-17 ;Update: 2019-04-19 ;Author: TobiPL ;Unit: M.PC<1> ;===- Var. setup -============================================ Actor Property QPlayer Auto { Player Ref. } ;===- Items Var. -=============================== ;***********************************************; FormList Property QData auto { List of Used items << Order >> :0: - Light :1: - Light Effect :2: - Static :3: - Sound Marker } ObjectReference[] QDataArray Sound Property QSoundFireUp Auto { Sound to Play on fire activate } Sound Property QSoundFireOut Auto { Sound to Play on fire deactivate } Float Property QTurnOffDelay auto { Time in GameH to Off Light, 0.5 Mean 30 Min } Float Property QTrunOffMin Auto { Min. in GameH time to Off Light, after this use only Delay } GlobalVariable Property QDebug Auto { Global, true/false to show Debug Notifications ! please, use "QLG_DEBUG_SCRIPT" } ;================================================ ;===- Main Script -============================== ;***********************************************; Ev ent OnInit() If( QDebug as bool ) Debug.Notification( "Starting Initialization" ) EndIf ;*********************************; If( FirstUse ) Constructor() FirstUse = false EndIf If( QFired ) GoToState( "QState_Working" ) Else GoToState( "QState_Ready" ) EndIf ;*********************************; If( QDebug as bool ) Debug.Notification( "Initialization Finished" ) EndIf EndEvent;==- Var. List -==; Bool FirstUse = true ; ;*************************; State Wait ; Do Nothing EndState ;================================================ ;***********************************************; State QState_Ready Event OnTriggerEnter( ObjectReference QRef ) If( QRef != QPlayer ) Return EndIf If( QDebug as bool ) Debug.Notification( "Triggered QLG_Script_SwitchLight" ) EndIf QFired = true; GoToState( "QState_Working" ) QLFireUp() RegisterForSingleUpdateGameTime( QTurnOffDelay + QTrunOffMin ) EndEvent EndState;==- Var. List -==; ;*************************; Bool QFired = false; ; ;================================================ ;***********************************************; State QState_Working Event OnUpdateGameTime() If( QLUpdateFire() ) RegisterForSingleUpdateGameTime( QTurnOffDelay ) If( QDebug as bool ) Debug.Notification( "Update Fire, Fires left: " + AMT ) EndIf Else QFired = false; UnregisterForUpdateGameTime() GoToState( "QState_Ready" ) If( QDebug as bool ) Debug.Notification( "Fire out" ) EndIf EndIf EndEvent EndState;==- Var. List -==; ; ; ;================================================ ;***********************************************; Bool Function QLUpdateFire() Int Rand = QChain_GetRandomID() If( QDebug as bool ) Debug.Notification( "Fire Update, ID: " + Rand ) EndIf ObjectReference[] TempArray TempArray = new ObjectReference [ 4 ] ; Light, Effect, Static, Sound TempArray[ 0 ] = QDataArray[ 4 * Rand ] TempArray[ 1 ] = QDataArray[ 4 * Rand + 1 ] TempArray[ 2 ] = QDataArray[ 4 * Rand + 2 ] TempArray[ 3 ] = QDataArray[ 4 * Rand + 3 ] If( ( TempArray[0] ) || ( TempArray[1] ) || ( TempArray[2] ) || ( TempArray[3] ) ) Debug.Notification( "Fire Update, All Objects are Good" ) Else Debug.Notification( "Fire Update, Few Objects are Bad" ) EndIf QLPlayFireOut( TempArray ) QChain_RemoveID( Rand ) If( AMT == 0 ) Return False EndIf Return true EndFunction;==- Var. List -==; ; ; ;================================================ ;***********************************************; Function QLFireUp() ObjectReference[] TempArray TempArray = new ObjectReference [ 4 ] ; Light, Effect, Static, Sound Int DataSize = QData.GetSize() DataSize /= 4 Int i = 0 While ( i < DataSize ) TempArray[ 0 ] = QDataArray[ 4 * i ] TempArray[ 1 ] = QDataArray[ 4 * i + 1 ] TempArray[ 2 ] = QDataArray[ 4 * i + 2 ] TempArray[ 3 ] = QDataArray[ 4 * i + 3 ] If( ( TempArray[0] ) || ( TempArray[1] ) || ( TempArray[2] ) || ( TempArray[3] ) ) Debug.Notification( "Fire UP, All Objects are Good" ) Else Debug.Notification( "Fire UP, Objects are Bad" ) EndIf QChain_Add( i ) QLPlayFireUp( TempArray ) Utility.Wait( 0.1 ) i += 1 If( QDebug as bool ) Debug.Notification( "Fire Created, ID: " + i ) EndIf EndWhile EndFunction;==- Var. List -==; ; ; ;================================================ ;***********************************************; Function QLPlayFireUp( ObjectReference[] Data ) Int SoundTemp = QSoundFireUp.Play( Data[2] ) Data[0].Enable( true ) ; Enable Light Data[1].Enable( true ) ; Enable Effect Utility.Wait( 0.1 ) ; Wait Data[1].Disable( true ) ; Disable Effect Data[2].Enable( true ) ; Enable Static Data[3].Enable() ; Enable Sound Marker Utility.Wait( 0.2 ) ; Wait StopInstance( SoundTemp ) EndFunction;==- Var. List -==; ; ; ;================================================ ;***********************************************; Function QLPlayFireOut( ObjectReference[] Data ) Int SoundTemp = QSoundFireOut.Play( Data[2] ) Data[2].Disable( true ) ; Disable Static Utility.Wait( 0.3 ) ; Wait Data[0].Disable( true ) ; Disable Light Data[3].Disable( true ) ; Disable Sound Marker Utility.Wait( 0.3 ) ; Wait StopInstance( SoundTemp ) EndFunction ;========================================================== ;*******************************************************************; ;===- Class QChain -================================================= ;*******************************************************************; ;========================================================== ; Item Structure ; ; Int[] NextID ; Next Item ID Int[] PrevID ; Prev Item ID Int[] RefID ; Value to Object ID ;*******************************************; ; Free Strusture ; ; Int[] List ; List of Free IDs Int First ; First Free ID ;*******************************************; ; Var. List ; ; Int LastUsed ; Last Used Item Int FirstID ; First Item Int LastID ; Last Item Int AMT ; Amount Of Items Int Size = 32 ; Size of Array ;*******************************************; ;================================================ ;***********************************************; Int Function QChain_GetRandomID() Int Temp = FirstID Int Rand = Utility.RandomInt( 0 , AMT ) Int i = 0 While ( i < Rand ) Temp = NextID[ Temp ] i += 1 EndWhile Return RefID[ Temp ] EndFunction ;_______________________________________________; ;===============================================; ;***********************************************; Bool Function QChain_Add( int NewValue ) If( AMT == Size ) Return false EndIf int NewItemID = List[ First ] PrevID[ FirstID ] = NewItemID NextID[ LastID ] = NewItemID NextID[ NewItemID ] = FirstID PrevID[ NewItemID ] = LastID RefID[ NewItemID ] = NewValue LastID = NewItemID; First -= 1 AMT += 1 Return true EndFunction ;_______________________________________________; ;===============================================; ;***********************************************; Bool Function QChain_RemoveID( int ID ) If( AMT == 0 ) Return false EndIf int ItemID = FirstID Int i = 0 While ( i < AMT ) If( ID == ItemID ) AMT -= 1 First += 1 List[ First ] = ID NextID[ PrevID[ ItemID ] ] = NextID[ ItemID ] PrevID[ NextID[ ItemID ] ] = PrevID[ ItemID ] If( ItemID == FirstID ) FirstID = NextID[ ItemID ] EndIf If( ItemID == LastID ) LastID = PrevID[ ItemID ] EndIf Return true EndIf ItemID = NextID[ ItemID ] i += 1 EndWhile Return false EndFunction ;_______________________________________________; ;===============================================; ;***********************************************; Function Constructor() NextID = new Int [ 32 ] PrevID = new Int [ 32 ] RefID = new Int [ 32 ] List = new Int [ 32 ] QDataArray = new ObjectReference [ 128 ] Int T = 0 Int DataSize = QData.GetSize() While ( T < DataSize ) QDataArray[ T ] = QData.GetAt( T ) as ObjectReference T += 1 EndWhile First = Size - 1 Int i = 0 While ( i < Size ) List[i] = ( Size - i ) - 1 ; NextID[i] = 0; PrevID[i] = 0; RefID[i] = 1; i += 1 EndWhile AMT = 0; LastUsed = 0; FirstID = 0; LastID = 0; EndFunction ;***********************************************; ;=============- QChain Class END -==============; ;***********************************************; ; Hello I'm Tobi and my Sexy Cat is Nicole !... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.