Control sim command via custom command

1 post in this topic

Here is the situation:

I have 1 manipulator with custom command, but I want, depending of the value of a variable, to use it to run a sim/command. Which I cannot make it work. A pseudocode example of this:

custom_cmd_1 = cmd.newCommand("custom/cmd/1", "A custom command", "custom_cmd_1")
sim_cmd_1 = cmd.newCommand("sim/foo/cmd1". "A sim command", "sim_cmd_1")

function main()

if variable_X = 0 then --Now we want to use the custom command to run our code

	function custom_cmd_1_OnStart()
		dref.setInt(foo, 1)

  elseif variable_X = 1 then -- Now we want our command to execute the sim command

	function custom_cmd_1_OnStart()
		cmd.onceByName("sim/foo/cmd1") --Or cmd.beginByName ... the results are the same.

end --if

end	--main

There is a way, by using a 2nd manipulator with ANIM show/hide, but I'm looking if there is a way to do it through code.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.