Difference between revisions of "Message Spam"

546 bytes added ,  17:41, 11 September 2006
m
no edit summary
imported>Ra5946
imported>Elder
m
Line 1: Line 1:
AVOIDING MESSAGE SPAM FOR INVENTORY OBJECTS By guidobot101
AVOIDING MESSAGE SPAM WITH INVENTORY OBJECTS by Guidobot


If, like me, you think it is a pain seeing messages like "xxx Added" or "xxx Removed" try something like this.
 
If like me, you think it is a pain seeing messages like "xxx Added" or "xxx Removed" then check this out.


Here's the basic idea for adding a single item:
Here's the basic idea for adding a single item:
CODE


  set itemRef to PlaceAtMe MyModdedItemType 1 0 0
  set itemRef to PlaceAtMe MyModdedItemType 1 0 0
  itemRef.Activate player
  itemRef.Activate player


Notes:
Notes:
Line 20: Line 16:


Here's a more specific version that allows N standard items to be added to your inventory (without message spam) using an in-game function script:
Here's a more specific version that allows N standard items to be added to your inventory (without message spam) using an in-game function script:
CODE


  scn MyAddItemScript
  scn MyAddItemScript
Line 66: Line 59:
   
   
  End
  End


Then to use:
Then to use:
CODE


  ; some script - example
  ; some script - example
Line 78: Line 67:
  MyAddItemFunc.Activate player 1
  MyAddItemFunc.Activate player 1


 
Note: Because the actual adding of multiple objects happens in GameMode, nothing will happen until this current script ends. You could easily make it add one of these in the activate block and then N-1 others, or add more than one at a time in your GameMode, etc. Additionally, the GameMode block will only fire every ~30 seconds unless the IGF item is in the same cell as the player. This is just a quick example and as with all the code here you should experiment for yourself to see what works best for your needs.
Note: Because the actual adding of multiple objects happens in GameMode, nothing will happen until this current script ends. You could easily make it add one of these in the activate block and then N-1 others, or add more than one at a time in your GameMode, etc. This is just a quick example and as with all the code here you should experiment for yourself to see what works best for your needs.


-----------------------
-----------------------


To drop items from your inventory without message spam, you can use the Drop method since this does not create message spam. Note that Drop does not fire the OnDrop method by default.
To drop items from your inventory without message spam, you can use the Drop method since this does not create message spam as the RemoveItem method does. Note that the Drop method also does not fire the OnDrop method.


To remove an item that is in your inventory you will need your own copy of the object in-game, or more likely your own scripted object. This is best done with a global variable in case you have multiple copies. In this case the global variable is in the script attached to MyQuest and the item concerned is MyItem.
To remove an item that is in your inventory you will need your own copy of the object in-game, or more likely your own scripted object. This is best done with a global variable in case you have multiple copies. In this case the global variable is in the script attached to MyQuest and the item concerned is MyItem.
CODE


  Begin GameMode
  Begin GameMode
Line 99: Line 84:
  End
  End


 
This code will not do anything for an object (MyItem) not on a player. Since it may leave the MyQuest.RemoveMyItem set if not called appropriately you should make the object be removed silently thus:
This code will not do anything for an (MyItem) object not on a player. Since it may leave the MyQuest.RemoveMyItem set if not called appropriately you should make the object be removed silently thus:
 
CODE
 


  set MyQuest.RemoveMyItem to player.GetItemCount MyItem
  set MyQuest.RemoveMyItem to player.GetItemCount MyItem


More general notes as FYI:
More general notes as FYI:
Line 112: Line 92:
1) The particular objects used in the MyAddItemScript here are special and cannot be copied to objects that have the same game-play properties. They may be scripted but this is a very bad idea because of MOD conflicts and other possible issues. However, with some extra you can save a list of the object IDs (as an array or link-list) and call RemoveMe on the saved reference IDs.
1) The particular objects used in the MyAddItemScript here are special and cannot be copied to objects that have the same game-play properties. They may be scripted but this is a very bad idea because of MOD conflicts and other possible issues. However, with some extra you can save a list of the object IDs (as an array or link-list) and call RemoveMe on the saved reference IDs.


2) True stacks of items, e.g. when created as a bunch with a single PlaceAtMe or AddItem call, can only be removed using RemoveItem (Drop also works if you dont mind them at your feet.)
2) True stacks of items, e.g. when created as a bunch with a single PlaceAtMe or AddItem call, can only be removed using RemoveItem since the base object script is not transferred. (Drop also works if you dont mind them at your feet.)


3) I'm still working on trying to find a way to avoid EquipItem spam for stacked objects.
3) I'm still working on trying to find a way to avoid EquipItem spam for stacked objects. Individually created items will retain their unique script variables, including their own reference. Hence, you can remove a specific item from an inventory stack. Unfortunately this can mess with what OB thinks is the currently equipped item if an item of a stack is equipped, whether the actual equipped instance is the one removed or not. OBSE may have methods that can help out here.


[[Category: Useful Code]]
[[Category: Useful Code]]
Anonymous user