Hey folks,
I have a few questions about Papyrus, as I am somewhat of a Papyrus noob.
I am writing a script which will, when the player reads a particular book (recipe) they will automatically learn a number of ingredient's specific effects.
I have this working overall (learning the effects), however I am trying to add to the script a condition based upon if the book has already been read.
The problem is that the IsRead() function is causing the script to not compile. The error is:
IsRead is not a function or does not exist
My current script is as follows:
Scriptname GBobMagicItemLearnIngredient extends ObjectReference Ingredient Property Herb1 Auto Ingredient Property Herb2 Auto Ingredient Property Herb3 Auto Int Property EffectNum1 AutoInt Property EffectNum2 AutoInt Property EffectNum3 AutoMessage Property LearnMsg1 AutoBook Property CurrentBook Auto <---- do I have this correct?Event OnRead() If CurrentBook.IsRead() <---- where the compile error is Debug.Notification("TEST - You have already read this book.") Else Herb1.LearnEffect(EffectNum1) Herb2.LearnEffect(EffectNum2) Herb3.LearnEffect(EffectNum3) Debug.Notification("TEST - Ingredient effect learned... ") LearnMsg1.Show() EndIfendEvent
For my second question, how do I test for if a property is empty or not? For example, if my 3rd ingredient "Herb3" has not been defined, I would like to skip the Herb3.LearnEffect(EffectNum3) line. The script works as is with this, but it does spam the papyrus log with an error. I want to do something like:
If Herb3 == ""
; do nothing
Else
Herb3.LearnEffect(EffectNum3)
EndIf
But, this doesn't work. I am not that experienced with Papyrus.
For my final question, rather than using Debug.Notification to display simple messages to the player, I am attempting to use the normal Message system. I've created a Message that can be passed as a property. The message is along the lines of "Ingredient effect learned...". I would like to include the name of the effect, or the name of the ingredient in order to be more specific.
Do I have to create a specific Message for each possibility - or can I dynamically alter the message (like you can insert a number)?
Thanks in advance for any help!