Cipscis Posted February 14, 2012 Share Posted February 14, 2012 Hey everyone! Just a notification that I've put a new tutorial up in cipscis.com's Skyrim section, talking about the various ways in which functions and properties need to be accessed. Hopefully some of you will find it useful. Here's a link - Accessing External Functions and Properties in Papyrus As always, any feedback is appreciated. Cipscis Link to comment Share on other sites More sharing options...
gsmanners Posted February 14, 2012 Share Posted February 14, 2012 Nice. I have to say, I think the #2 example on cast referencing is a lot more clear. In particular because LinkedRef = GetLinkedRef() as TeleportOnBleedout and LinkedRef.TeleportAway() is much more readable than: LinkedRef = GetLinkedRef() and (LinkedRef as TeleportOnBleedout).TeleportAway() I mean, you may as well just make the #1 case: (GetLinkedRef() as TeleportOnBleedout).TeleportAway() and save yourself a line of code if you're going to make it that much less readable anyway. Link to comment Share on other sites More sharing options...
Cipscis Posted February 14, 2012 Author Share Posted February 14, 2012 Thanks :) I agree that it's clearer that way. I think it's easier to think of casting something to a different type as you're receiving it - when it still feels as though it could be "in flux" - than it is to think of casting it to a different type once you already have it - once it's been "set". Particularly if you're not used to the concept of casting. Hopefully having all of those working examples will help anyone unfamiliar with the concept to get their head around it a little bit better. Cipscis Link to comment Share on other sites More sharing options...
gsmanners Posted February 14, 2012 Share Posted February 14, 2012 The thing I can't wrap my head around is that warning in the wiki: Be careful with variables and auto properties on scripts that are extended by other scripts - especially where some script somewhere else may have a property pointing to the base script, or trying to cast to the base script. This is because it would be possible to have two copies of a script attached to the same object, thereby creating two copies of the variable/auto property - and the other scripts that refer to the base script may randomly pick which one to talk to. This is doubly-true of scripts with native functions, as the game can attach these to in-game objects at any time if it needs to, thereby creating another copy of the variable or auto property. I'm not quite sure how or why this sort of thing might come up. :huh: Link to comment Share on other sites More sharing options...
Cipscis Posted February 14, 2012 Author Share Posted February 14, 2012 That's... pretty unclear. It looks as though that warning has been there since the page's first iteration, too. I've added a note to the talk page about the warning. Hopefully it can be deciphered with a bit of community spirit :P Cipscis Link to comment Share on other sites More sharing options...
Arodicus Posted July 4, 2012 Share Posted July 4, 2012 Is there a way to actually SET a linked ref via code? I'm writing a script that creates two objects, and their scripts need to talk to each other, but for the life of me I can't figure out how. Link to comment Share on other sites More sharing options...
Recommended Posts