Jump to content

Getting targetname through parms


Recommended Posts

I saw @@MoonDog do this in a script - getting a targetname to affect, by using the trigger_multiple's parm3 value.

 

Here's how mine looks for now - I had to remove some parts of the script while troubleshooting:

affect ( $get( STRING, "SET_PARM3")$, /*@AFFECT_TYPE*/ FLUSH )
{
	rotate ( < 0.000 90.000 0.000 >, $get( FLOAT, "SET_PARM2")$ );
}

This is supposed to run on the trigger that uses the scriptrunner. The trigger has parm3 - ovendoor. The entity I want to affect has script_targetname - ovendoor. Getting the time using parm2 works, but not getting the targetname.

 

Ideas?

Link to comment

https://www.dropbox.com/s/wi97ftpxsqwii8s/ovenmap.pk3

 

Here you go. Your script was running on nothing basically, because it wasn't reading that it should activate on the trigger and use the variable that stores the string for the func_static. So I deleted your scriptrunner and made the trigger run the script directly. I also fixed the parm for the movement time to be on the the trigger and reflect the correct parm number from your script.

 

I put the fixed .map file in the PK3. Enjoy.

Boothand likes this
Link to comment

Yay! Thank you very much.

 

Thought I couldn't have usescript on triggers, since it wasn't mentioned in the entity properties! That's great though. You said you fixed the parm for movement time to be on the trigger, but the way the script works, it must be on the entity, which I wanted anyway!

Link to comment

Strangeness. It didn't work for me, and it makes sense to me because it affects the door entity and after that affect, it gets parm2.

 

Anyway, a different issue.

I've really experimented a lot with this (tried countless combinations), and I've set up an if/else.

It never reaches the else, even though everything seemingly makes sense. I'm using the usescript key on the trigger, and have set up parm1 on the trigger as 0, in addition to parm3 as the door's script_targetname. The door entity has a parm4 that names the trigger's script_targetname, in addition to the parm2 as the time.

I just want to toggle it to open and close with the same trigger, but so far it only opens and does nothing at second triggering. I've tried making failsafes for this to troubleshoot the problem, to identify if it's affecting the wrong things and so on. No change yet.

 

Here's the script:

//Generated by BehavEd

rem ( "General rotate-opener - PARM1 = closed/open - PARM 2 = time - PARM3&4 = script_targetnames" );

if ( $get( FLOAT, "SET_PARM1")$, $=$, $0$ )
{
	set ( /*@SET_TYPES*/ "SET_PARM1", "1" );

	affect ( $get( STRING, "SET_PARM3")$, /*@AFFECT_TYPE*/ FLUSH )
	{
		rotate ( < 0.000 90.000 0.000 >, $get( FLOAT, "SET_PARM2")$ );
		flush (  );
	}

}


else (  )
{
	set ( /*@SET_TYPES*/ "SET_PARM1", "0" );

	affect ( $get( STRING, "SET_PARM3")$, /*@AFFECT_TYPE*/ FLUSH )
	{
		rotate ( < 0.000 0.000 0.000 >, $get( FLOAT, "SET_PARM2")$ );
		flush (  );
	}

}


EDIT: Noticed that this version excludes the parm4 deal, but that didn't work anyway

Link to comment

Here, have a look at the two way 90 degree rotation script from my secret santa submission last year. I'm going to be busy the next few days, so this is the best i can do for now.
 
 
 http://pastebin.com/4C6cFfKs

 

Here's the .map file. https://www.dropbox.com/s/992wiwq5xgzzejy/winter_retreat.map. You are gonna have to pick through the two of these on your own. I'd help you more if I could, but I'm swamped. 

Boothand likes this
Link to comment

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
×
×
  • Create New...