arcane20 Posted August 3, 2011 Share Posted August 3, 2011 (edited) ;--------------------------------------------------------------------------------- Code above this line is working fine -------------------------------------------------------------------------------------- if RefArmor.IsinList MyArmorList ;This will be used to prevent removal of any items that are not part of this mod. Currently causes script to stop but removal of this decision causes script to run smoothly. ;if RefArmor == Myarmor ;debug test1 returns "is in list" Therefore the Reference is Correct. ;if Myarmor.IsinList MyArmorList ;Debug test2 causes the bug to continue & Myarmor is def in the MyArmorList PrintC "RefArmor Is in list" player.removeitem RefArmor 1 Else PrintC "RefEquippedFakeRifle Is not in list" endif ;--------------------------------------------------------------------------------- Code below this line also working fine -------------------------------------------------------------------------------------- This a section of code I'm having trouble with, for somereason it makes the script hang, The function Syntax is: (0, 1:int) [Object].IsInList FormListID:ref So the syntax is correct. As stated The reference is also correct This is used inside an onEquip block The code seems to be correct however something is def wrong. Anymore questions please ask.If you can see what i've done wrong please leave a comment. If you have a workaround to check if an item is in a list please let me know. Thanks in Advance. Fix Ok so I still don't know why this happened but for anyone else having these troubles I found a workaround. Instead of if RefArmor.IsinList MyArmorList Use if ListGetFormIndex MyArmorList RefArmor != -1 ListGetFormIndex returns -1 when an item is not in a list. SO if it is not equal to (!=) -1 then it is in the list. This does exactly the same thing except it works. Edited August 3, 2011 by arcane20 Link to comment Share on other sites More sharing options...
Skevitj Posted August 3, 2011 Share Posted August 3, 2011 As far as I'm aware, the BASIC if test needs a test which will return true or false, hence "RefArmor.IsinList MyArmorList" may return 1, but for the purposes of the if test it's just a meaningless statement. Changing it to "RefArmor.IsinList MyArmorList ==1" should fix that up. Link to comment Share on other sites More sharing options...
arcane20 Posted August 3, 2011 Author Share Posted August 3, 2011 As far as I'm aware, the BASIC if test needs a test which will return true or false, hence "RefArmor.IsinList MyArmorList" may return 1, but for the purposes of the if test it's just a meaningless statement. Changing it to "RefArmor.IsinList MyArmorList ==1" should fix that up. Nah just tried it, same result sandly; script hangs. I'm pretty sure they say the same thing and the condition '==' is unnessesary when you need something to return 1 for true. Thanks for your reply though. Link to comment Share on other sites More sharing options...
arcane20 Posted August 3, 2011 Author Share Posted August 3, 2011 Update I've just found that using 'Player' as a reference doesn't cause the script to hang. So I might assume it's something to do with the type of reference. Link to comment Share on other sites More sharing options...
Recommended Posts