Talk:List of Portal 2 Script Functions

From Valve Developer Community
Jump to: navigation, search

Console command?

Turkleton, what's the console command you used to get this list? Just curious ;) --Barracuda 22:40, 20 May 2011 (UTC)

I used the script_help command. Seems it only works when you run the game in tools mode.

View angles?

Is there any possible way to get the player's eye angles via scripting? It would be insanely useful to me right now. Obviously there's the eye position in CBaseEntity but as far as I can see there's nothing on which direction the player is looking. The basic angle of the player only gives the yaw as a useful value, as neither pitch nor roll change (I guess because view angles are separate). --X6herbius 02:38, 22 February 2012 (PST)

ScriptSteamShowURL() Problem

I have an unusual question.

I've been trying to open a local HTML file within my mod using VScripts. Since the ScriptSteamShowURL() function returns a boolean, I thought that indicated whether the file existed. I made a function with an "if" chain for the location of the file on various systems. But it seems that the function will always return true, meaning it will not work. Is there any solution to this problem or will I have to host the file on some other site? That would prevent the mod from being played offline.

Example of the code I'm attempting:

::OpenHTML <- function(Page)
  local HtmlDir = "Steam/SteamApps/sourcemods/mod/scripts/html/"
  if (ScriptSteamShowURL("file:///C:/Program Files (x86)/" + HtmlDir + Page)){}
  else if (ScriptSteamShowURL("file:///C:/Program Files/" + HtmlDir + Page)){}
  else if (ScriptSteamShowURL("file:///~/Library/Application Support/" + HtmlDir + Page)){}
  else if (ScriptSteamShowURL("file:///~/.local/share/" + HtmlDir + Page)){}
  else if (ScriptSteamShowURL("file:///~/.steam/" + HtmlDir + Page)){}
  else ScriptShowHudMessageAll("Error: Cannot open " + Page, 3)

--Theevina (talk) 23:43, 30 October 2017 (UTC)