Jump to content

Is there is a papyrus syntax guide?


MadRabbitX

Recommended Posts

Is there is a Papyrus syntax guide? Having one of those is always handy. I wasn't scripting for 3 moths, and already forgot syntax for "for" and "when" cycles. But, to be honest i'm looking syntax for a specific thing, which i don't even know an English name, so what i'm looking for, is some kind of a complite syntax guide, with every litle thing discribed in it. For example i'm looking for a Papyrus version of #Define from C++, which is supper helpful thing, when you write a big script.

Thank you in advance!

Edited by MadRabbitX
Link to comment
Share on other sites

Do you know this? http://www.creationkit.com/fallout4/index.php?title=Category:Papyrus

Unfortunately, papyrus is far away from a complete programing language :-\

Of curse i'm using it, it is preaty handy. But thank you anyways.

 

Try this, but yeah like most things when it comes to modding these games there aren't much offical information or guides: http://stuyk.com/forum/viewtopic.php?f=7&t=7

 

EDIT: Check this also: https://community.bethesda.net/thread/8917

Thanks for that. There is something that i didn't manage to find myself on the CK wiki. I was hoping for like a complite guide for every single small thing, but this will do too. Thanks. Now i know for the fact that i++, =+, and some other

operators is not a thing in the Papyrus.

Link to comment
Share on other sites

 

Do you know this? http://www.creationkit.com/fallout4/index.php?title=Category:Papyrus

Unfortunately, papyrus is far away from a complete programing language :-\

That's because it's not a programming language. It's a scripting language. There is a difference. It borrows syntax styles from C++ and various other programming languages like Python though.
This is, technically, wrong. Papyrus is a programming language, not a scripting language, because Papyrus PSC files must be compiled to PEX before the game can use them. The PSC files aren't interpreted on the fly as is done in a scripting language. See http://www.creationkit.com/fallout4/index.php?title=Papyrus_Compiler_Reference for more info. And, yes, the CK Wiki likes to call Papyrus a scripting language, but that is disregarding what the differences between a scripted language and a programming language are.

 

Thanks for that. There is something that i didn't manage to find myself on the CK wiki. I was hoping for like a complite guide for every single small thing, but this will do too. Thanks. Now i know for the fact that i++, =+, and some otherÃÃÂ

operators is not a thing in the Papyrus.

This is incorrect. Papyrus supports assignment operators just fine. See http://www.creationkit.com/fallout4/index.php?title=Operator_Reference#Assignment_Operators for more info. Edited by Reneer
Link to comment
Share on other sites

 

Thanks for that. There is something that i didn't manage to find myself on the CK wiki. I was hoping for like a complite guide for every single small thing, but this will do too. Thanks. Now i know for the fact that i++, =+, and some otherÃÃÂ

operators is not a thing in the Papyrus.

This is incorrect. Papyrus supports assignment operators just fine. See http://www.creationkit.com/fallout4/index.php?title=Operator_Reference#Assignment_Operators for more info.

 

You are wrong about that. There is nothing about me being wrong in this link, and i even tested it all. I think you just misunderstood me. ++ -- =+ (not +=, this is working) are not a thing in Papyrus. However, fun fact, while game refuses to comple WeaponSlotBack =+ 1, it does compile with WeaponSlotBack =- 1.

 

I even tested them all separately, nothing is working besidse WeaponSlotBack =- 1.

 

Code:

 

int WeaponSlotBack = 0

 

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)

WeaponSlotBack++

WeaponSlotBack--

++WeaponSlotBack

--WeaponSlotBack

WeaponSlotBack =+ 1

WeaponSlotBack =- 1

 

 

EndEvent

 

I even made a screenshot. Because i have nothing better to do with my life. :)

http://i.imgur.com/qHpp6F5.jpg

Link to comment
Share on other sites

You are wrong about that. There is nothing about me being wrong in this link, and i even tested it all. I think you just misunderstood me. ++ -- =+ (not +=, this is working) are not a thing in Papyrus. However, fun fact, while game refuses to comple WeaponSlotBack =+ 1, it does compile with WeaponSlotBack =- 1.Â

Â

I even tested them all separately, nothing is working besidse WeaponSlotBack =- 1.

Â

Code:

Â

int WeaponSlotBack = 0

Â

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)

WeaponSlotBack++

WeaponSlotBack--

++WeaponSlotBackÂ

--WeaponSlotBack

WeaponSlotBack =+ 1

WeaponSlotBack =- 1

Â

Â

EndEvent

Â

I even made a screenshot. Because i have nothing better to do with my life. :)

http://i.imgur.com/qHpp6F5.jpg

You're correct, Papyrus doesn't support those particular operators (though I've never heard of =+, what does it do?), but it functionally supports everything you are trying to do.
Link to comment
Share on other sites

Incrementors(+=) and decrementors (-=) do exist in Papyrus but they are written the other way around than your used to. You will find the language reference useful, look up the operators.
http://www.creationkit.com/fallout4/index.php?title=Category:Papyrus_Language_Reference

 

 

Heres two samples of equivalent code.


Function Sample()
	int iValue = 1 ; the value starts at 1

	iValue += 1 ; the value is 2
	iValue += 1 ; the value is 3
	iValue += 1 ; the value is 4

	iValue += 2 ; the value is 6
	iValue += 2 ; the value is 8
	iValue += 2 ; the value is 10

	iValue -= 2 ; the value is 8
	iValue -= 2 ; the value is 6
	iValue -= 2 ; the value is 4

	iValue -= 1 ; the value is 3
	iValue -= 1 ; the value is 2
	iValue -= 1 ; the value is 1
EndFunction

Function SampleEquivalent()
	int iValue = 1 ; the value starts at 1

	iValue = iValue + 1 ; the value is 2
	iValue = iValue + 1 ; the value is 3
	iValue = iValue + 1 ; the value is 4

	iValue = iValue + 2 ; the value is 6
	iValue = iValue + 2 ; the value is 8
	iValue = iValue + 2 ; the value is 10

	iValue = iValue - 2 ; the value is 8
	iValue = iValue - 2 ; the value is 6
	iValue = iValue - 2 ; the value is 4

	iValue = iValue - 1 ; the value is 3
	iValue = iValue - 1 ; the value is 2
	iValue = iValue - 1 ; the value is 1
EndFunction

Papyrus is a scripting language that is s object oriented in nature.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...