Interfacing Pluggy and TSFC

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

This page explains briefly how to transfer strings between the OBSE plugins Pluggy and TSFC. It is assumed that the reader is familiar with strings and their associated functions within Pluggy and TSFC.

Requirements[edit | edit source]

Setup[edit | edit source]

Since both TSFC and Pluggy contain functions to both set and read item names, we're essentially using a dummy item as the middleman between the two plugins.

The only necessary setup is to create the dummy item. In the CS, open the object window and browse to the section Items > MiscItem. To create a new item, press the Insert key or right click and select "New". In the new MiscItem window that appears, enter an Editor ID for the item - you don't need to set anything else. For this example, we'll assume that our item was named NameDummy.

Moving from Pluggy to TSFC[edit | edit source]

  • plugString is a Pluggy String which has been created via CreateString and contains string data.
  • tString is a TSFC String which has been created via StrNew but is empty and ready to receive data.
StringSetName NameDummy plugString
StrGetName tString NameDummy

tString will now contain the same string data as plugString, and may be used with the various TSFC functions.

Moving from TSFC to Pluggy[edit | edit source]

  • tString is a TSFC String which has been created by StrNew and contains string data.
  • plugString is a Pluggy String which has been created by CreateString but is empty and ready to receive data.
StrSetName tString NameDummy
StringGetName NameDummy plugString

plugString will now contain the same string data as tString, and may be used with the various Pluggy string functions.

Notes[edit | edit source]

  • If a Pluggy String contains a null character (\0), anything after the first null character will be ignored when setting the item's name. This is most likely to occur if you've used StringLen to expand the size of a string, but accidentally left some of the new null characters in the middle of the string.
  • Transfering an empty string won't work. Instead, your script should be written to recognize an empty string by using StringLen or StrLength, and to skip the string transfer code and take any necessary action.