Make a quick RND game structure in VBscript

Discussion around programming R'n'D, its source code and its tools.

Moderators: Flumminator, Zomis

Post Reply
User avatar
Alan
Posts: 661
Joined: Fri Jun 18, 2004 7:48 pm

Make a quick RND game structure in VBscript

Post 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
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post 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.
User avatar
Alan
Posts: 661
Joined: Fri Jun 18, 2004 7:48 pm

Post 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!
Post Reply