seelenoede Posted July 20, 2015 Posted July 20, 2015 To begin with, I am very new to Papyrus and modding in Skyrim and english is not my native language so don't expect it to be perfect.I am playing around and try to make a script that adds a random DD to the player.The Problem is I try if I try to call "Armor device = Zadlibs.GetGenericDeviceByKeyword(zad_DeviousBelt)" the compiler is saying "missing RPAREN at '\\r\\n'".There are no compiler errors with other functions from zadlibs.Thanks for answers
Guest Posted July 20, 2015 Posted July 20, 2015 Hello. Can you provide your full code example? Looking at the line you wrote: Armor device = Zadlibs.GetGenericDeviceByKeyword(zad_DeviousBelt) you have: * A declaration of an object of type Armor (OK) * You variable "device" (OK) * A reference to another script/object "Zadlibs" (should be OK, but it should be a property) * A call to a function provided by Zadlibs (please be sure of the return value and to the expected parameters) * Another variable used as parameter "zad_DeviousBelt". This one probably is a property to a Keyword object. About the latter you should have something like this in your code: Keyword Property zad_DeviousBelt Auto
seelenoede Posted July 20, 2015 Author Posted July 20, 2015 * A call to a function provided by Zadlibs (please be sure of the return value and to the expected parameters) Thank you for your answer. I am really sure that the return value and the parameters are correct Function to call: Armor Function GetGenericDeviceByKeyword(Keyword kw) * A reference to another script/object "Zadlibs" (should be OK, but it should be a property) [...] * Another variable used as parameter "zad_DeviousBelt". This one probably is a property to a Keyword object. Okay. To be honest I don't really get this with the properties. Basically it is just an public object of a class (or whatever it is called in Papyrus) or am I completly wrong? And zad_DeviousEtc is already defined in Zadlibs. Do I have to define them also in my script. Nevertheless I tried both and there is no difference. So for the whole script (it is kind of embarassing to show it because it is pretty much my first Papyrus script): ScriptName devHelpFuncs Zadlibs Property libs Auto Keyword Property zad_DeviousBelt Auto ;just imagine that there are other properties here Function equipRandomDevice() int i = 0 while (i == 0) int random = Utility.RandomInt(1, 10) If (random == 1) ;collar If (!Game.GetPlayer().GetWornForm(45)) Armor device = libs.GetGenericDeviceByKeyword(zad_DeviousCollar) If (!libs.HasTag(device, "harness") libs.ManipulateDevice(Game.GetPlayer(), device, true) i = 1 EndIf EndIf ElseIf (random == 2) ;arm cuffs If (!Game.GetPlayer().GetWornForm(59)) libs.ManipulateGenericDeviceByKeyword(Game.GetPlayer(), zad_DeviousArmCuffs, true) i = 1 EndIf ElseIf (random == 3) ;leg cuffs If (!Game.GetPlayer().GetWornForm(53)) libs.ManipulateGenericDeviceByKeyword(Game.GetPlayer(), zad_DeviousLegCuffs, true) i = 1 EndIf ElseIf (random == 4) ;gag If (!Game.GetPlayer().GetWornForm(44)) libs.ManipulateGenericDeviceByKeyword(Game.GetPlayer(), zad_DeviousGag, true) i = 1 EndIf ElseIf (random == 5) ;blindfold If (!Game.GetPlayer().GetWornForm(55)) libs.ManipulateGenericDeviceByKeyword(Game.GetPlayer(), zad_DeviousBlindfold, true) i = 1 EndIf ElseIf (random == 6) ;bra If (!Game.GetPlayer().GetWornForm(56)) libs.ManipulateGenericDeviceByKeyword(Game.GetPlayer(), zad_DeviousBra, true) i = 1 EndIf ElseIf (random == 7) ;corset If (!Game.GetPlayer().GetWornForm(58)) Armor device = libs.GetGenericDeviceByKeyword(zad_DeviousCorset) If (!libs.HasTag(device, "harness") libs.ManipulateDevice(Game.GetPlayer(), device, true) i = 1 EndIf EndIf ElseIf (random == 8) ;belt If (!Game.GetPlayer().GetWornForm(49)) Armor device = libs.GetGenericDeviceByKeyword(zad_DeviousBelt) If (!libs.HasTag(device, "harness") libs.ManipulateDevice(Game.GetPlayer(), device, true) EndIf EndIf ElseIf (random == 9) ;harness If (!Game.GetPlayer().GetWornForm(58) || Game.GetPlayer().GetWornForm(49) || Game.GetPlayer().GetWornForm(45)) libs.ManipulateDevice(Game.GetPlayer(), device, true) i = 1 EndIf EndIf EndWhile EndFunction
Guest Posted July 20, 2015 Posted July 20, 2015 Properties in Papyrus are a way to reference objects/scripts from other scripts. The "global" functions are pretty rare. About your code, here some small fixes. Let me know if it will compile. ScriptName devHelpFuncs Zadlibs Property libs Auto Keyword Property zad_DeviousBelt Auto ;just imagine that there are other properties here Actor Property PlayerRef Auto Function equipRandomDevice() bool again = true int timesTried = 0 while again int random = Utility.RandomInt(1, 10) If (random == 1) ;collar If (!PlayerRef.GetWornForm(45)) Armor device = libs.GetGenericDeviceByKeyword(zad_DeviousCollar) If (!libs.HasTag(device, "harness") libs.ManipulateDevice(PlayerRef, device, true) again = false EndIf EndIf ElseIf (random == 2) ;arm cuffs If (!PlayerRef.GetWornForm(59)) libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousArmCuffs, true) again = false EndIf ElseIf (random == 3) ;leg cuffs If (!PlayerRef.GetWornForm(53)) libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousLegCuffs, true) again = false EndIf ElseIf (random == 4) ;gag If (!PlayerRef.GetWornForm(44)) libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousGag, true) again = false EndIf ElseIf (random == 5) ;blindfold If (!PlayerRef.GetWornForm(55)) libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousBlindfold, true) again = false EndIf ElseIf (random == 6) ;bra If (!PlayerRef.GetWornForm(56)) libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousBra, true) again = false EndIf ElseIf (random == 7) ;corset If (!PlayerRef.GetWornForm(58)) Armor device = libs.GetGenericDeviceByKeyword(zad_DeviousCorset) If (!libs.HasTag(device, "harness") libs.ManipulateDevice(PlayerRef, device, true) again = false EndIf EndIf ElseIf (random == 8) ;belt If (!PlayerRef.GetWornForm(49)) Armor device = libs.GetGenericDeviceByKeyword(zad_DeviousBelt) If (!libs.HasTag(device, "harness") libs.ManipulateDevice(PlayerRef, device, true) EndIf EndIf ElseIf (random == 9) ;harness If (!PlayerRef.GetWornForm(58) || PlayerRef.GetWornForm(49) || PlayerRef.GetWornForm(45)) libs.ManipulateDevice(PlayerRef, device, true) again = false EndIf EndIf timesTried += 1 if timesTried>1000 again = false debug.notification("Not possible to do anything...") endIf EndWhile EndFunction And remember after you save the script, that you have to go in the properties and set them up. Refer to my Papyrus guide for a tutorial. (The link is in my signature.)
seelenoede Posted July 20, 2015 Author Posted July 20, 2015 CPU And remember after you save the script, that you have to go in the properties and set them up. Totally forgot that (and overread that) Now. I have finally managed to fill the properties (CK can really be an evil bitch). Result: nothing changed. I still get the same errors. devHelpFuncs.psc(26,43): missing RPAREN at '\\r\\n' devHelpFuncs.psc(59,43): missing RPAREN at '\\r\\n' devHelpFuncs.psc(67,43): missing RPAREN at '\\r\\n' Nice try though and nice changes. Thanks for that.
Guest Posted July 20, 2015 Posted July 20, 2015 OK. Let's debug this step by step. The code has no syntax errors (like missing parenthesis.) Start with just an empty function and try to compile. ScriptName devHelpFuncs Function equipRandomDevice() ; nothing here EndFunction If you can compile, then try to add the properties, and invoke directly one of the functions from Zadlibs (Use basic empty parameters, like None for objects.) If you CANNOT compile, probably you have a script compiling error. Follow my previous post to try to fix it. Try to compile again. If you can compile, then add step by step your code. 'till your script is done. If you CANNOT compile, probably the error is in the Zadlibs. Let me know.
seelenoede Posted July 20, 2015 Author Posted July 20, 2015 Okay the problem is still not solved. Empty function --> no problem With properties --> compiled With everything except the if-statements using "GetGenericDeviceByKeyword" --> works fine With one statement using it --> nope So either it's me who is missing something or zadlibs is trying to make fun of me BTW: here is the source of the function: ; Retrieves a random inventory device with the given keyword, returns none if no devices are availableArmor Function GetGenericDeviceByKeyword(Keyword kw) int n = StorageUtil.FormListCount(kw, "zad.GenericDevice") Armor device = none while device == none && n > 0 ; Fetch a random device int i = Utility.RandomInt(0, n - 1) device = StorageUtil.FormListGet(kw, "zad.GenericDevice", i) as Armor if device == none ; Remove the index from the list if it's none, and avoid clearing the list completely log("Found a none stored generic item, clearing...") StorageUtil.FormListRemoveAt(kw, "zad.GenericDevice", i) n = StorageUtil.FormListCount(kw, "zad.GenericDevice") endIf endWhile return deviceEndFunction EDIT: the function itself compiles if I don't try to save it to a variable and use it like that: libs.ManipulateGenericDevice(PlayerRef, libs.GetGenericDeviceByKeyword(zad_DeviousCollar), true)
Guest Posted July 20, 2015 Posted July 20, 2015 Probably it is a cast problem. The object as a format and the function is expecting a different one. Can you check the definition of the function "ManipulateGenericDevice", please? If the second argument is not an Armor we found the problem.
seelenoede Posted July 20, 2015 Author Posted July 20, 2015 It is not the problem ; As manipulate device, but will operate on any device lacking the zad_BlockGeneric keyword: Even those who's rendered device / keyword you don't know.; Returns true if a device was successfully manipulated. bool Function ManipulateGenericDevice(actor akActor, armor device, bool equipOrUnequip, bool skipEvents = false , bool skipMutex = false) Function ManipulateDevice(actor akActor, armor device, bool equipOrUnequip, bool skipEvents = false) and the other functions like equip and so on use the armor object
Guest Posted July 20, 2015 Posted July 20, 2015 Then I am not sure. Maybe a missing script reference that makes it impossible to compile in the other way.
seelenoede Posted July 21, 2015 Author Posted July 21, 2015 Okay. I found a workaround for me by inspiration of the Cursed Loot scripts. Still not sure about the problem with GetGenericDeviceByKeyword. And now the compilable script: Scriptname devHelpFuncsZadlibs Property libs AutoKeyword Property zad_DeviousBelt AutoKeyword Property zad_DeviousCollar AutoKeyword Property zad_DeviousCorset AutoKeyword Property zad_DeviousHarness AutoKeyword Property zad_DeviousArmCuffs AutoKeyword Property zad_DeviousLegCuffs AutoKeyword Property zad_DeviousGag AutoKeyword Property zad_DeviousBlindfold AutoKeyword Property zad_DeviousBra AutoActor Property PlayerRef AutoFunction equipRandomDevice() bool again = true int timesTried = 0 while again int random = Utility.RandomInt(1, 10) If (random == 1) ;collar If (!PlayerRef.WornHasKeyword(libs.zad_DeviousCollar)) If (libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousCollar, true)) again = false EndIf EndIf ElseIf (random == 2) ;arm cuffs If (!PlayerRef.WornHasKeyword(libs.zad_DeviousArmCuffs)) If (libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousArmCuffs, true)) again = false EndIf EndIf ElseIf (random == 3) ;leg cuffs If (!PlayerRef.WornHasKeyword(zad_DeviousLegCuffs)) If (libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousLegCuffs, true)) again = false EndIf EndIf ElseIf (random == 4) ;gag If (!PlayerRef.WornHasKeyword(zad_DeviousGag)) If (libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousGag, true)) again = false EndIf EndIf ElseIf (random == 5) ;blindfold If (!PlayerRef.WornHasKeyword(zad_DeviousBlindfold)) If (libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousBlindfold, true)) again = false EndIf EndIf ElseIf (random == 6) ;bra If (!PlayerRef.WornHasKeyword(zad_DeviousBra)) If (libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousBra, true)) again = false EndIf EndIf ElseIf (random == 7) ;corset If (!PlayerRef.WornHasKeyword(zad_DeviousCorset)) If (libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousCorset, true)) again = false EndIf EndIf ElseIf (random == 8) ;belt If (!PlayerRef.WornHasKeyword(zad_DeviousBelt)) If (libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousBelt, true)) again = false EndIf EndIf ElseIf (random == 9) ;harness If (!PlayerRef.WornHasKeyword(zad_DeviousHarness)) If (libs.ManipulateGenericDeviceByKeyword(PlayerRef, zad_DeviousHarness, true)) again = false EndIf EndIf EndIf timesTried += 1 if timesTried>1000 again = false debug.notification("Not possible to do anything...") endIf EndWhileEndFunction But I want to thank you, CPU, for your help
Recommended Posts
Archived
This topic is now archived and is closed to further replies.