Difference between revisions of "Category talk:Scripting"

1,888 bytes added ,  20:13, 10 July 2006
description of using Say to reduce script length
imported>DragoonWraith
imported>Scruggs
(description of using Say to reduce script length)
Line 21: Line 21:


:::::[[User:DragoonWraith|<font face="Oblivion,Daedric" size=3>D</font>ragoon <font face="Oblivion,Daedric" size=3>W</font>raith]] [[User_talk:DragoonWraith|<font face="Oblivion,Daedric" size=2>TALK</font>]] 19:58, 10 July 2006 (EDT): I actually do have ways around it, but since I'm not sure how that would work... how would you use [[Say]]?
:::::[[User:DragoonWraith|<font face="Oblivion,Daedric" size=3>D</font>ragoon <font face="Oblivion,Daedric" size=3>W</font>raith]] [[User_talk:DragoonWraith|<font face="Oblivion,Daedric" size=2>TALK</font>]] 19:58, 10 July 2006 (EDT): I actually do have ways around it, but since I'm not sure how that would work... how would you use [[Say]]?
: [[User:Scruggs|Scruggs]] 21:13, 10 July 2006 (EDT) Each dialog topic can have multiple responses, with each response having a different set of conditions. When you call ''Say'', the calling actor picks the response(s) in that topic for which he passes the conditions, and runs the result script on himself. There is no text and no voice associated with the responses. A simple (and stupid) example: you created a spell that kills the target, if he belongs to any of the five joinable factions. You could either add a separate if-elseif to your script for each faction, or you could set up a topic with 5 responses filtered for each of the guilds. So the first response's condition would be '''getInFaction magesGuild == 1.00''' and it's results would be '''kill'''. Calling '''Say myTopic''' from your script turns several lines of code into just one line.
: Obviously, it's not a huge benefit when you're only testing for five conditions, but if you're approaching the limit for script length it could be very useful. I'm still trying to figure out if NPCs will say ''all'' of the responses within that topic for which they pass the conditions, or just the first one that matches. If they only speak one response, you could most likely chain them up by calling ''Say'' again in the results field. That would let you check for all conditions (such as checking for all factions to which a NPC might belong, instead of just one).
: This, along with quest stage results for conditions/results that don't need to run on a specific target, is making the scripting for Oblivion Unscripted much easier, since I do a lot of randomly-generated stuff. It also makes it easier to add new conditions or change things around, without having to restructure your script. And it makes long scripts more compact and easier to read. I thought it might be useful to you given the size of your scripts.


== If / Elseif / Else explanation ==
== If / Elseif / Else explanation ==
Anonymous user