View Full Version : Counter-Strike Source Addon Script Help!
cwtech
03-13-2006, 11:09 PM
I am making an addon for the popular online game counter-strike source.
I need the %AppDirectory% to change based on the users installation. The game in installed in a directory based on the users account name.
It looks something like this:
C:\Program Files\Valve\Steam\SteamApps\blah@12345.com\counter-strike source
I need the %AppDirectory% to change and i need a script that will find this folder and set it to the %AppDirectory%. :wow
I have been trying to get the examples here (http://www.indigorose.com/forums/showthread.php?t=15247) to work, but i have been unsuccessful. :o
I would appreicate any help if possible.
Thanks in advance! :D
First you will need to find that path on the users system. The registry is the easiest way (Registry.GetValue()) but this requires the registry key to always exist. The next way I guess is File.Find(). You can give it priority paths to start from.
Once you have the value in question setting the %AppFolder% is a one line action: SessionVar.Set("%AppFolder%",path to folder);
I hope this helps
Adam Kapilik
cwtech
03-14-2006, 08:55 PM
First you will need to find that path on the users system. The registry is the easiest way (Registry.GetValue()) but this requires the registry key to always exist. The next way I guess is File.Find(). You can give it priority paths to start from.
Once you have the value in question setting the %AppFolder% is a one line action: SessionVar.Set("%AppFolder%",path to folder);
I hope this helps
Adam Kapilik
Well i know nothign about this scripting language. therefore i really can just wrie something up on my own. :huh
I tried searching the registry, but i cant find a refrence to that folder anywhere in the registery.
edit: btw thanks for your help!
cwtech
03-15-2006, 10:49 PM
This is the last setp in making my setup package complete! Please help!:wow
There is a scripting guide available from Here (http://www.indigorose.com/webhelp/suf70/Scripting_Guide/Scripting_Guide.htm) that can help with the scripting. The File.Find() (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/File.Find.htm) action can be set up in the actions editor. Here is a small sample script that does not include the guts of the File.Find action but does show the framework that you can work from:
FileFound = File.Find("C:\\MyDir\\", "*.pdf", false, false, nil, nil);
if FileFound ~= nil then
-- A file was found that matched your search criteria
-- But the File.Find() returns the full path to the
-- file but you onlu want the folder
Paths = String.SplitPath(FileFound[1]);
-- set %AppFolder% to the drive and folder
SessionVar.Set("%AppFolder%",Paths.Drive..Paths.Folder);
else
-- the file was not found. Handle this case however you plan to
end
You should perform this early in the setup process. Also note that you should remove the "Select Install Folder" screen since it will overwrite %AppFolder%
Adam Kapilik
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.