Difference between revisions of "Papyrus Introduction/fr"
Jump to navigation
Jump to search
m
no edit summary
imported>Ereksen m |
imported>Ereksen m |
||
Line 6: | Line 6: | ||
=Papyrus, qu'est-ce que c'est ?= | =Papyrus, qu'est-ce que c'est ?= | ||
Papyrus est le langage de script utilisé pour réaliser Skyrim. Il fonctionne par la réception d'[[Events/fr|évènements (Events)]] émis par le jeu, et envoyés [[Function Reference/fr|par des fonctions call]]. C'est le ciment qui relie les [[quests/fr|quêtes]] ensembles, en donnant des valeurs à des [[ | Papyrus est le langage de script utilisé pour réaliser Skyrim. Il fonctionne par la réception d'[[Events/fr|évènements (Events)]] émis par le jeu, et envoyés [[Function Reference/fr|par des fonctions call]]. C'est le ciment qui relie les [[quests/fr|quêtes]] ensembles, en donnant des valeurs à des [[Variables and Properties/fr|variables et propriétés]] basées sur les actions du joueur, se mettant à l'écoute et répondant aux évènement spécifiques du jeu. Il pilote également la plupart des fonctionnalités des [[Activator/fr|objets animés]] qui nécessitent une interaction avec le joueur ou PNJ, et la plupart du comportement complexe des [[Magic Effect/fr|effets magiques]]. | ||
Fondamentalement, Papyrus est orienté-objet par nature. Pour avoir un aperçu de ce que cela signifie et une large vue du langage, continuez la lecture plus avant. Les utilisateurs ayant une expérience d'environnement orientés objets, peuvent simplement parcourir la page [[:Category:Script Objects/fr|Script Objects]] qui devrait donner une assez bonne idée de la façon dont les choses fonctionnent. | Fondamentalement, Papyrus est orienté-objet par nature. Pour avoir un aperçu de ce que cela signifie et une large vue du langage, continuez la lecture plus avant. Les utilisateurs ayant une expérience d'environnement orientés objets, peuvent simplement parcourir la page [[:Category:Script Objects/fr|Script Objects]] qui devrait donner une assez bonne idée de la façon dont les choses fonctionnent. | ||
Line 14: | Line 14: | ||
=What's in a Papyrus script?= | =What's in a Papyrus script?= | ||
The language of papyrus can be broken down into a handful of concepts: '''[[:Category:Script_Objects|Objects]], [[Function Reference|Functions]], [[Events]], [[Variables and Properties]].''' The '''[[Script_File_Structure|Script File Structure]]''' page provides information and examples of these concepts. | The language of papyrus can be broken down into a handful of concepts: '''[[:Category:Script_Objects|Objects]], [[Function Reference|Functions]], [[Events]], [[Variables and Properties/fr]].''' The '''[[Script_File_Structure|Script File Structure]]''' page provides information and examples of these concepts. | ||
Each script is defined to be a type of '''[[:Category:Script_Objects|Object]]''', such as a “[[Quest]]”, a “[[Reference]],” an “[[Actor]],” or a “[[Book]].” For the most part, these script objects correlate exactly to the objects found in the editor's masterfile. | Each script is defined to be a type of '''[[:Category:Script_Objects|Object]]''', such as a “[[Quest]]”, a “[[Reference]],” an “[[Actor]],” or a “[[Book]].” For the most part, these script objects correlate exactly to the objects found in the editor's masterfile. | ||
Line 22: | Line 22: | ||
Scripts also have '''[[Events]],''' which are like function calls that the game itself calls on the object. For example, there is an [[OnDeath - Actor|OnDeath()]] event, that the game sends to [[Actor Script]]s attached to an actor when the actor dies. This allows you to respond to game events, for example, completing a quest after the player kills a particular enemy. Therefore, [[Function Reference|Functions]] as described in the previous paragraph are typically called ''within'' an event. | Scripts also have '''[[Events]],''' which are like function calls that the game itself calls on the object. For example, there is an [[OnDeath - Actor|OnDeath()]] event, that the game sends to [[Actor Script]]s attached to an actor when the actor dies. This allows you to respond to game events, for example, completing a quest after the player kills a particular enemy. Therefore, [[Function Reference|Functions]] as described in the previous paragraph are typically called ''within'' an event. | ||
A script can also have '''[[Variables and Properties|Variables]]'''. A variable is a value that can be modified and reference by the game and scripts. For example, you might want to store the number you get from a [[GetActorValue_-_Actor|GetActorValue()]]. With variables you can store this information, and use it later. | A script can also have '''[[Variables and Properties/fr|Variables]]'''. A variable is a value that can be modified and reference by the game and scripts. For example, you might want to store the number you get from a [[GetActorValue_-_Actor|GetActorValue()]]. With variables you can store this information, and use it later. | ||
A script can also have '''[[Variables and Properties|Properties]]''', which function almost identically to variables, except that ''other'' scripts can ask about and set them. Properties can also be modified in the editor. (''Note: In reality properties are a bit more complex than simply a “variable that you can get/set externally,” but for practical purposes, that's a fine way to think of them''). | A script can also have '''[[Variables and Properties/fr|Properties]]''', which function almost identically to variables, except that ''other'' scripts can ask about and set them. Properties can also be modified in the editor. (''Note: In reality properties are a bit more complex than simply a “variable that you can get/set externally,” but for practical purposes, that's a fine way to think of them''). | ||
[[Variables and Properties]] can be defined to be simple structures like a [[Literals_Reference#Boolean_Literals|Boolean, an Integer, a Float, etc.]] But their real power lies in that they can be defined as and hold '''any''' [[:Category:Script_Objects|Object Type]]. A Quest script, for instance, can have a property that holds a pointer to an Actor. Once you have a pointer to an object in a script property, that script can run functions on that property and thus on the object in it. For example, a quest script holding a property pointing to an Actor, can call Kill() on that property and it will kill that actor. Properties can be set by the script at run time, or can be set by pointing to objects in the editor. | [[Variables and Properties/fr]] can be defined to be simple structures like a [[Literals_Reference#Boolean_Literals|Boolean, an Integer, a Float, etc.]] But their real power lies in that they can be defined as and hold '''any''' [[:Category:Script_Objects|Object Type]]. A Quest script, for instance, can have a property that holds a pointer to an Actor. Once you have a pointer to an object in a script property, that script can run functions on that property and thus on the object in it. For example, a quest script holding a property pointing to an Actor, can call Kill() on that property and it will kill that actor. Properties can be set by the script at run time, or can be set by pointing to objects in the editor. | ||
It's also important to remember that papyrus scripts '''only''' run in response to the game and other scripts. Therefor all of your code needs to live inside an '''[[Event]]''' block, or inside a '''[[#Fragments |Script Fragments]]''' such as a quest stage fragment, or topic info fragment. | It's also important to remember that papyrus scripts '''only''' run in response to the game and other scripts. Therefor all of your code needs to live inside an '''[[Event]]''' block, or inside a '''[[#Fragments |Script Fragments]]''' such as a quest stage fragment, or topic info fragment. | ||
Line 135: | Line 135: | ||
</source> | </source> | ||
For a more detailed discussion of how to declare and set variables and properties, see: [[Variables and Properties | For a more detailed discussion of how to declare and set variables and properties, see: [[Variables and Properties/fr|Variables and Properties]] | ||
==Setting Property Data in the Editor== | ==Setting Property Data in the Editor== |