Difference between revisions of "FindFirstFile"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Low Post
imported>Low Post
m (Shortened example Script a little bit.)
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:


'''Syntax:'''
'''Syntax:'''
(IsFileFound:bool) FindFirstFile ''(FileFound)StringID:long'' ''(FileMask)StringID:long'' ''RootID:short'' ''Directories:bool'' ''Global:bool''
(IsFileFound:bool) FindFirstFile (FileFound)StringID:long ''(FileMask)StringID:long'' ''RootID:short'' ''Directories:bool'' ''Global:bool''
''Note:'' All arguments should be on the same line.
''Note:'' All arguments should be on the same line.


Line 14: Line 14:
**1: Oblivion Data folder.
**1: Oblivion Data folder.
**2: Oblivion main folder.
**2: Oblivion main folder.
*Defines if files (0) or directories (1) are returned. Default is 0.
*Directories defines if files (0) or directories (1) are returned. Default is 0.
*If you want to modify a string from another mod, you will need to set the Global flag to 1. If Global is 0 or unset the function will fail. If the string is protected the function will fail.
*If you want to modify a string from another mod, you will need to set the Global flag to 1. If Global is 0 or unset the function will fail. If the string is protected the function will fail.


Line 22: Line 22:


Begin GameMode
Begin GameMode
SetString -2000 "*.bsa"
SetString -2000 "*.bsa"
If ( FindFirstFile -2050 -2000 1 ) == 0
FindFirstFile -2050 -2000 1
While ( ( StringLen -2050 ) > 0 )
⚫
StopQuest TestFF
⚫
StringMsg -2050 1
Return
⚫
FindNextFile -2050
EndIf
Loop
⚫
StopQuest TestFF
SaveIP
⚫
StringMsg -2050 1
⚫
If ( FindNextFile -2050 ) == 0
StopQuest TestFF
Return
EndIf
RestoreIP
End</pre>
End</pre>



Latest revision as of 05:23, 1 May 2009

A command for Pluggy.

Syntax:

(IsFileFound:bool) FindFirstFile (FileFound)StringID:long (FileMask)StringID:long RootID:short Directories:bool Global:bool

Note: All arguments should be on the same line.


Sets the content of (FileFound)StringID to the Filename of the first matching File and returns 1 if a file was found; 0 if not.

Notes[edit | edit source]

  • FileMask is the StringID of the string containing the Windows filemask for the search. Wildcards are allowed. Default is -42 (*) (i.e.: every file).
  • RootID specifies in which folder the search should be proceeded. Default is 0.
    • 0: "My Documents\My Games\Oblivion\Pluggy\User Files\"
    • 1: Oblivion Data folder.
    • 2: Oblivion main folder.
  • Directories defines if files (0) or directories (1) are returned. Default is 0.
  • If you want to modify a string from another mod, you will need to set the Global flag to 1. If Global is 0 or unset the function will fail. If the string is protected the function will fail.

Example[edit | edit source]

Quest script that display in the console the list of *.bsa files in Oblivion/Data folder:

scn testffs

Begin GameMode
	SetString -2000 "*.bsa"
	FindFirstFile -2050 -2000 1
	While ( ( StringLen -2050 ) > 0 )
		StringMsg -2050 1
		FindNextFile -2050
	Loop
	StopQuest TestFF
End

See also[edit | edit source]