Page 1 of 1

Make a quick RND game structure in VBscript

Posted: Wed Jul 19, 2006 1:18 pm
by Alan
This small VBscript will create a blank game with all the necessary folders and conf files. This is handy if you want to make a game super fast (without using confedit that is) ;-)

No need for any input, just run it and a folder in your "My documents\RND " directory will be created called "NewGame_x" (x is the next free game). All the conf indexes will also be called this, as well as the RND game name itself.

Its not rocket science I know, but its handy ;-)

You may ask "Why not just make an empty game and copy that?", well you'd have to hand edit all the conf files in it because they'd all use the same index, even if the folder name is different.

Save this text as Makegame.vbs and run it. Windows only.

Code: Select all

Dim FSO,strWrite,strLevPath,strLevName,intLevNum,strTemp
Set Shell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
strLevPath = Shell.SpecialFolders("MyDocuments") & "\Rocks'n'Diamonds\levels\"   
If (fso.FolderExists(strLevPath)) = false then
  msgbox "Missing RND folders in My Documents, using C:\ instead":strLevPath = "C:\"
End If
do until (fso.FolderExists(strLevPath & strLevName)) = false
  intLevNum = intLevNum + 1:strLevName = "NewGame_" & intLevNum
loop
strLevPath = strLevPath & strLevName & "\":fso.CreateFolder(strLevPath)
Set strWrite = fso.CreateTextFile(strLevPath & "levelinfo.conf", True)
wr "file_identifier:    ROCKSNDIAMONDS_LEVELINFO_FILE_VERSION_3.2"
wr "name:               " & strLevName
wr "author:             Your Name"
wr "levels:             100"
wr "first_level:        1"
wr "sort_priority:      100"
wr "level_group:        false"
wr "readonly:           false"
wr "graphics_set        gfx_" & strLevName
wr "sounds_set          sfx_" & strLevName
wr "music_set           mus_" & strLevName:strWrite.Close
MakeConf strLevPath & "\Graphics\","graphicsinfo.conf","gfx_"
MakeConf strLevPath & "\Sounds\","soundsinfo.conf","sfx_"
MakeConf strLevPath & "\Music\","musicinfo.conf","mus_"
msgbox "Game number " & intLevNum & " has been created in:-" & chr(13) & strLevPath
sub wr (strLine):strWrite.WriteLine(strLine):end sub
sub MakeConf (strPath,strName,strIndex)
  fso.CreateFolder(strPath)
  Set strWrite = fso.CreateTextFile(strPath & strName, True)
  wr "name                " & strIndex & strLevName
  wr "sort_priority:      100":strWrite.Close
end sub

Posted: Wed Jul 19, 2006 4:30 pm
by Holger
Nice and short!

A little remark: You do not really need to use the "graphics_set", "sounds_set" and "music_set" directives if the level set should use its own "graphics", "sounds" and "music" artwork sub-directory -- this is the default then. Furthermore you can also omit the "name" directive in the artwork config files -- if you want to refer to them from another level set, you can do that by just specifying the level set name.

Posted: Thu Jul 20, 2006 12:56 pm
by Alan
Well, that's two things I've learnt today!

I'll probably still include these unnecessary items in future confs though....I'm a creature of habit!