aveyo

dota_show_behavior_on_startup_and_after_match

Oct 4th, 2017
3,031
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 4.69 KB | None | 0 0
  1. :: for non-windows, save https://pastebin.com/saYGskE6 in \steamapps\common\dota 2 beta\game\dota\scripts\vscripts\core\coreinit.lua
  2. @echo off &setlocal &title Dota show behavior on startup and after match by AveYo v9 final with dynamic grade color [just run once]
  3. call :set_dota
  4. set "P=%DOTA%\game\dota\scripts\vscripts\core" &set "F=coreinit.lua"
  5. set "enable=[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms');"
  6. set "vscript=[System.Windows.Forms.MessageBox]::Show('Show behavior on startup and after match?','AveYo DOTA vscript',4,32);"
  7. for /f %%q in ('powershell -c "%enable%;%vscript%"') do set "result=%%q"
  8. if /i "%result%"=="No" ( call :remove_vscript ) else call :install_vscript
  9. call :end :Done!
  10. exit/b
  11.  
  12. :remove_vscript
  13. echo  REMOVING %P%\%F%
  14. del /f/q "%P%\%F%" >nul 2>nul &exit/b
  15.  
  16. :install_vscript
  17. echo  INSTALLING %P%\%F%
  18. mkdir "%P%" >nul 2>nul &cd /d "%P%"
  19.  > %F% echo/-- this file: \steamapps\common\dota 2 beta\game\dota\scripts\vscripts\core\coreinit.lua
  20. >> %F% echo/-- Dota show behavior on startup and after match by AveYo v8 with dynamic grade color [set it and forget it]
  21. >> %F% echo/-- v9 final : Reliable, native VScript scheduler!
  22. >> %F% echo/
  23. >> %F% echo/local ToConsole = function(s) if SendToServerConsole then SendToServerConsole(s) else SendToConsole(s) end end
  24. >> %F% echo/local HideBehaviorScore = function(t) ToConsole( 'top_bar_message "" ' .. t ) Convars:SetStr('cl_class','default') end
  25. >> %F% echo/local ShowBehaviorScore = function(t)
  26. >> %F% echo/  local behavior_score = Convars:GetStr( 'cl_class' ):gsub('\n','') -- import i/o cvar cl_class
  27. >> %F% echo/  local grade = behavior_score:gsub('behavior_score: ',''):gsub('+',''):gsub('-','') -- substring grade
  28. >> %F% echo/  local flower = { Normal=true, A=true, B=true, C=true } -- Roses are Red, Violetes are Blue
  29. >> %F% echo/  local ass = 1 -- set flag to use red message by default
  30. >> %F% echo/  if flower[grade] then ass = 0 end -- set flag to use blue message if behavior_score is flower grade
  31. >> %F% echo/  print( behavior_score ) -- print behavior_score into Console
  32. >> %F% echo/  local VScheduler = EntIndexToHScript(0) -- if there are entities loaded, than vscheduler is available
  33. >> %F% echo/  if VScheduler then
  34. >> %F% echo/    ToConsole( 'top_bar_message "' .. behavior_score .. '" ' .. ass .. ';' ) -- show top bar gui message
  35. >> %F% echo/    VScheduler:SetContextThink( "GabenPlz", function() HideBehaviorScore(ass) end, 4 ) -- hide after 4 seconds
  36. >> %F% echo/  end  
  37. >> %F% echo/end
  38. >> %F% echo/
  39. >> %F% echo/if SendToServerConsole then -- local client only [ VScripts loads two vm's, one for sv, one for cl ]
  40. >> %F% echo/  ToConsole( 'developer 1; dota_game_account_client_debug ^| cl_class; developer 0;' ) -- save score into cl_class
  41. >> %F% echo/  ListenToGameEvent("player_connect_full", ShowBehaviorScore, nil) -- show message after each new map
  42. >> %F% echo/end
  43. >> %F% echo/
  44. exit/b
  45.  
  46. :set_dota outputs %STEAMPATH% %STEAMAPPS% %DOTA%                                   ||:i AveYo:" Override detection below if needed "
  47. set "STEAMPATH=D:\Steam" &set "DOTA=D:\Games\steamapps\common\dota 2 beta"
  48. if not exist "%STEAMPATH%\Steam.exe" call :reg_query "HKCU\SOFTWARE\Valve\Steam" "SteamPath" STEAMPATH
  49. set "STEAMDATA=" &if defined STEAMPATH for %%# in ("%STEAMPATH:/=\%") do set "STEAMPATH=%%~dpnx#"     ||:i  / pathsep on Windows lul
  50. if not exist "%STEAMPATH%\Steam.exe" call :end ! Cannot find SteamPath in registry
  51. if exist "%DOTA%\game\dota\maps\dota.vpk" set "STEAMAPPS=%DOTA:\common\dota 2 beta=%" &exit/b
  52. set "libfilter=LibraryFolders { TimeNextStatsReport ContentStatsID }"
  53. if not exist "%STEAMPATH%\SteamApps\libraryfolders.vdf" call :end ! Cannot find "%STEAMPATH%\SteamApps\libraryfolders.vdf"
  54. for /f usebackq^ delims^=^"^ tokens^=4 %%s in (`findstr /v "%libfilter%" "%STEAMPATH%\SteamApps\libraryfolders.vdf"`) do (
  55.  if exist "%%s\steamapps\appmanifest_570.acf" if exist "%%s\steamapps\common\dota 2 beta\game\dota\maps\dota.vpk" set "libfs=%%s" )
  56. set "STEAMAPPS=%STEAMPATH%\steamapps" &if defined libfs set "STEAMAPPS=%libfs:\\=\%\steamapps"
  57. if not exist "%STEAMAPPS%\common\dota 2 beta\game\dota\maps\dota.vpk" call :end ! Cannot find "%STEAMAPPS%\common\dota 2 beta"
  58. set "DOTA=%STEAMAPPS%\common\dota 2 beta" &exit/b
  59. :reg_query %1:KeyName %2:ValueName %3:OutputVariable %4:other_options[example: "/t REG_DWORD"]
  60. setlocal &for /f "skip=2 delims=" %%s in ('reg query "%~1" /v "%~2" /z 2^>nul') do set "rq=%%s" &call set "rv=%%rq:*)    =%%"
  61. endlocal &call set "%~3=%rv%" &exit/b                            ||:i AveYo - Usage:" call :reg_query "HKCU\MyKey" "MyValue" MyVar "
  62. :end %1:Message
  63. if "%~1"=="!" ( color c0 &echo !ERROR%* &timeout /t 16 &color &exit ) else echo  %* &timeout /t 8 &color &exit
  64. ::
Add Comment
Please, Sign In to add comment