The Item object allows you to access the properties of your inventory items. Items objects are created at game startup or using the Game.CreateItem method. Existing items can be queried using the Game.GetItem method.
Actions | |
SetSprite | Sets the default sprite. |
SetHoverSprite | Sets the hover sprite. |
SetTalkSprite | Sets the talk sprite. |
AddTalkSprite | Adds a talk sprite. |
RemoveTalkSprite | Removes a sprite from the list of talk sprites. |
GetSprite | Queries a default sprite of this item. |
GetHoverSprite | Queries a hover sprite of this item. |
GetSpriteObject | Queries a default sprite of this item. |
GetHoverSpriteObject | Queries a hover sprite of this item. |
Miscelaneous functions | |
Reset | Cancels the action the object was currently performing (like talking, walking etc.). |
IsTalking | Queries whether the object is currently talking. |
StopTalking | Cancels object's talking. |
Talk | Makes the object talk. |
StickToRegion | Forces this actor/entity to act like it's inside a given region |
SetFont | Sets font of this object. |
GetFont | Gets a font assigned to this object. |
Particle functions | |
CreateParticleEmitter | Initializes the particle emitter attached to this object. |
DeleteParticleEmitter | Deletes the particle emitter attached to this object. |
PlayAnim | Plays an animation. |
ForceTalkAnim | Force a special animation to be used for a subsequent Talk call. |
AddAttachment | Adds an attached entity to this object. |
RemoveAttachment | Removes an attached entity from this object. |
GetAttachment | Gets a reference to an attached entity object. |
Cursor functions | |
SetCursor | Sets the standard cursor. |
GetCursor | Returns the filename of the cursor sprite (or null if no cursor is set) |
GetCursorObject | Returns a reference to the cursor sprite (or null if no cursor is set) |
RemoveCursor | Removes the standard cursor. |
HasCursor | Queries whether the standard cursor is set. |
SetNormalCursor | Sets the normal cursor. |
GetNormalCursor | Returns the filename of the cursor sprite (or null if no cursor is set) |
GetNormalCursorObject | Returns a reference to the cursor sprite (or null if no cursor is set) |
SetHoverCursor | Sets the hover cursor. |
GetHoverCursor | Returns the filename of the cursor sprite (or null if no cursor is set) |
GetHoverCursorObject | Returns a reference to the cursor sprite (or null if no cursor is set) |
Script functions | |
AttachScript | Executes a script file and attaches it to the object. |
DetachScript | Terminates a specified script file and detaches it from an object. |
IsScriptRunning | Queries whether a specified script file is running and attached to an object. |
CanHandleMethod | Queries whether the object supports a method of a specified name. |
Sound functions | |
PlaySound | Plays a sound. If the filename is omitted, the currently assigned sound is played (if any). |
PlaySoundEvent | Plays a sound and triggers an event when the sound is over. If the filename is omitted, the currently assigned sound is played (if any). |
StopSound | Stops the currently playing sound (if any). |
PauseSound | Pauses the currently playing sound. |
ResumeSound | Resumes a paused sound playback. |
IsSoundPlaying | Queries whether a sound playback is in progress. |
SetSoundPosition | Sets the sound's current playing position. |
GetSoundPosition | Queries the sound's current playing position |
SetSoundVolume | Sets a volume of the currently playing sound. |
GetSoundVolume | Gets a volume of the currently playing sound. |
LoadSound | Initializes a sound from file and makes it ready to be played. |
Sound effects functions | |
SoundFXNone | Removes any sound effect currently assigned to this object. |
SoundFXEcho | Assigns an echo effect to the sounds played by this object. |
SoundFXReverb | Assigns a reverb effect to the sounds played by this object. |
Event functions | |
ApplyEvent | Applies a named event to the object. |
CanHandleEvent | Queries whether the object has an event handler for a specified event. |
Type (read only) | Returns always "item" |
DisplayAmount | Specifies whether the item should display current amount. |
Amount | Current amount (integer). |
AmountOffsetX | The X offset of the amount label, relative to item position on screen. |
AmountOffsetY | The Y offset of the amount label, relative to item position on screen. |
AmountAlign | Specifies the text alignment of the amount label (TAL_LEFT, TAL_RIGHT or TAL_CENTER). |
CursorCombined | Specifies if the items displays together with default game cursor when selected. |
AmountString | A string label to be displayed beside the item (set to null to reset the default behavior). |
Active | Specifies whether the object is visible on screen |
IgnoreItems | Specifies whether the object appears to be non-interactive when an inventory item is used on it |
SubtitlesPosRelative | Specifies whether the SubtitlesPosX and SubtitlesPosY attributes are relative to default position, or absolute screen coordinates |
SubtitlesPosX | The X position of speech subtitles (either relative to speaker's position or absolute screen coordinates) |
SubtitlesPosY | The Y position of speech subtitles (either relative to speaker's position or absolute screen coordinates) |
SubtitlesWidth | Width of speech subtitles. Set to zero to restore the default behavior. |
SubtitlesPosXCenter | Specifies if the SubtitlesPosX attribute affects the center of the subtitle or its left side. |
ParticleEmitter (read only) | Returns the reference to the particle emitter object attached to this object, or null if the emitter haven't been initialized yet |
NumAttachments (read only) | Returns the number of entities attached to this object. |
Name | The internal name of the object. |
Caption | The caption of the object. |
AccCaption | A special caption of the object used for accessibility purposes. |
X | The X position of the object. |
Y | The Y position of the object. |
Height (read only) | Returns the current height of the object. In case of actors and entities the scaling is taken into account. |
Filename (read only) | Returns the filename. |
Ready (read only) | Returns whether the object isn't currently performing any action. |
Interactive | Specifies whether the object recieves user input. |
SoundPanning | Specifies whether the sounds played by this object are automatically panned depending on object's position on screen. |
NonIntMouseEvents | Specifies if the object can receive the MouseEntry and MouseLeave events even if the game is in non-interactive mode. |
Movable | Specifies whether the object can be moved by its sprites (in case the sprite frames have a "move" property set). |
Scalable | Specifies whether the object is affected by scene's scaling levels. |
Rotatable | Specifies whether the object is affected by scene's rotation levels. |
Colorable | Specifies whether the object is affected by scene's color regions. |
AlphaColor | Specifies an RGBA color of this object (overrides scene coloring); set to 0 to reset default behavior. |
BlendMode | Specifies how the object's image is blended with the background colors; 0...normal mode, 1...additive blending, 2...subtractive blending |
Scale | Specifies a scale of this object (overrides scene scaling); set to null to reset default behavior. |
ScaleX | Specifies horizontal scale of this object; set to null to reset default behavior. |
ScaleY | Specifies vertical scale of this object; set to null to reset default behavior. |
RelativeScale | Specifies a scale amount to be added to the default scene scale. |
Rotate | Specifies rotation of this object (in degrees); overrides scene rotation; set to null to reset default behavior; not available in compatibility mode |
RelativeRotate | Specifies a rotation amount to be added to the default scene rotation. |
MouseEntry | The mouse pointer has been just moved over the object. |
MouseLeave | The mouse pointer has been just moved away from the object. |
Sets the default sprite.
If the method succeeds, the return value is true.
Sets the hover sprite.
If the method succeeds, the return value is true.
The hover sprite is displayed if the player moves mouse pointer above the inventory item.
Sets the talk sprite.
If the method succeeds, the return value is true.
Adds a talk sprite.
If the method succeeds, the return value is true.
Removes a sprite from the list of talk sprites.
If the method succeeds, the return value is true.
Queries a default sprite of this item.
Returns filename of the currently assigned sprite.
Queries a hover sprite of this item.
Returns filename of the currently assigned sprite.
Queries a default sprite of this item.
Returns a reference to the currently assigned sprite object.
Queries a hover sprite of this item.
Returns a reference to the currently assigned sprite object.
Cancels the action the object was currently performing (like talking, walking etc.).
Queries whether the object is currently talking.
Returns true if the object is talking.
Cancels object's talking.
You can also use StopTalk() abbreviation.
Makes the object talk.
Talk method blocks the script execution until the animation is over, while the TalkAsync method returns immediately. If the duration is set to zero, it's calculated automatically either from the sound file or from the length of the subtitle.
Forces this actor/entity to act like it's inside a given region
Use this method to "lock" a z-order value of an actor or an entity.
Sets font of this object.
If the method succeeds, the return value is true.
Gets a font assigned to this object.
Returns the filename of currently assigned font.
Initializes the particle emitter attached to this object.
Returns the reference to the particle emitter object
Once initialized with this method, the particle emitter object can be queried using the ParticleEmitter property.
Deletes the particle emitter attached to this object.
Returns true if the method succeeded.
Plays an animation.
Returns true if the animation has been played successfuly.
The PlayAnim method blocks the script execution until the animation is over, while the PlayAnimAsync method returns immediately. For actors, you can also specify an animation set name instead of filename.
Force a special animation to be used for a subsequent Talk call.
This setting has only effect on one subsequent Talk() method call. After the talking is over, the talking animation is reset back to default.
Adds an attached entity to this object.
Returns true is the attachment has been successfuly attached.
This method is typically used for attaching a "blob" shadow image to an actor or an entity. The X and Y offset is scaled accordingly to object's current scale.
Removes an attached entity from this object.
Returns true if the attachment has been successfuly detached.
Gets a reference to an attached entity object.
Returns a reference to the attached entity or null if specified attachement cannot be found.
Sets the standard cursor.
Returns true if the cursor has been set succesfuly.
Returns the filename of the cursor sprite (or null if no cursor is set)
Returns a reference to the cursor sprite (or null if no cursor is set)
Removes the standard cursor.
Queries whether the standard cursor is set.
Returns true if the object has a custom mouse pointer assigned.
Sets the normal cursor.
Returns true if the cursor has been set succesfuly.
Returns the filename of the cursor sprite (or null if no cursor is set)
Returns a reference to the cursor sprite (or null if no cursor is set)
Sets the hover cursor.
Returns true if the cursor has been set succesfuly.
Returns the filename of the cursor sprite (or null if no cursor is set)
Returns a reference to the cursor sprite (or null if no cursor is set)
Executes a script file and attaches it to the object.
Returns true if the script has been executed succesfuly.
Each WME object can have multiple scripts attached.
Terminates a specified script file and detaches it from an object.
Returns true if the script has been detached succesfully.
Script threads are currently executed event handlers and methods.
Queries whether a specified script file is running and attached to an object.
Returns true if a specified script file is attached to an object.
Queries whether the object supports a method of a specified name.
Returns true if the object is able to handle the specified method.
Plays a sound. If the filename is omitted, the currently assigned sound is played (if any).
If the method succeeds, the return value is true.
Plays a sound and triggers an event when the sound is over. If the filename is omitted, the currently assigned sound is played (if any).
If the method succeeds, the return value is true.
Stops the currently playing sound (if any).
If the method succeeds, the return value is true.
Pauses the currently playing sound.
If the method succeeds, the return value is true.
Resumes a paused sound playback.
If the method succeeds, the return value is true.
Queries whether a sound playback is in progress.
If the sound is playing, the return value is true.
Sets the sound's current playing position.
If the method succeeds, the return value is true.
Queries the sound's current playing position
Returns the current playing position (in milliseconds).
Sets a volume of the currently playing sound.
If the method succeeds, the return value is true.
Gets a volume of the currently playing sound.
Returns the volume of the currently playing sound (in percent).
Initializes a sound from file and makes it ready to be played.
If the method succeeds, the return value is true.
Use this method to pre-cache a sound file. Initializing the sound takes some time and sometimes it's desirable to move all sound initialization to e.g. scene start so that the subsequent PlaySound calls don't slow the game down. That's what LoadSound is for. To play the pre-cached sound simply call PlaySound without specifying a filename, for example SomeObject.PlaySound(false);
Removes any sound effect currently assigned to this object.
Assigns an echo effect to the sounds played by this object.
Example: actor.SoundFXEcho(50, 50);
Assigns a reverb effect to the sounds played by this object.
Example: actor.SoundFXReverb(0, 0, 2000);
Applies a named event to the object.
Returns true it the event has been applied succesfuly.
Queries whether the object has an event handler for a specified event.
Returns true if the object is able to handle the specified event.