A few scripting / linking questions

Post » Fri May 27, 2011 2:52 pm

I'm a little confused as to what to use and when.

For example, I want to set up vault door with klaxons and bells and whistles and what-not. I could set a button to activate the door and set the door as the klaxon's activate parent. Button activates door, door activates klaxons. Fine.

That, however, leaves the lights on. Ideally I'd want the klaxons to twirl until the door animation finished, or for x seconds.

So my logic says to remove the klaxons and script their activation but with lack of documentation for the scripting, I'm at a loss. From what I've learned the only reference I can get in the button's script is the button's linked reference (i.e the door). I tried naming the references of the klaxons and activating them in the script but.. nothing.

Anyone know any tuts or examples in the geck I can look at? Anything at all that would help me get a grip on how this whole system works?

Thanks
User avatar
leigh stewart
 
Posts: 3415
Joined: Mon Oct 23, 2006 8:59 am

Post » Fri May 27, 2011 2:54 pm

I think your problem was you may not have called http://geck.gamesas.com/index.php/Activate- it needs to have a 1 supplied as the second argument so the script on the activated item runs. Alternatively you didn't check the Persistent Reference box on the klaxons so they could be used in the script, but then it wouldn't have compiled.

There's not a great deal of scripting tutorials for the GECK as it uses basically the same language as the Oblivion Construction Set, for which there's a bunch of resources. There's a tutorial on how to write timer scripts on the CS wiki http://cs.elderscrolls.com/constwiki/index.php/Scripting_Tutorial:_Creating_a_Simple_Timer, you might find useful for the klaxon opening/closing timer.
User avatar
Far'ed K.G.h.m
 
Posts: 3464
Joined: Sat Jul 14, 2007 11:03 pm

Post » Fri May 27, 2011 2:36 pm

Hey it's Talkie Toaster. Toastin's the game... and you know the rest.

Thanks man, I'd neglected to check out the Construction Set's wiki. Since posting I've managed to figure out a little more but I still have problems.

I've been using a short to hold a state and it seems to be messing up. I seem to remember reading that all variables are initialized to 0 but I just get odd results. I had problems in my vault door but I recreated the problem with this, just place it on an activator button/panel/whatever.

scn ProblematicButtonSCRIPTshort modebegin OnActivate	if IsActionRef player == 1		set mode to mode + 1		endifendbegin gameMode	if mode == 0		player.additem caps001 100	else if mode == 1		player.additem caps001 1	else if mode == 2		player.additem caps001 2	else if mode == 3		player.additem caps001 3	else if mode == 4		player.additem caps001 4	endifend


If you run it, it starts out fine. Every tick you are given 100 caps. If you press the button, you then get 1 bottlecap per tick. Which is right: mode should have changed to 1. But then, clicking the button again, nothing happens. You continue to recieve 1 bottlecap.

(I'm giving the player bottlecaps because I don't know how else to test the content of the mode var.)

I ran as many checks as I could and while the above messes up, the below works fine. I'm sure I'm just not getting it somehow.

scn ProblematicButtonSCRIPTshort modebegin OnActivate	if IsActionRef player == 1		set mode to mode + 1	                player.additem caps001 mode	endifend



Can anyone shed any light?

Thanks.
User avatar
Franko AlVarado
 
Posts: 3473
Joined: Sun Nov 18, 2007 7:49 pm

Post » Fri May 27, 2011 7:06 am

Pretty sure you have to use elseif, rather than else if- it's probably evaluating as
if 123   abcelse   if 456      def   else
And dying at that point due to mismatched numbers of endifs. The compiler doesn't detect if mismatches properly, unfortunately.
User avatar
Milagros Osorio
 
Posts: 3426
Joined: Fri Aug 25, 2006 4:33 pm

Post » Fri May 27, 2011 6:04 am

Pretty sure you have to use elseif, rather than else if-

Damn. I've even been staring at the wiki pages for conditional statements.

Thanks, Talkie.
User avatar
emily grieve
 
Posts: 3408
Joined: Thu Jun 22, 2006 11:55 pm


Return to Fallout: New Vegas