Skip to content

Conversation

main-thing
Copy link

@main-thing main-thing commented Sep 10, 2025

Description

This PR aims to add more functionality to the Input<name>() callback.

This PR adds the following functionality:

  • a new variable input_value that stores the parameter of the input.
  • activator and caller can be reassigned within the function.

Example:

local temp = SpawnEntityFromTable("info_target", {targetname = "entity_1"})
local test_ent = SpawnEntityFromTable("info_target", {targetname = "entity_2"})
test_ent.ValidateScriptScope()
test_ent.GetScriptScope().Inputrunscriptcode <- function()
{
	printf("Input Value: %s\n", input_value)
	printf("Initial Activator: %s\n", activator.GetName())
	activator = self
	caller = self
	return true
}

test_ent.AcceptInput("runscriptcode", "printf(`Current Activator: %s\n`, activator.GetName())", temp, temp)
temp.Destroy()
test_ent.Destroy()

/* Console output:
] script_execute input_remap_test
Input Value: printf(`Current Activator: %s`, activator.GetName())
Initial Activator: entity_1
Current Activator: entity_2
*/

adds new functionality to Input<name>() in vscript to

- read the parameters of an input, via the input_value variable.

- reassigning the activator and caller of the input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant