Difference between revisions of "Getting started with TSFC"

57 bytes added ,  10:32, 15 April 2010
no edit summary
imported>Tibixe
(Introduction to TSFC)
 
imported>Darkness X
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Tools|req0=[[The Elder Scrolls Construction Set|Construction Set]]|req1=[[OBSE]]|req2=[[:Category:TSFC|TSFC]]}}
==You should already know==
==You should already know==
* Commands and variables in Oblivion scripts
* Commands and variables in Oblivion scripts
Line 4: Line 5:


==Background==
==Background==
[http://cs.elderscrolls.com/constwiki/index.php/Category:TSFC Tibixe's String Function Collection] ([[TSFC]]) is an [[OBSE]] plugin which extends Oblivion scripting with string variables. Strings are sequences of characters, like "apple". There are a few existing commands that accept strings as arguments, such as
[http://cs.elderscrolls.com/constwiki/index.php/Category:TSFC Tibixe's String Function Collection] ([[:Category:TSFC|TSFC]]) is an [[OBSE]] plugin which extends Oblivion scripting with string variables. Strings are sequences of characters, like "apple". There are a few existing commands that accept strings as arguments, such as
  SetActorFullName "Player's Horse"
  SetActorFullName "Player's Horse"
But you can't do this
But you can't do this
Line 13: Line 14:


==Get OBSE and TSFC==
==Get OBSE and TSFC==
First, you need the latest version of [http://obse.silverlock.org OBSE] and [http://www.tessource.net/files/file.php?id=11666 TSFC].
First, you need the latest version of [http://obse.silverlock.org OBSE] and [http://www.tesdb.com/files/file.php?id=11666 TSFC].
Install both.
Install both.


Line 129: Line 130:
The script is ready to be used. Assign it to a spell and try it yourself.
The script is ready to be used. Assign it to a spell and try it yourself.


The following section explains what happens behind the scene.
==A new function==
This method is quite complicated. The next release of TSFC (0.5) will introduce a new function, StrExpr. It evaluates an expression and writes its result to the string given as argument.
 
The above script could be rewritten using it as:
 
short playername
short itemname
begin ScriptEffectStart
set itemname to StrGetName
set playername to player.StrGetName
StrExpr itemname "${playername}'s ${itemname}"
StrSetName itemname
StrDel playername
StrDel itemnamename
end
   
   
==Behind the scenes==
==Behind the scenes==
Line 144: Line 163:
This will print "Hello World", because the first call to StrNew/StrGetSomething will always return 1 (the next call will return 2, after that 3 and so on).
This will print "Hello World", because the first call to StrNew/StrGetSomething will always return 1 (the next call will return 2, after that 3 and so on).
StrPrint finds the first string and can print it.
StrPrint finds the first string and can print it.
If you want to save memory (which is not worth the effort in most cases), you can rewrite the above example with only one variable:
If you want to save memory (which is not worth the effort in most cases), you can rewrite the above example with only one variable.
 
short playername
short playername+1
short playername+2
short playername+3
short playername+4
begin ScriptEffectStart
set playername to player.StrGetName
set playername+1 to StrGetName
set playername+2 to StrNew "'s"
StrCat playername playername+2
StrCat playername+3 playername+1
StrSetName playername+4
StrDel playername
StrDel playername+1
StrDel playername+2
StrDel playername+3
StrDel playername+4
end
Of course, this is an extreme example, but demonstrates that variables do not really matter.


==How to continue==
==How to continue==
Browse the [[TSFC]] documentation here at the Wiki for detailed descriptions of TSFC commands.
Browse the [[:Category:TSFC|TSFC]] documentation here at the Wiki for detailed descriptions of TSFC commands.
If you know C++, you can browse the current TSFC source code [[http://obse-plugins.svn.sourceforge.net/viewvc/obse-plugins/TSFC/ here]].
If you know C++, you can browse the current TSFC source code [[http://obse-plugins.svn.sourceforge.net/viewvc/obse-plugins/TSFC/ here]].


If you have questions, feel free to contact [[Tibixe]] here or at the Bethesda Softworks Forums.
If you have questions, feel free to contact [[Tibixe]] here or at the Bethesda Softworks Forums.


[[Category:Tutorials]]
[[Category: Tutorials]]
[[Category:Scripting Tutorials]]
[[Category: Scripting Tutorials]]
[[Category:TSFC]]
[[Category: TSFC]]
Anonymous user