Difference between revisions of "Getting started with TSFC"

528 bytes removed ,  13:40, 24 December 2007
cleanup
imported>Tibixe
(correction)
imported>Tibixe
(cleanup)
Line 162: Line 162:
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==
Anonymous user