Difference between revisions of "Getting started with TSFC"
no edit summary
imported>DragoonWraith (TESS -> TESDB) |
imported>Darkness X |
||
(6 intermediate revisions by 2 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 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 | ==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. | ||
==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]]. | ||