Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::Official Location--https://pastebin.com/raw/B4sFSxu8
- @echo off
- :Logo
- echo _
- echo _____ _____ ______ ______ _____ (_) _____
- echo / ____^| __ \^| ____^| ____^| __ \ ^|/ / ____^|
- echo ^| ^| ^| ^|__) ^| ^|__ ^| ^|__ ^| ^| ^| ^| ^| (___
- echo ^| ^| ^| _ /^| __^| ^| __^| ^| ^| ^| ^| \___ \
- echo ^| ^|____^| ^| \ \^| ^|____^| ^|____^| ^|__^| ^| ____) ^|
- echo \_____^|_^| \_\______^|______^|_____/ ^|_____/
- echo[
- echo __ ______ _____ _ __ _____ _ _ ____ _____
- echo \ \ / / __ \^| __ \^| ^|/ // ____^| ^| ^| ^|/ __ \^| __ \
- echo \ \ /\ / / ^| ^| ^| ^|__) ^| ' /^| (___ ^| ^|__^| ^| ^| ^| ^| ^|__) ^|
- echo \ \/ \/ /^| ^| ^| ^| _ /^| ^< \___ \^| __ ^| ^| ^| ^| ___/
- echo \ /\ / ^| ^|__^| ^| ^| \ \^| . \ ____) ^| ^| ^| ^| ^|__^| ^| ^|
- echo \/ \/ \____/^|_^| \_\_^|\_\_____/^|_^| ^|_^|\____/^|_^|
- echo[
- echo _______ ____ ____ _ _____
- echo ^|__ __/ __ \ / __ \^| ^| / ____^|
- echo ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| (___
- echo ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| \___ \
- echo ^| ^| ^| ^|__^| ^| ^|__^| ^| ^|____ ____) ^|
- echo ^|_^| \____/ \____/^|______^|_____/
- if "1"=="%Loaded%" (echo[&&echo Thank you for using my program. Exiting.)
- timeout /t 2 /nobreak > NUL
- if "1"=="%Loaded%" (exit)
- goto Initialize
- :Initialize
- regedit /e reg_exported.tmp "HKEY_CURRENT_USER\Software\Valve\Steam"
- find "SteamExe" reg_exported.tmp | findstr "SteamExe" >> line_exported.tmp
- set /p SteamPath= < line_exported.tmp
- set SteamPath="F:/Steam"
- del reg_exported.tmp
- del line_exported.tmp
- echo Loading...
- echo[
- echo[
- echo ----Steam Test--
- cd /d %SteamPath:~1,-11%
- if exist Steam.exe (echo --PASS&&set Error1=0) else (echo --CRITICAL FAILURE, STEAM NOT FOUND&&set Error1=1)
- set GModPath="%SteamPath:~1,-11%/steamapps/common/GarrysMod"
- set GModAddons=%GmodPath:~0,-1%/garrysmod/addons/"
- set BinPath=%GmodPath:~0,-1%/bin/"
- cd /d %BinPath%
- echo ----GMA Extractor and Creator (gmad.exe) Test--
- if exist gmad.exe (echo --PASS&&set Error2=0) else (echo --ERROR: NOT FOUND&&set Error2=1)
- set gmpublish = "%BinPath%/gmpublish.exe"
- echo ----GMA Publisher and Updater (gmpublish.exe) Test--
- if exist gmpublish.exe (echo --PASS&&set Error3=0) else (echo --ERROR: NOT FOUND&&set Error3=1)
- echo ----Windows XP Test--
- ver | findstr /i "5\.1\."
- if %ERRORLEVEL% EQU 0 (echo --ERROR: DOES NOT WORK ON XP&&set Error4=1) else (echo --PASS&&set Error4=0)
- echo[
- echo[
- echo Load complete.
- echo -------------------------------
- echo[
- if "0000"=="%Error1%%Error2%%Error3%%Error4%" (
- echo Loaded successfuly!
- set Loaded=1
- goto MainMenu
- )
- if not "0000"=="%Error1%%Error2%%Error3%%Error4%" (
- echo There was an error. (Or 4.)
- echo (Try running in Administrator mode, right click this and click "Run as Administrator"!)
- echo Please take a look above and find the error.
- echo It is entirely possible you cannot fix this on your own.
- echo Please contact Creed, either on steam or commenting on the guide.
- echo This program will now close.
- pause
- exit
- )
- :MainMenu
- cd /d %BinPath%
- cls
- echo MAIN MENU
- echo Press the number of the program you want to use.
- echo[
- echo ---------------------------------------------------------------
- echo 1) Create an "addon.json" (Do this before publishing)
- echo 2) Fix [Filename contains captial letters] error
- echo[
- echo 3) Publish your workshop addon (It's not on the workshop)
- echo 4) Update your workshop addon (Already on workshop)
- echo[
- echo 5) Open GarrysMod Directory
- echo 6) Tutorial (IF YOU HAVEN'T SEEN THE GUIDE, PRESS THIS)
- echo[
- echo 7) Exit
- echo ---------------------------------------------------------------
- echo[
- CHOICE /N /C 1234567 %1
- if ERRORLEVEL 7 cls&&goto Logo&&exit
- if ERRORLEVEL 6 goto TutorialGuideWarn
- if ERRORLEVEL 5 goto OpenDir
- if ERRORLEVEL 4 goto UpdateProc
- if ERRORLEVEL 3 goto PublishProc
- if ERRORLEVEL 2 goto LowercaseConverter
- if ERRORLEVEL 1 goto JsonCreator
- :OpenDir
- cd /d %GmodPath%
- start garrysmod
- cls
- echo Opened Main Directory. Returning to main menu.
- echo[
- pause
- goto MainMenu
- :TutorialGuideWarn
- cls
- echo If you are reading this, chances are you haven't read my guides.
- echo Please see if they apply to you.
- echo[
- echo ----------------------------------------------------------------
- echo How to upload maps (Specific and Easy)
- echo http://steamcommunity.com/sharedfiles/filedetails/?id=805217231
- echo[
- echo How to upload addons (General)
- echo http://steamcommunity.com/sharedfiles/filedetails/?id=805218730
- echo ----------------------------------------------------------------
- echo[
- pause
- goto Tutorial
- :Tutorial
- cls
- echo Here's some things that you should have.
- echo #1:
- echo ------
- echo Your addon should have its own folder (all lowercase, no spaces, preferably dashes) in:
- echo[
- echo %GmodAddons%
- echo[
- pause
- cls
- echo #2:
- echo ------
- echo Inside, there should be a 512x512 "JPG" picture of your addon.
- echo This picture should be inside your root folder, named "icon.jpg".
- echo[
- echo Example:
- echo %GmodAddons:~0,-1%YOUR-ADDON-NAME/icon.jpg"
- echo[
- pause
- cls
- echo #3:
- echo ------
- echo The hard part, the addon.json.
- echo There'll be an option for you to use my program to help you make this easily.
- echo[
- echo If you want to do it manually, go to
- echo[
- echo https://wiki.garrysmod.com/page/Workshop_Addon_Creation#addon.json
- echo[
- pause
- cls
- echo #4:
- echo ------
- echo There should be nothing out of place. Workshop is very particular.
- echo[
- echo If you have any files out of place or files that shouldn't be in an addon (.txt files for instance), it will BREAK.
- echo[
- echo This is very important and is usually the reason people give up or get stuck on uploading.
- echo[
- pause
- cls
- echo If you've got all that, let's begin!
- echo If not, just press the tutorial button in the main menu again.
- echo[
- pause
- goto MainMenu
- :LowercaseConverter
- cls
- echo What is the folder of your addon in "garrysmod/addons/" called?
- set /p AddonName="Addon Folder Name: "
- echo[
- echo So it's located at %GmodAddons:~0,-1%%AddonName%"?
- set AddonPath=%GmodAddons:~0,-1%%AddonName%"
- echo [Press Y for Yes / Press N for No]
- CHOICE /N /C YN %1
- if ERRORLEVEL 2 goto LowercaseConverter
- if ERRORLEVEL 1 goto LowercaseConverter2
- :LowercaseConverter2
- cls
- cd /d %AddonPath%
- echo WARNING: If for some reason your addon has case-sensitive code, this will break it!
- echo This may be true for materials, models and sounds as well.
- echo But if you're using the above and they're uppercase, they've probably never been on the workshop.
- echo You're a pioneer!
- echo[
- echo Press Y if you're sure.
- echo Press N to return to main menu.
- CHOICE /N /C YN %1
- if ERRORLEVEL 2 goto MainMenu
- if ERRORLEVEL 1 goto LowercaseConverter3
- :LowercaseConverter3
- cls
- cd /d %AddonPath%
- echo Currently in:
- cd
- echo[
- setlocal enabledelayedexpansion
- for /f "tokens=*" %%a in ('dir/b/s/l') do (
- set f=%%a
- set f=!f:%%~dpa=!
- ren "%%a" "!f!"
- )
- setlocal disabledelayedexpansion
- echo Done! Returning to main menu.
- pause
- goto MainMenu
- :JsonCreator
- cls
- echo *WARNING*
- echo If you have an "addon.json" hand-made, THIS WILL DELETE IT!
- echo If you are following the guide you do not have this file, don't worry. Press Y.
- echo[
- echo Press Y to continue.
- echo Press N to go back to the main menu.
- echo Press X to JSON.
- echo[
- CHOICE /N /C YNX %1
- if ERRORLEVEL 3 goto Jason
- if ERRORLEVEL 2 goto MainMenu
- if ERRORLEVEL 1 goto JsonCreator2
- :Jason
- cls
- echo Congratulations, you know your memes.
- echo (Insert heavy rain reference here)
- pause
- goto Json
- :JsonCreator2
- cls
- echo What is the folder of your addon in "garrysmod/addons/" called?
- set /p AddonName="Addon Folder Name: "
- echo[
- echo So it's located at %GmodAddons:~0,-1%%AddonName%"?
- set AddonPath=%GmodAddons:~0,-1%%AddonName%"
- echo [Press Y for Yes / Press N for No]
- CHOICE /N /C YN %1
- if ERRORLEVEL 2 goto JsonCreator
- if ERRORLEVEL 1 goto JsonCreator3
- :JsonCreator3
- cls
- cd /d %AddonPath%
- echo ADDON.JSON CREATION
- if exist addon.json (del addon.json&&echo --Deleted addon.json file, sorry.--)
- echo {>> addon.json
- @echo "title":"%AddonName%",>>addon.json
- echo What type of addon is this?
- echo 1: "ServerContent"
- echo 2: "gamemode"
- echo 3: "map"
- echo 4: "weapon"
- echo 5: "vehicle"
- echo 6: "npc"
- echo 7: "tool"
- echo 8: "effects"
- echo 9: "model"
- CHOICE /N /C 123456789 %1
- if ERRORLEVEL 9 set Type="model"&&goto TypeProc
- if ERRORLEVEL 8 set Type="effects"&&goto TypeProc
- if ERRORLEVEL 7 set Type="tool"&&goto TypeProc
- if ERRORLEVEL 6 set Type="npc"&&goto TypeProc
- if ERRORLEVEL 5 set Type="vehicle"&&goto TypeProc
- if ERRORLEVEL 4 set Type="weapon"&&goto TypeProc
- if ERRORLEVEL 3 set Type="map"&&goto TypeProc
- if ERRORLEVEL 2 set Type="gamemode"&&goto TypeProc
- if ERRORLEVEL 1 set Type="ServerContent"&&goto TypeProc
- :TypeProc
- cls
- echo Type Chosen: %Type%
- @echo "type":%Type%,>>addon.json
- echo[
- echo[
- echo Select 2 tags for your addon.
- echo Tag 1:
- echo[
- echo #1: "fun"
- echo #2: "roleplay"
- echo #3: "scenic"
- echo #4: "movie"
- echo #5: "realism"
- echo #6: "cartoon"
- echo #7: "water"
- echo #8: "comic"
- echo #9: "build"
- CHOICE /N /C 123456789 %1
- if ERRORLEVEL 9 set Tag1="build"&&goto Tag1Proc
- if ERRORLEVEL 8 set Tag1="comic"&&goto Tag1Proc
- if ERRORLEVEL 7 set Tag1="water"&&goto Tag1Proc
- if ERRORLEVEL 6 set Tag1="cartoon"&&goto Tag1Proc
- if ERRORLEVEL 5 set Tag1="realism"&&goto Tag1Proc
- if ERRORLEVEL 4 set Tag1="movie"&&goto Tag1Proc
- if ERRORLEVEL 3 set Tag1="scenic"&&goto Tag1Proc
- if ERRORLEVEL 2 set Tag1="roleplay"&&goto Tag1Proc
- if ERRORLEVEL 1 set Tag1="fun"&&goto Tag1Proc
- :Tag1Proc
- cls
- echo Type Chosen: %Type%
- echo[
- echo[
- echo Select 2 tags for your addon.
- echo Tag 2:
- echo[
- if /I "fun"==%Tag1% (echo **"fun"&&set ChosenTag=1) else (echo #1: "fun")
- if /I "roleplay"==%Tag1% (echo **"roleplay"&&set ChosenTag=2) else (echo #2: "roleplay")
- if /I "scenic"==%Tag1% (echo **"scenic"&&set ChosenTag=3) else (echo #3: "scenic")
- if /I "movie"==%Tag1% (echo **"movie"&&set ChosenTag=4) else (echo #4: "movie")
- if /I "realism"==%Tag1% (echo **"realism"&&set ChosenTag=5) else (echo #5: "realism")
- if /I "cartoon"==%Tag1% (echo **"cartoon"&&set ChosenTag=6) else (echo #6: "cartoon")
- if /I "water"==%Tag1% (echo **"water"&&set ChosenTag=7) else (echo #7: "water")
- if /I "comic"==%Tag1% (echo **"comic"&&set ChosenTag=8) else (echo #8: "comic")
- if /I "build"==%Tag1% (echo **"build"&&set ChosenTag=9) else (echo #9: "build")
- CHOICE /N /C 123456789 %1
- if %ERRORLEVEL%==%ChosenTag% (goto Tag1Proc)
- if ERRORLEVEL 9 set Tag2="build"&&goto Tag2Proc
- if ERRORLEVEL 8 set Tag2="comic"&&goto Tag2Proc
- if ERRORLEVEL 7 set Tag2="water"&&goto Tag2Proc
- if ERRORLEVEL 6 set Tag2="cartoon"&&goto Tag2Proc
- if ERRORLEVEL 5 set Tag2="realism"&&goto Tag2Proc
- if ERRORLEVEL 4 set Tag2="movie"&&goto Tag2Proc
- if ERRORLEVEL 3 set Tag2="scenic"&&goto Tag2Proc
- if ERRORLEVEL 2 set Tag2="roleplay"&&goto Tag2Proc
- if ERRORLEVEL 1 set Tag2="fun"&&goto Tag2Proc
- :Tag2Proc
- @echo "tags":[ %Tag1%, %Tag2% ],>>addon.json
- @echo "ignore":>>addon.json
- @echo [>>addon.json
- set LastIgnore=icon.jpg
- goto IgnoreProc
- :IgnoreProc
- cls
- echo What files do you want to ignore?
- echo Just press enter unless you have an error in the "Creating your file" part or you're an advanced user.
- echo[
- echo Please type without quotes.
- echo[
- echo To list multiple files, end your input with a comma. Otherwise, with nothing.
- echo An example of multiple files, where a new line is "enter":
- echo ----------------------------------------------------------
- echo *.svn,
- echo readme.txt,
- echo materials/materialslist.txt
- echo ----------------------------------------------------------
- echo[
- echo[
- set /p Ignore="Ignore: "
- ::This is done in an inefficient manner. I don't trust those else statements. If anyone wants to change the below to else, be my guest.
- if icon.jpg==%LastIgnore% (
- if "%Ignore:~-1%"=="~-1" (
- @echo "icon.jpg">>addon.json
- @echo ]>>addon.json
- @echo }>>addon.json
- goto JsonFinish
- )
- if "%Ignore:~-1%"=="," (
- @echo "icon.jpg",>>addon.json
- set LastIgnore=%Ignore%
- goto IgnoreProc
- )
- if not "%Ignore:~-1%"=="," (
- @echo "icon.jpg",>>addon.json
- @echo "%Ignore%">>addon.json
- @echo ]>>addon.json
- @echo }>>addon.json
- goto JsonFinish
- )
- )
- if not icon.jpg==%LastIgnore% (
- if "%Ignore%"=="%LastIgnore%" (
- if "%LastIgnore:~-1%"=="," (
- @echo "%LastIgnore:~0,-1%">>addon.json
- )
- if not "%LastIgnore:~-1%"=="," (
- @echo "%LastIgnore%">>addon.json
- )
- @echo ]>>addon.json
- @echo }>>addon.json
- goto JsonFinish
- )
- if "%Ignore:~-1%"=="," (
- @echo "%LastIgnore:~0,-1%",>>addon.json
- set LastIgnore=%Ignore%
- goto IgnoreProc
- )
- if not "%Ignore:~-1%"=="," (
- @echo "%LastIgnore:~0,-1%",>>addon.json
- @echo "%Ignore%">>addon.json
- @echo ]>>addon.json
- @echo }>>addon.json
- goto JsonFinish
- )
- )
- :JsonFinish
- cls
- echo Here's what your completed addon.json file looks like!
- echo ---------------------------------
- echo[
- echo[
- FOR /F "tokens=*" %%i IN (addon.json) DO @ECHO %%i
- echo ---------------------------------
- @echo Automatically added icon.jpg
- echo ---------------------------------
- echo[
- echo[
- echo If this looks correct, press Y to go back to the main menu.
- echo If it doesn't, press N to start over.
- CHOICE /N /C YN %1
- if ERRORLEVEL 2 goto JsonCreator
- if ERRORLEVEL 1 goto MainMenu
- :PublishProc
- cls
- echo So you're publishing your addon for the first time.
- echo What is the folder of your addon in "garrysmod/addons/" called?
- set /p AddonName="Addon Folder Name: "
- echo[
- echo So it's located at %GmodAddons:~0,-1%%AddonName%"?
- set AddonPath=%GmodAddons:~0,-1%%AddonName%"
- echo [Press Y for Yes / Press N for No]
- CHOICE /N /C YN %1
- if ERRORLEVEL 2 goto PublishProc
- if ERRORLEVEL 1 goto PublishProc2
- :PublishProc2
- cls
- echo Creating your file. Please look out for any lines in red.
- pause
- cls
- gmad create -folder ../garrysmod/addons/%AddonName%/ -out ../garrysmod/%AddonName%.gma -warninvalid
- echo[
- echo[
- echo[
- echo[
- echo Are there any lines in red?
- echo If there aren't, press "N" to begin uploading.
- echo If there are, please fix them before pressing "Y" to try again.
- CHOICE /N /C YN %1
- if ERRORLEVEL 2 goto PublishProc3
- if ERRORLEVEL 1 goto PublishProc2
- :PublishProc3
- cls
- echo Uploading your file. Please look out for any errors.
- pause
- cls
- gmpublish create -addon ../garrysmod/%AddonName%.gma -icon ../garrysmod/addons/%AddonName%/icon.jpg
- echo[
- echo[
- echo[
- echo[
- echo[
- echo[
- echo You should see:
- echo[
- echo -----------------------------------------------
- echo Your file is marked as private - only you will be able to see it.
- echo Please mark it as public only when you have tested it!!
- echo -----------------------------------------------
- echo[
- echo Aside from that, are there any lines in red?
- echo If there aren't, press "N" to finish.
- echo If there are, please fix them before pressing "Y" to try again.
- CHOICE /N /C YN %1
- if ERRORLEVEL 2 goto PublishProc4
- if ERRORLEVEL 1 goto PublishProc
- :PublishProc4
- cls
- cd /d ../garrysmod
- del "%AddonName%.gma"
- echo Congratulations! You've published "%AddonName%"! Returning to main menu.
- pause
- goto MainMenu
- :UpdateProc
- cls
- gmpublish list
- echo[
- echo[
- echo[
- echo Above is a list of your addons on the workshop. Please input the number of the addon (e.g., 799449579).
- set /p AddonID="Addon ID: "
- echo[
- echo The ID you put in is "%AddonID%".
- echo Is this correct?
- echo [Press Y for Yes / Press N for No]
- CHOICE /N /C YN %1
- if ERRORLEVEL 2 goto UpdateProc
- if ERRORLEVEL 1 goto UpdateProc2
- :UpdateProc2
- cls
- echo What is the folder of your addon in "garrysmod/addons/" called?
- set /p AddonName="Addon Folder Name: "
- echo[
- echo So it's located at %GmodAddons:~0,-1%%AddonName%"?
- set AddonPath=%GmodAddons:~0,-1%%AddonName%"
- echo [Press Y for Yes / Press N for No]
- CHOICE /N /C YN %1
- if ERRORLEVEL 2 goto UpdateProc2
- if ERRORLEVEL 1 goto UpdateProc3
- :UpdateProc3
- cls
- echo Creating your file. Please look out for any lines in red.
- pause
- cls
- gmad create -folder ../garrysmod/addons/%AddonName%/ -out ../garrysmod/%AddonName%.gma -warninvalid
- echo[
- echo[
- echo[
- echo[
- echo Are there any lines in red?
- echo If there aren't, press "N" to begin uploading.
- echo If there are, please fix them before pressing "Y" to try again.
- CHOICE /N /C YN %1
- if ERRORLEVEL 2 goto UpdateProc4
- if ERRORLEVEL 1 goto UpdateProc3
- :UpdateProc4
- cls
- echo Uploading your file. Please look out for any errors.
- pause
- cls
- gmpublish update -id %AddonID% -addon ../garrysmod/%AddonName%.gma
- echo[
- echo[
- echo[
- echo[
- echo[
- echo[
- echo You should see:
- echo[
- echo -----------------------------------------------
- echo Committing.. (this can take a long time)
- echo Success!
- echo -----------------------------------------------
- echo[
- echo If you do, press "N".
- echo If you don't, fix any errors shown, then press "Y".
- CHOICE /N /C YN %1
- if ERRORLEVEL 2 goto UpdateProc5
- if ERRORLEVEL 1 goto UpdateProc2
- :UpdateProc5
- cls
- cd /d ../garrysmod
- del "%AddonName%.gma"
- echo Congratulations! You've updated "%AddonName%"! Return to main menu.
- pause
- goto MainMenu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement