Difference between revisions of "Message Spam"

190 bytes added ,  13:15, 2 June 2008
Moved best method up top, some info
imported>Haama
(→‎OBSE Commands: Sound will still play)
imported>Haama
(Moved best method up top, some info)
Line 1: Line 1:
__NOTOC__[[Category: Useful Code]]
__NOTOC__[[Category: Useful Code]]
Tes4 displays messages to the player whenever: 1) spells are added to, 2) items are added to or removed from the player. For some scripts such messages are very undesirable (e.g. for an alchemical sorters which adds/removes many items). Hence, message "spam". There are several techniques for avoiding this spam.
Tes4 displays messages to the player whenever: 1) spells are added to, 2) items are added to or removed from the player. For some scripts such messages are very undesirable (e.g. for an alchemical sorters which adds/removes many items). Hence, message "spam". There are several techniques for avoiding this spam.
===AddItem - aTemp Container===
When adding items to the player, spam can be avoided by first adding the item to a container, and then removing the contents from the container to the player. This works because unlike addItem, [[RemoveAllItems]] is silent.
<pre>
tempContainerRef.addItem deathDagger 1
tempContainerRef.removeAllItems player</pre>
If you're using [[Glossary#C|Cobl]], you can use '''cobGenXFerRef''' for the temporary container -- it's defined for just this sort of use.
'''Note:''' Do ''not'' wait a frame to remove the item to the player. If you do, you run the chance of running the item's script, which in rare circumstances can cause problems.


===Message Queue Overloading===
===Message Queue Overloading===
Line 28: Line 38:


'''Con:''' The sound generated by the CS versions of these functions is also generated by these functions.
'''Con:''' The sound generated by the CS versions of these functions is also generated by these functions.
===Temp Container===
When adding items to the player, spam can be avoided by first adding the item to a container, and then removing the contents from the container to the player. This works because unlike addItem, [[RemoveAllItems]] is silent.
<pre>
tempContainerRef.addItem deathDagger 1
tempContainerRef.removeAllItems player</pre>
If you're using [[Glossary#C|Cobl]], you can use '''cobGenXFerRef''' for the temporary container -- it's defined for just this sort of use.


===Item Activate===
===Item Activate===
Anonymous user