Talk:Activate
Is it just me, or is a lot of Kkuhlmann's information here wrong? Activate blocks are done when called, not later, correct?
Dragoon Wraith TALK 10:54, 13 July 2007 (EDT)
- You can actually tell who's saying what??? Yeah, that information is incorrect on activating (not quite sure about onUnEquip, I'd say yes but I have one more thing to test). An activation runs the entire onActivate block (be it another object or that object) before the next line of code is processed. Not quite sure about "Atomic" and having multiple onActivate blocks in a script though (mainly because it hurts to think about why one would do that...).
- Well it could have many use. One example is for controlling cascading events, e.g. activating a lever could trigger some action from its onActivate block,like opening a door, cast some spell, do something whatever, AND activate another guyzmo like a remote activator on the player which itself could do many things, and so on (5 max is quite enough)... Many scenarios could justify such a use imho. I already see one advantage, in design terms : splitting a scenario storyboard-like (assuming that 5 scenes max can be implemented in such a way and designing/coding consequently), and implementing each "scene" of the so-called storyboard within one activator or token. This could even replace the use of a quest in some situations where some control over a chain of events is needed, triggered while entering a cell for instance, thus simulating a scene or animation involving multiple objects, for stories that are non-linear offering multiple path / multiple actions, etc... Or maybe my understanding is missing something - being the mister newbie of the day... Does what I wrote makes sense, or are there more efficient ways to do the same thing for all situations? --HawkFest 22:26, 11 September 2007 (EDT)
- Also, this article is really confusing. Really, really, really confusing and since it doesn't mention that the reference is the object that's activated, it borders on useless. *sigh* I need to say more about it, but what's keeping me from rewriting the whole article - I don't want to turn it into a different structure/flow from other function articles, and I simply haven't read all of them. (I am more than happy to run tests, though - hence the nesting section)
- --Haama 12:58, 13 July 2007 (EDT)
- On the Wiki, correct information > consistent formatting. Feel free to fix this any way you like. If necessary, I can re-format what you write to make it consistent. I simply don't know enough about the intricacies of this function to write it myself. You might want to have a look at OnActivate, too.
- Dragoon Wraith TALK 15:53, 13 July 2007 (EDT)
- Wow, just wow... I'll start working on both of them. There are some things I just don't know, though - for instance, what will Activate SomeRandomNPC do? Does a simple Activate really assume the "Activator's 'current ActivatorID'" (rewritten as "Activator's ActionRef") or does it assume the player? Also, this is a unique case, as the ActivatorID is required if you use the RunOnActivateFlag, but optional if you don't (well, again, does it actually do anything for normal activation?)
- --Haama 17:54, 13 July 2007 (EDT)
- One part that's somewhat right - a foreign object does get flagged for 'onAdd' blocks, but I don't think the flag is on the object (because it won't run if you then move it to the player), but instead the flag is set on the cell (because the script will run once you enter that cell, even if the object is somewhere else)
- --Haama 13:02, 13 July 2007 (EDT)
Syntax
Alright, so that's how it should look now? This is based on discussions on the Terminology Discussion thread on the Elder Scrolls Forums and Wrye's Modding Terminology paper. Some parts are pretty much finalized, some is still up in the air, so please continue the discussion in the Community Portal.
--Haama 20:20, 14 July 2007 (EDT)
Syntax Question
This page is unclear, does player.Activate doorID mean the player activates the door, or the door activates the player?
--Kkuhlmann 12:04, 6 April 2006 (EDT): What you wrote means the door is activating the player. If you want to simulate the player activating a door: DoorID.Activate player
Scripting Issues
--Mrflippy 12:59, 12 April 2006 (EDT) I've been having some issues with this command in scripts. Sometimes, "object.activate me, 1" just doesn't work. The OnActivate block in the script attached to object isn't run at all. Most of the activators I work with are dynamically created using PlaceAtMe. Is this the source of the problem?
--Tegid 13:37, 12 April 2006 (EDT) I too am having this problem. Is there some kind of time constraint on activation? What causes them to just not activate? If they are already inside their OnActivate block and someone calls Activate on them, what happens then?
--Kkuhlmann 14:01, 12 April 2006 (EDT): Some things to keep in mind which could be causing your issues:
- All "action" block types (OnActivate, OnEquip, OnAdd, etc.) work by setting a flag on the script when the action occurs. The next time the script runs, if the appropriate block flag is set, that block is executed, and the flag is reset (so it doesn't run it more than once for a single action).
- Object scripts only run if the object is in the currently loaded area -- where the player is. So calling Activate on something that isn't loaded will set the flag for that action, but won't actually trigger the script (it will trigger the next time the object's script is run). NPC scripts (on persistent NPCs) do run when they're not loaded, but only when their AI is updated, which can happen as infrequently as every 15 game minutes.
--Tegid 15:13, 12 April 2006 (EDT) So three questions.
- That reset happens when the OnActivate block starts or stops? (So if I send another activate before it is finished with its block, will it be cleared when its block ends and therefore never happen?)
- --Kkuhlmann 08:49, 14 April 2006 (EDT): Reset happens when the script is finished processing. So calling Activate on an object from within its own script won't work.
- As long as I've used PlaceAtMe to create this object, the second section shouldn't apply correct?
- Are script blocks atomic?
- --Kkuhlmann 08:49, 14 April 2006 (EDT): I don't know that I understand what you're asking. You CAN have more than one script block of the same type in a script -- since the flags are cleared at the end of the script, any number of blocks of the same type can exist in the script just fine. Why you'd want to do this, I don't know. But you could. If that's what you were asking.
- --Tegid 09:27, 14 April 2006 (EDT): By Atomic I mean, does the entire script block (or script) execute without interruption by another script, or can it be interrupted by another script mid-run and then come back and finish later?
--Tegid 00:40, 26 April 2006 (EDT) With MrFlippy's help, I believe I have found an issue with chained activations. If I have more than four objects which pass a single Reference down an activate chain, after the fourth pass, my reference is normally != to what it was when it started down the chain. (It does SOMETIMES make it to the 5th object). As an example.
scn Object1Script ref incoming begin OnActivate set incoming to GetActionRef if (incoming == SomePresetReferenceInAPersistentObject) Message "I am doing something cool in Object 1",1 endif Object2Ref.Activate incoming 1 end
if Object2Ref has a script that is similar but activates Object3Ref like so
scn Object2Script ref incoming begin OnActivate set incoming to GetActionRef if (incoming == SomePresetReferenceInAPersistentObject) Message "I am doing something cool in Object 2", 1 endif Object3Ref.Activate incoming 1 end
And so on down to Object5, object 5 will NOT execute the code inside its if statement. That equality will evaluate to false. Am I missing something, or is this a bug based on something you couldn't imagine us wanting to do?