t3589 Posted June 10, 2014 Posted June 10, 2014 If an NX int key has a value of let's say... -2, and I come along and NX_ClrEVF on it. Shouldn't it zero it out?
DoctaSax Posted June 10, 2014 Posted June 10, 2014 If an NX int key has a value of let's say... -2, and I come along and NX_ClrEVF on it. Shouldn't it zero it out? It should.
t3589 Posted June 10, 2014 Posted June 10, 2014 Cleared all keys and just this one key kept coming back -2 afterwards. Another script must have caught it just after clear and put itself back in (the value before clear was also -2). Everything else zeroed out fine. Weird. Must have been a timing issue.
prideslayer Posted June 10, 2014 Posted June 10, 2014 Mods fighting over NX keys isn't good, that's why they're namespaced. If it's multiple scripts in your own mod, well, you should be able to track that down without too much trouble.
Swyke Posted June 11, 2014 Posted June 11, 2014 Hello! I try to come back to modding a little bit but I ran into the limits of my knowledge imediately. Still I am struggling with the scanner scripts. Well, I made a potion which should add the courier and a some creatures (in my trial-mod the geckos) to a common faction to make them allys for a while. Now the (example) geckos should approach the courier frequently till the effect of the potion wears off. Switching the geckos to allys and back works fine but ... I don't know how the scanner works and how to make it do what I want! I have copyed a script someone has posted here a while ago, (it looks like the scanner scripts in the tryouts). And I tried to modify it to the functions I need. It doesn't work. I added a few PrintC to see what it does, and it is obviously: The scanner runs through his loops of the npcs which are there in the moment the scanner starts, then it stops and never starts again. For example: I used the potions in the prospector saloon. The scanner runs through the npcs in the formlist, counts down to zero and stops (no gecko here). Now I go outside. There are other npcs. But as the scannes has counted down to zero it is finished. No npcs or creatures are added to the formlist(?). But I need a scanner, that runs as long as the potion effect is on the courier. Sorry, it is not easy to explain, and as I look into the scanner script a few posts above, I do not understand anything. And maybe it is not (only) the scanner script I am doning wrong but the call of the scanner effect, too? OK, here is my script. scn aaSAMScannerEffectScript ref refTarget short bAbort short bCoolDown int iInit int nCount int whileLoop int iFar Begin ScriptEffectStart if (0 == iInit) set iInit to 1 set whileLoop to 1 set nCount to ListGetCount aaSAMListN ; set counter to numper of REFs in Formlist printc "SAM scanner running" ;====Start Loop Label whileLoop if (0 < nCount) set nCount to nCount - 1 set refTarget to ListGetNthForm aaSAMListN nCount ; set Target to Ref in List ; set bCoolDown to (refTarget.IsSpellTarget aaSAMcooldown) ; get the CoolDown Level set bAbort to 0 ; Abort to ZERO if bCoolDown ; Abort if already blocked by Cooldown set bAbort to 1 endif if (refTarget.GetDead) ; Abort if target is dead set bAbort to 1 endif if (refTarget.GetDisabled) ; Abort if target is disabled set bAbort to 1 endif if (refTarget.IsChild) ; Abort if target is a child set bAbort to 1 endif if (refTarget.GetCombatTarget) ; Abort if target is in combat set bAbort to 1 endif if (refTarget.IsEssential) ; Abort if target is essential set bAbort to 1 endif if (0 != refTarget.GetSleeping) ; Abort if target is sleeping set bAbort to 1 endif if (0 == refTarget.GetDetected PlayerREF) ; Abort if target hasn't detected the player set bAbort to 1 endif if (1 == refTarget.GetFactionRelation PlayerREF) ; Abort if target is enemy set bAbort to 1 endif if (refTarget.GetActorCrimePlayerEnemy) ; Abort if target is enemy due to crime against the target set bAbort to 1 endif if (refTarget.GetActorFactionPlayerEnemy) ; Abort if target is enemy due to crime against the faction set bAbort to 1 endif if (refTarget.IsInInterior) ; set maximal distance for interior set iFar to 1024 else set iFar to 2048 ; set maximal distance for exterior endif if (iFar < refTarget.GetDistance PlayerREF) ; abort if the target is to far set bAbort to 1 endif if (refTarget.IsInList SexoutSLCreatureGecko == 0) ; Abort if target is no gecko set bAbort to 1 endif ; if (refTarget.GetIsCreature) ; Abort if target is a creature ; set bAbort to 1 ; endif printc "SAM scanner loop %.0f" nCount printc "is %n" refTarget if (0 == bAbort) ; if no abort happend --> printc "%n Chosen" refTarget refTarget.CIOS aaSAMscannerApproachEFFECT ; ---> START ACTION! ; refTarget.CIOS CoolDownSpellName ; and set cooldown to the target endif If (0 <= nCount) ListRemoveNth aaSAMListN nCount goto whileLoop endif endif ; End looping else PlayerREF.Dispel aaSAMscannerEFFECT endif End Begin ScriptEffectUpdate if iInit PlayerREF.Dispel aaSAMscannerEFFECT endif And I attach the mod-file, too. Maybe someone can push me in the right direction. I am clueless how to make it right. (And please excuse my bad bad bad english) SexoutAnimals.7z
Guest tomm434 Posted June 11, 2014 Posted June 11, 2014 I'm not an expert in scanners but I worked with one for a while. Your Script there checks if someone in the Form list, nothing more. Ok, here is the scanner which works. It searches for a chair near reference that meets my conditions. ref chair ref ChoseChair int ChairNum int ChairCounter if FoundChair ==0 let ChairCounter := 0 let ChairNum := GetNumRefs 39 1 let Chair := GetFirstRef 39 1 let ChosenChair := Chair label 1 if chair.isinlist aaaLunetteUseTerminalChairList If Chair.GetDistance TerminalRef <150 set ChairAngle to chair.getangle Z let AngleDifference := TerminalAngle - ChairAngle if AngleDifference < 0 let AngleDifference += 360 endif if AngleDifference >70 && AngleDifference <110 PrintC "Found Chair" let ChosenChair:= Chair let FoundChair :=1 endif endif endif let ChairCounter +=1 endif if ChairCounter < ChairNum && FoundChair ==0 let Chair := GetNextRef goto 1 else "Do what you want with ChosenChair -reference you need" So if FoundChair ==0 let ChairCounter := 0 let ChairNum := GetNumRefs 39 1 let Chair := GetFirstRef 39 1 let ChosenChair := Chair label 1 let ChairNum := GetNumRefs 39 1 -this returns how much of references of particular type is in the current cell. In my case that's furniture. In yours -creatures. let Chair := GetFirstRef 39 1 - we use Temporary reference to get FIRST reference in the cell of the type you want. SO for example there are many creatures in your cell -dog, deatchlaw and GECKO - it can return any of them Then goes the condition part. That means that for now we check first reference (Chair) for conditions we need. In your case you can add all geckos in a from list and check "if Chair.getinformlist MyGEckoFormlist" or check for their model\skeleton. Use any method you want. Then if conditions are true PrintC "Found Chair" let ChosenChair:= Chair let FoundChair :=1 That means that I set my ChosenChair to the Chair(GetFIrstRef) and changed the variable "FoundChair" so we don't scan anymore and can proceed forward. But it's likely that "GetFirstRef" won't find creature you need. There goes the loop part - let ChairCounter +=1 endif if ChairCounter < ChairNum && FoundChair ==0 let Chair := GetNextRef goto 1 Chair num is the count of references in this cell(we set it at the beginning) Chair counter is the current number of reference checked. So, the GetFirstref" didn't find creature we need(he didn't passed conditions). I let Chaircounter +1 and while contidion is true "if ChairCounter < ChairNum && FoundChair ==0" (we didn't check all references in the room) I set my Chair to "GetNextRef". That means what it means - Now it is not the first ref but the NEXT reference in the cell. Then everything repeats -we check this new ref for contidions we want. If conditions are false - we get NEXTREF. ANd that happend untill we check every ref of particular type in the cell. If FoundChair ==1(We did find the reference that we need) or ChairtCounter>ChairNum (we checked all references) - then we move forward. Now you can check If ChosenChair.gettype ==39 do that else PrintC "No references were found" That means that there is a reference in the cell which fits our conditions. If not, then no geckos. What a shame ^(
DoctaSax Posted June 11, 2014 Posted June 11, 2014 Also, it's good to move away from label/goto loops and start using while loops. And the words "while" and "loop" are now actual loop commands, so shouldn't be used for variable names.
Guest tomm434 Posted June 11, 2014 Posted June 11, 2014 Also, it's good to move away from label/goto loops and start using while loops. And the words "while" and "loop" are now actual loop commands, so shouldn't be used for variable names. Ok. And I have a question. What if I have a quest with very low quest delay =0.001 and I put scanner inside it. And then what if scanner is too slow so it doesn't have time to finish itself before next quest delay expires and script starts executing again. The question is - does loop, while, Label\GoTo commands stop script from starting executing again when script delay(quest delay\EffectScript delay) refreshes? And does the same goes for functions? I remember in you function guide that you said that script stops while function but does it stops completely before functiom\loop block executed?
Guest Posted June 11, 2014 Posted June 11, 2014 ... aaaand I have a related question similar to what tomm said. What if inside a UDF there's a while or loop, some nvse loop I mean, just like a scanner, something that continues looping until it doesn't finish? I mean, what does it happen? since the UDF must complete in a single frame and it always complete? EDIT: of course I could stage that thing with an external variable and Return sometimes, but what I'd like to know is just how the engine behaves in cases like that, if it freezes if the scanner can't resolve in time or what
Guest tomm434 Posted June 11, 2014 Posted June 11, 2014 Ok, I just tried while\loop thing and scripts executes again before this block is finished I put PrintC "quest delay" in gamemode block and set questdelay to 0.0001 This is what I get con_scof LunetteQUestDelayQuestDelayStart ScannerTerminals\TerminalDesk01.NIFTerminal Model is Terminals\TerminalDesk01.NIFFound ChairQuestDelayStart ScannerTerminals\TerminalDesk01.NIFTerminal Model is Terminals\TerminalDesk01.NIFset aaalunettecompanionquest.Hackday to GameDaysPassed +1DONEQuestDelayaaaLunetteCompanionTerminalMarker.getincell aaaLunetteHolderCell ==0 - AT CHAIRQuestDelayUnderSpellQuestDelayUnderSpellQuestDelayUnderSpell So it executes between scanner commands. EDIT Needs confirming
DoctaSax Posted June 11, 2014 Posted June 11, 2014 @tomm434 I hardly ever use high-frequency quests myself. Something about them is disagreeable to me; in the few cases where I need fast-running scripts I usually use spells. Executing once a frame is fast enough for anything, and when you've dispelled a spell it cleans up its vars and everything. UDFs halt a script to go do the UDF. If the UDF is long or complicated, you may notice lag - this is due to the fact that the original script run has to wait for the UDF to return. You may also notice something similar with some non-UDF script functions even. Loops add to the length and complexity of the original script run. In that case, I suppose bulky loops can make the script run 'time out' and give up, as they will if the original just happens to be too complicated. @AJ: a loop has to be able to finish. If not, the game crashes or at least freezes. If a loop isn't infinite but is bulky enough to make a UDF take a long time to finish, then it'll take a long time to finish and you will experience lag. Everything else seems to be halted in the mean time, but there may still be a limit to how long the game will tolerate UDF lag like that. All of the above is what I observed from 'normal' practice, ie not having scripts run more than once a frame. To truly understand the limits of the system we'd need much more extensive testing, with test mods designed to flirt with crashing the game, and compare the results for different hardware configurations too. Me, I tend to want to make functioning mods though, so I stay away from the dark side.
Guest tomm434 Posted June 11, 2014 Posted June 11, 2014 DoctaSax, thanks. I understand.I just tried doing this in function While (iNum += 1) < 5000 PrintC "inum is now %2f" Inum loop And then using it with 0.0001 quest delay When function is called there was a biiig lag(3-4 seconds) and then everything continued. Here is my SCOF file. You can see that between "PrintC "inum is now %2f" Inum" there is no "PrintC quest delay". That means that one can put in function whatever code he wants at it will not be interrupted by the calling script under any circumstances, right? (unless my PC counted to 5000 in less than 0.0001 sec). And if this is true, we can put scanner in function and just call it from quest script. Calling code is elseif Stage == 2 call aaaLunetteUseTerminalFunctionLockLevel ; Определить результат. printC "Start Scanner" let TerminalModel := Terminalref.GetModelPath PrintC "%z" TerminalModel If eval TerminalModel == "Terminals\TerminalDesk01.NIF" PrintC "Terminal Model is Terminals\TerminalDesk01.NIF" else PrintC "Terminal Model is NOT Terminals\TerminalDesk01.NIF" let FoundChair :=2 ; Пропустить сканнер. endif LunetteMarker.rar
DoctaSax Posted June 11, 2014 Posted June 11, 2014 Ah, ok, I might've misunderstood what you were trying to do there... I was kinda worried you mod like that so all I could think of was "wait, what kind of script needs to run ten thousand times a second? Kids these days... mumble, mumble" Well, true it does mean you can have a big-ass loop in a UDF and the UDF will come through, although to be sure there are more complicated things you can do in a loop than printc'ing a variable.
Guest tomm434 Posted June 11, 2014 Posted June 11, 2014 Ah, ok, I might've misunderstood what you were trying to do there... I was kinda worried you mod like that so all I could think of was "wait, what kind of script needs to run ten thousand times a second? Kids these days... mumble, mumble" Well, true it does mean you can have a big-ass loop in a UDF and the UDF will come through, although to be sure there are more complicated things you can do in a loop than printc'ing a variable. It's just an experiment, I don't mod like that. Anyway, I'll try to put scanner into a function and set low quest delay again and see what happens. Me and A.J. are asking these kinda questions because there might be cases when scanner is very tough and people who have weak PC\enb installed might get some glitches because of it.
Guest Posted June 11, 2014 Posted June 11, 2014 Now Doctasax, could you define "lag" in this case? do you mean that the UDF will stutter the game when its executing, or the calling script will halt its execution to make the UDF work? That would be pretty interesting to understand. Let me make an example. I have a scanner that breaks in heavy environments, and it worries me increasing the quest delay because the time is huge (it must be 8 seconds to be really sure). If the scan can't finish before the Quest Delay time, the script will break and nothing else (concerning that specific script) will work anymore, I don't know why but well that's what I noticed for now. Now I'm thinking, if I call that scanner in an external UDF, and the UDF will halt the actual execution of the script, I could MAYBE reduce the quest delay time, since the script in the quest is halted. What do you think?
DoctaSax Posted June 12, 2014 Posted June 12, 2014 or the calling script will halt its execution to make the UDF work? I mean this. But if the UDF takes a long time to finish, then nothing is done in the mean time, the entire game is put on hold, as in tomm's example. I had the same with spunk a while back because I ran everything off UDFs calling other UDFs. None of them were particularly big, but all of them combined halted the first's calling script long enough to produce that effect. I have a scanner that breaks in heavy environments, and it worries me increasing the quest delay because the time is huge (it must be 8 seconds to be really sure). If the scan can't finish before the Quest Delay time, the script will break and nothing else (concerning that specific script) will work anymore, I don't know why but well that's what I noticed for now. Now I'm thinking, if I call that scanner in an external UDF, and the UDF will halt the actual execution of the script, I could MAYBE reduce the quest delay time, since the script in the quest is halted. What do you think? If you see no lag in the original script but it just doesn't get to complete, then exporting that bit to a UDF might work if the objective is to just have your calling script work at a regular quest time delay. If you do see lag, there will probably still be lag. EDIT: That last bit doesn't look right to me, looking at it again. In the end, you can only be sure by testing though.
Guest tomm434 Posted June 12, 2014 Posted June 12, 2014 Reporting in - just placed my scanner into UDF and with quest delay of 0.0001 and quest script didn't interrupt Scanner in function. Wooho! int ChairCounterint ChairNumref Chairref ChosenChairref Terminalfloat TerminalAnglefloat ChairAnglefloat AngleDifferenceBegin Function {}printC "begin Function"let Terminal :=aaaLunetteUseTerminalQuest.Terminalreflet ChairCounter := 0let ChairNum := GetNumRefs 39 1let Chair := GetFirstRef 39 1let ChosenChair := Chairlet TerminalAngle := Terminal.GetAngle ZWhile ChairCounter < ChairNumif chair.isinlist aaaLunetteUseTerminalChairListIf Chair.GetDistance Terminal <150set ChairAngle to chair.getangle Zlet AngleDifference := TerminalAngle - ChairAngleif AngleDifference < 0let AngleDifference += 360endifif AngleDifference >70 && AngleDifference <110PrintC "Found Chair"let aaaLunetteUseTerminalQuest.ChosenChair:= Chairlet aaaLunetteUseTerminalQuest.FoundChair :=1breakendifendifendiflet ChairCounter +=1let Chair := GetNextReflooplet aaaLunetteUseTerminalQuest.Stage := 4printC "FunctionEnded"end Is that heavy enough?
Guest Posted June 12, 2014 Posted June 12, 2014 very nice. it would be funny doing tests increasing scanner's depth and in exteriors...
nyaalich Posted June 12, 2014 Posted June 12, 2014 Ah, ok, I might've misunderstood what you were trying to do there... I was kinda worried you mod like that so all I could think of was "wait, what kind of script needs to run ten thousand times a second? Kids these days... mumble, mumble" What? Spunk doesn't track every single individual sperm? I am disappoint, DoctaSax.
nyaalich Posted June 12, 2014 Posted June 12, 2014 But if the UDF takes a long time to finish, then nothing is done in the mean time, the entire game is put on hold, as in tomm's example. The whole entire game? All other scripts?
DoctaSax Posted June 12, 2014 Posted June 12, 2014 What? Spunk doesn't track every single individual sperm? I am disappoint, DoctaSax. Every sperm may be sacred, but I track and kill them en masse. But if the UDF takes a long time to finish, then nothing is done in the mean time, the entire game is put on hold, as in tomm's example.The whole entire game? All other scripts? Whether it is or isn't, it is to all practical purposes - the calling script is halted, the lag happens, then the calling script and everything else resumes.
Swyke Posted June 12, 2014 Posted June 12, 2014 Sorry that I go back to some basic scanner questions: This was my last my last post from 11. june: Hello! I try to come back to modding a little bit but I ran into the limits of my knowledge imediately. Still I am struggling with the scanner scripts. Well, I made a potion which should add the courier and a some creatures (in my trial-mod the geckos) to a common faction to make them allys for a while. Now the (example) geckos should approach the courier frequently till the effect of the potion wears off. Switching the geckos to allys and back works fine but ... I don't know how the scanner works and how to make it do what I want! I have copyed a script someone has posted here a while ago, (it looks like the scanner scripts in the tryouts). And I tried to modify it to the functions I need. It doesn't work. I added a few PrintC to see what it does, and it is obviously: The scanner runs through his loops of the npcs which are there in the moment the scanner starts, then it stops and never starts again. For example: I used the potions in the prospector saloon. The scanner runs through the npcs in the formlist, counts down to zero and stops (no gecko here). Now I go outside. There are other npcs. But as the scannes has counted down to zero it is finished. No npcs or creatures are added to the formlist(?). But I need a scanner, that runs as long as the potion effect is on the courier. Sorry, it is not easy to explain, and as I look into the scanner script a few posts above, I do not understand anything. And maybe it is not (only) the scanner script I am doning wrong but the call of the scanner effect, too? OK, here is my script. scn aaSAMScannerEffectScript ref refTarget short bAbort short bCoolDown int iInit int nCount int whileLoop int iFar Begin ScriptEffectStart if (0 == iInit) set iInit to 1 set whileLoop to 1 set nCount to ListGetCount aaSAMListN ; set counter to numper of REFs in Formlist printc "SAM scanner running" ;====Start Loop Label whileLoop if (0 < nCount) set nCount to nCount - 1 set refTarget to ListGetNthForm aaSAMListN nCount ; set Target to Ref in List ; set bCoolDown to (refTarget.IsSpellTarget aaSAMcooldown) ; get the CoolDown Level set bAbort to 0 ; Abort to ZERO if bCoolDown ; Abort if already blocked by Cooldown set bAbort to 1 endif if (refTarget.GetDead) ; Abort if target is dead set bAbort to 1 endif if (refTarget.GetDisabled) ; Abort if target is disabled set bAbort to 1 endif if (refTarget.IsChild) ; Abort if target is a child set bAbort to 1 endif if (refTarget.GetCombatTarget) ; Abort if target is in combat set bAbort to 1 endif if (refTarget.IsEssential) ; Abort if target is essential set bAbort to 1 endif if (0 != refTarget.GetSleeping) ; Abort if target is sleeping set bAbort to 1 endif if (0 == refTarget.GetDetected PlayerREF) ; Abort if target hasn't detected the player set bAbort to 1 endif if (1 == refTarget.GetFactionRelation PlayerREF) ; Abort if target is enemy set bAbort to 1 endif if (refTarget.GetActorCrimePlayerEnemy) ; Abort if target is enemy due to crime against the target set bAbort to 1 endif if (refTarget.GetActorFactionPlayerEnemy) ; Abort if target is enemy due to crime against the faction set bAbort to 1 endif if (refTarget.IsInInterior) ; set maximal distance for interior set iFar to 1024 else set iFar to 2048 ; set maximal distance for exterior endif if (iFar < refTarget.GetDistance PlayerREF) ; abort if the target is to far set bAbort to 1 endif if (refTarget.IsInList SexoutSLCreatureGecko == 0) ; Abort if target is no gecko set bAbort to 1 endif ; if (refTarget.GetIsCreature) ; Abort if target is a creature ; set bAbort to 1 ; endif printc "SAM scanner loop %.0f" nCount printc "is %n" refTarget if (0 == bAbort) ; if no abort happend --> printc "%n Chosen" refTarget refTarget.CIOS aaSAMscannerApproachEFFECT ; ---> START ACTION! ; refTarget.CIOS CoolDownSpellName ; and set cooldown to the target endif If (0 <= nCount) ListRemoveNth aaSAMListN nCount goto whileLoop endif endif ; End looping else PlayerREF.Dispel aaSAMscannerEFFECT endif End Begin ScriptEffectUpdate if iInit PlayerREF.Dispel aaSAMscannerEFFECT endif And I attach the mod-file, too. Maybe someone can push me in the right direction. I am clueless how to make it right. (And please excuse my bad bad bad english) I've googled to find the original script. It was t3589s scanner example, he posted it here in february (page 18 of this topic: Here's a quick sample starter of a working scanner you can use to help make things clearer. First add your list and your spell, probably in some quest script.; Add Scanner Listif (0 > (ListGetFormIndex SexoutScannerListN ScannerListName)) ListAddForm SexoutScannerListN ScannerListNameendif; Add Scanner Spellif (0 > (ListGetFormIndex SexoutScannerListS ScannerSpellName)) ListAddForm SexoutScannerListS ScannerSpellNameendifThen use something like this for your scan spell base effect script.scn ScannerScriptref refTargetshort bAbortshort bCoolDownint iInitint nCountint whileLoopint iFarBegin ScriptEffectStart if (0 == iInit) set iInit to 1 set whileLoop to 1 set nCount to ListGetCount ScannerListName ;Start Loop Label whileLoop if (0 < nCount) set nCount to nCount - 1 set refTarget to ListGetNthForm ScannerListName nCount set bCoolDown to (refTarget.IsSpellTarget CoolDownSpellName) set bAbort to 0 if bCoolDown set bAbort to 1 endif if (refTarget.GetDead) set bAbort to 1 endif if (refTarget.GetDisabled) set bAbort to 1 endif if (refTarget.IsChild) set bAbort to 1 endif if (refTarget.GetIsCreature) set bAbort to 1 endif if (refTarget.GetCombatTarget) set bAbort to 1 endif if (refTarget.IsEssential) set bAbort to 1 endif if (0 != refTarget.GetSleeping) set bAbort to 1 endif if (0 == refTarget.GetDetected PlayerREF) set bAbort to 1 endif if (1 == refTarget.GetFactionRelation PlayerREF) set bAbort to 1 endif if (refTarget.GetActorCrimePlayerEnemy) set bAbort to 1 endif if (refTarget.GetActorFactionPlayerEnemy) set bAbort to 1 endif if (refTarget.IsInInterior) set iFar to 1024 else set iFar to 2048 endif if (iFar < refTarget.GetDistance PlayerREF) set bAbort to 1 endif if (0 == bAbort) ; Do Stuffs refTarget.CIOS CoolDownSpellName printc "%n Chosen" refTarget endif If (0 <= nCount) ListRemoveNth ScannerListName nCount goto whileLoop endif endif ; End looping else PlayerREF.Dispel ScannerSpellName endifEndBegin ScriptEffectUpdate if iInit PlayerREF.Dispel ScannerSpellName endifEnd I looked everywhere for a launching point when I began to try and figure out scanners. Hope this is handy. Well I didn't get it run .... And as I had no time to work on this since february, I have forgotten how the things work that work So I asked again, and got tomm434s scanner example: I'm not an expert in scanners but I worked with one for a while. Your Script there checks if someone in the Form list, nothing more. Ok, here is the scanner which works. It searches for a chair near reference that meets my conditions. ref chair ref ChoseChair int ChairNum int ChairCounter if FoundChair ==0 let ChairCounter := 0 let ChairNum := GetNumRefs 39 1 let Chair := GetFirstRef 39 1 let ChosenChair := Chair label 1 if chair.isinlist aaaLunetteUseTerminalChairList If Chair.GetDistance TerminalRef <150 set ChairAngle to chair.getangle Z let AngleDifference := TerminalAngle - ChairAngle if AngleDifference < 0 let AngleDifference += 360 endif if AngleDifference >70 && AngleDifference <110 PrintC "Found Chair" let ChosenChair:= Chair let FoundChair :=1 endif endif endif let ChairCounter +=1 endif if ChairCounter < ChairNum && FoundChair ==0 let Chair := GetNextRef goto 1 else "Do what you want with ChosenChair -reference you need" So if FoundChair ==0 let ChairCounter := 0 let ChairNum := GetNumRefs 39 1 let Chair := GetFirstRef 39 1 let ChosenChair := Chair label 1 let ChairNum := GetNumRefs 39 1 -this returns how much of references of particular type is in the current cell. In my case that's furniture. In yours -creatures. let Chair := GetFirstRef 39 1 - we use Temporary reference to get FIRST reference in the cell of the type you want. SO for example there are many creatures in your cell -dog, deatchlaw and GECKO - it can return any of them Then goes the condition part. That means that for now we check first reference (Chair) for conditions we need. In your case you can add all geckos in a from list and check "if Chair.getinformlist MyGEckoFormlist" or check for their model\skeleton. Use any method you want. Then if conditions are true PrintC "Found Chair" let ChosenChair:= Chair let FoundChair :=1 That means that I set my ChosenChair to the Chair(GetFIrstRef) and changed the variable "FoundChair" so we don't scan anymore and can proceed forward. But it's likely that "GetFirstRef" won't find creature you need. There goes the loop part - let ChairCounter +=1 endif if ChairCounter < ChairNum && FoundChair ==0 let Chair := GetNextRef goto 1 Chair num is the count of references in this cell(we set it at the beginning) Chair counter is the current number of reference checked. So, the GetFirstref" didn't find creature we need(he didn't passed conditions). I let Chaircounter +1 and while contidion is true "if ChairCounter < ChairNum && FoundChair ==0" (we didn't check all references in the room) I set my Chair to "GetNextRef". That means what it means - Now it is not the first ref but the NEXT reference in the cell. Then everything repeats -we check this new ref for contidions we want. If conditions are false - we get NEXTREF. ANd that happend untill we check every ref of particular type in the cell. If FoundChair ==1(We did find the reference that we need) or ChairtCounter>ChairNum (we checked all references) - then we move forward. Now you can check If ChosenChair.gettype ==39 do that else PrintC "No references were found" That means that there is a reference in the cell which fits our conditions. If not, then no geckos. What a shame ^( I haven't tried it (hope, I have a little time on weekend) ... ... but I am even more confused. There are so much BASIC things I do not understand. Why is t3589s scanner using the (sexout)-formlists, while tomm434s scanner is using none? So what is the use of those formlists? Excuse me for bothering.
t3589 Posted June 12, 2014 Posted June 12, 2014 Because one of us is being lazy? No wait, because tomm is such a show off. Yeah, that sounds better.
Guest tomm434 Posted June 12, 2014 Posted June 12, 2014 Because one of us is being lazy? No wait, because tomm is such a show off. Yeah, that sounds better. now that's harsh! Sorry, I looked at the code and saw no reference walking functions + Swyke said that scanner didn't work so I thought that he didn't copy the whole code or something. So, these scanners that use FormLists are faster?
DoctaSax Posted June 12, 2014 Posted June 12, 2014 Because one of us is being lazy? No wait, because tomm is such a show off. Yeah, that sounds better. now that's harsh! Sorry, I looked at the code and saw no reference walking functions + Swyke said that scanner didn't work so I thought that he didn't copy the whole code or something. So, these scanners that use FormLists are faster? Swyke tried to use Sexout's own in-built scanner that grabs all actors in the cell and sticks them in formlists that you add to some of Sexout's. For a sexout mod, that is pretty convenient, if it's actors you're looking for, since sexout is already doing it you don't need to build your own, and add to cpu load.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now