Trigger Scripting Question

Post » Tue Jun 19, 2012 7:01 pm

Hello all, I'm making my first trigger script and I could use some help. Basically what I want to happen is when the player activates an altar, it runs a quick check to see if you have all of the bug jars. If you do, it advances the quest.
(When the quest is advanced, it will remove all of the bug jars from your inventory and then enable a collection of disabled bugjars on the altar, but thats neither here nor there).

So I'm making this script, and it won't compile at all. Here is the script:

Scriptname AltarActivator extends ObjectReference Quest Property TBJ01  Auto MiscObject Property Butterfly  Auto MiscObject Property Bee  Auto MiscObject Property DragonFly  Auto MiscObject Property Torchbug  Auto MiscObject Property Moth  Auto event OnActivate()   if (Game.Getplayer().getItemCount(Bee)==1 AND Game.Getplayer().getItemCount(Butterfly)==1 AND Game.Getplayer().getItemCount(Dragonfly)==1 ANDGame.Getplayer().getItemCount(Moth)==1 AND Game.Getplayer().getItemCount(Torchbug)==1)	  TBJ01.SetStage(60)   endifendEvent

and here is my error code.


ompiling "AltarActivator"...
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AltarActivator.psc(16,45): missing RPAREN at 'AND'
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AltarActivator.psc(16,53): required (...)+ loop did not match anything at input '.'
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AltarActivator.psc(16,93): required (...)+ loop did not match anything at input 'AND'
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AltarActivator.psc(16,101): required (...)+ loop did not match anything at input '.'
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AltarActivator.psc(16,93): function variable Game already defined in the same scope
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AltarActivator.psc(16,141): required (...)+ loop did not match anything at input 'AND'
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AltarActivator.psc(17,39): required (...)+ loop did not match anything at input 'AND'
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AltarActivator.psc(17,47): required (...)+ loop did not match anything at input '.'
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AltarActivator.psc(17,39): function variable Game already defined in the same scope
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AltarActivator.psc(17,85): required (...)+ loop did not match anything at input ')'
No output generated for AltarActivator, compilation failed.


I can't decipher my error messages, can someone help me?
User avatar
Darian Ennels
 
Posts: 3406
Joined: Mon Aug 20, 2007 2:00 pm

Post » Tue Jun 19, 2012 4:10 pm

The http://www.creationkit.com/OnActivate_-_ObjectReference event has a parameter that you're not including, so I expect the compiler will throw an error because of a bad override attempt, although I'll admit I don't see that message here.

The problem is that you're trying to use "AND", which isn't anything recognised by the compiler, where you should be using the && operator.

Cipscis
User avatar
Yvonne Gruening
 
Posts: 3503
Joined: Mon Apr 23, 2007 7:31 pm

Post » Tue Jun 19, 2012 7:15 pm

The http://www.creationkit.com/OnActivate_-_ObjectReference event has a parameter that you're not including, so I expect the compiler will throw an error because of a bad override attempt, although I'll admit I don't see that message here.

The problem is that you're trying to use "AND", which isn't anything recognised by the compiler, where you should be using the && operator.

Cipscis

Thanks for the && thing, it helped a lot. The only error I get now is


Compiling "AltarActivator"...
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AltarActivator.psc(15,0): the parameter types of function onactivate in the empty state on script altaractivator do not match the parent script objectreference
No output generated for AltarActivator, compilation failed.

which I think is the other thing you were talking about. I'm looking into what that parameter is and how to fix it, but if you have any tips I'm all ears.
User avatar
Sharra Llenos
 
Posts: 3399
Joined: Wed Jan 17, 2007 1:09 pm

Post » Tue Jun 19, 2012 5:05 pm

That's the one, yeah. You need to change the first line of your definition of http://www.creationkit.com/OnActivate_-_ObjectReference to this:
Event OnActivate(ObjectReference akActionRef)

Cipscis
User avatar
Astargoth Rockin' Design
 
Posts: 3450
Joined: Mon Apr 02, 2007 2:51 pm

Post » Tue Jun 19, 2012 10:24 pm

That's the one, yeah. You need to change the first line of your definition of http://www.creationkit.com/OnActivate_-_ObjectReference to this:
Event OnActivate(ObjectReference akActionRef)

Thanks, its compiling at least. we'll see if it works.

Cipscis
User avatar
Jaylene Brower
 
Posts: 3347
Joined: Tue Aug 15, 2006 12:24 pm


Return to V - Skyrim