Difference between revisions of "Category talk:Scripting"

Jump to navigation Jump to search
1,116 bytes added ,  12:48, 12 July 2006
→‎Script Limit: reorganization, more questions
imported>JOG
m (→‎Script Limit: sign...)
imported>DragoonWraith
(→‎Script Limit: reorganization, more questions)
Line 1: Line 1:
==Script Limit==
==Script Limit==
=== Defining the Limit ===


Is there a limit to the number of lines a script can contain?  I'm currently editing a script with about 52 lines (including debug code to later be stripped), and the CS refuses to save changes beyond a certain point.  If I click on the save button, and then try to edit the script editor, I get the "do you want to save this script" message; if I say "yes", it just returns me to the editor.  If I say "no", it closes the editor but the changes are not saved.
Is there a limit to the number of lines a script can contain?  I'm currently editing a script with about 52 lines (including debug code to later be stripped), and the CS refuses to save changes beyond a certain point.  If I click on the save button, and then try to edit the script editor, I get the "do you want to save this script" message; if I say "yes", it just returns me to the editor.  If I say "no", it closes the editor but the changes are not saved.
Line 19: Line 21:


:::[[User:ShadowDancer|ShadowDancer]] 09:12, 11 July 2006 (EDT): K, I have the actual answer.  The limit '''is''' 32,767 and its the number of characters '''including special characters''' i.e. the enter key.  If you add the number of lines to the number of characters (with spaces), you end up with 32,768 and since there isn't a return after the last line, that is one less return which results in 32,767.  It is probably just an artificial limit in the base programming (probably visual basic) creating the scriptedit box.
:::[[User:ShadowDancer|ShadowDancer]] 09:12, 11 July 2006 (EDT): K, I have the actual answer.  The limit '''is''' 32,767 and its the number of characters '''including special characters''' i.e. the enter key.  If you add the number of lines to the number of characters (with spaces), you end up with 32,768 and since there isn't a return after the last line, that is one less return which results in 32,767.  It is probably just an artificial limit in the base programming (probably visual basic) creating the scriptedit box.
=== Extending the Limit ===


::::[[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>]] 10:13, 11 July 2006 (EDT): I know little about how you would program the script editor, but is it possible to have a limitless box? Because I really would like to write a script about 5x or 6x the size of the limit...
::::[[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>]] 10:13, 11 July 2006 (EDT): I know little about how you would program the script editor, but is it possible to have a limitless box? Because I really would like to write a script about 5x or 6x the size of the limit...
Line 40: Line 44:
:[[User:ShadowDancer|ShadowDancer]] 12:49, 12 July 2006 (EDT): Actually, I can imagine a great deal of typing that would be saved by that.  I mentioned MS Word because I was still stuck in the character limit explaination mode as well as that being the first editor I used to open the .esp file and it seemed to work fine.  As for using a plaintext editor, you are right about it probably being better.  Normally thats what I use for coding HTML.  The only issue I have with notepad is that there is a limit on the amount of data that notepad can hold.  Wordpad actually works better since it can hold more data.
:[[User:ShadowDancer|ShadowDancer]] 12:49, 12 July 2006 (EDT): Actually, I can imagine a great deal of typing that would be saved by that.  I mentioned MS Word because I was still stuck in the character limit explaination mode as well as that being the first editor I used to open the .esp file and it seemed to work fine.  As for using a plaintext editor, you are right about it probably being better.  Normally thats what I use for coding HTML.  The only issue I have with notepad is that there is a limit on the amount of data that notepad can hold.  Wordpad actually works better since it can hold more data.


----
::For long scripts I use emacs, and the CS was made with Visual C++ (see start of RTL at 0x590aac)--[[User:JOG|JOG]] 13:00, 12 July 2006 (EDT)
 
:::[[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>]] 13:48, 12 July 2006 (EDT): I read Emacs's website, and while it seems a powerful tool, I didn't really see how you used it. Do you have it specially set up to help with TES scripting, or do you just use it as a text editor with extra features?
 
:::And what effect, if any, does the fact that C++ was used have on whether or not it would be possible to write longer scripts than usually allowed?
 
::[[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>]] 13:48, 12 July 2006 (EDT): @ShadowDancer: There are a number of very good programs available for code editting. I use Notepad mostly because I'm too lazy to try out the other ones.
 
=== Ways Around the Limit (that don't involve 3rd party apps) ===


::::[[User:Scruggs|Scruggs]] 19:30, 10 July 2006 (EDT) I would think it would be a limit of the ''compiled'' script, not the actual text, but i can't say that for sure. If you want to reduce the size of a script, though, you can transfer some of your if blocks into quest stages or dialog topics, setting up the conditions to do the work for you. Then just call [[setStage]] or [[Say]] to run the conditions. [[Say]] is useful when you need the results to run on the calling actor, which setStage won't allow.
::::[[User:Scruggs|Scruggs]] 19:30, 10 July 2006 (EDT) I would think it would be a limit of the ''compiled'' script, not the actual text, but i can't say that for sure. If you want to reduce the size of a script, though, you can transfer some of your if blocks into quest stages or dialog topics, setting up the conditions to do the work for you. Then just call [[setStage]] or [[Say]] to run the conditions. [[Say]] is useful when you need the results to run on the calling actor, which setStage won't allow.
Line 48: Line 60:
::::::[[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.
::::::[[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).
::::::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.


::For long scripts I use emacs, and the CS was made with Visual C++ (see start of RTL at 0x590aac)--[[User:JOG|JOG]] 13:00, 12 July 2006 (EDT)
:::::: 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 ==

Navigation menu