Noggog Posted February 7, 2011 Share Posted February 7, 2011 (edited) Just a quick question. If I've got quest that's running a script, and it's in the middle of the script when I call stopquest on its quest, will it stop immediately where it is? or finish to the end and not start again? Edited February 7, 2011 by Leviathan1753 Link to comment Share on other sites More sharing options...
Pronam Posted February 7, 2011 Share Posted February 7, 2011 It'll finish till it ran till the end and then act like it never existed. Keep the wiki along with it ;): StopQuest Link to comment Share on other sites More sharing options...
Hickory Posted February 7, 2011 Share Posted February 7, 2011 The script will keep running until the end unless you craft it not to. Eg. If xxx == 1 StopQuest myquest Return Else DoSomethingElse Endif Link to comment Share on other sites More sharing options...
Noggog Posted February 7, 2011 Author Share Posted February 7, 2011 Cool, thanks for the tippers. So the wiki doesn't explicitly state that the scripts variables are destroyed, but from what you said I'm guessing they are? I'll just move anything important to globals then. Link to comment Share on other sites More sharing options...
Noggog Posted February 8, 2011 Author Share Posted February 8, 2011 I have a related question concerning OBSE arrays. If I create an array and fill it in a script, and then the script stops, will the array be erased? I've been looking at a few different documentations and I didn't see much information one way or the other. If it is deleted on script termination, how do I get a global array set up that will remain once that function ends? As of now I'm using Pluggy arrays that are set to a global long variable, but OBSE arrays are their own type, and so I can't easily make them global. Link to comment Share on other sites More sharing options...
whalecakes Posted February 8, 2011 Share Posted February 8, 2011 Generally, quest scripts are used to create globals as they are not attached to any references and can be checked and modified by anything. The quest script doesn't even have to have anything else in it, you could just make it a bunch of variable declarations if you wanted to. Link to comment Share on other sites More sharing options...
QQuix Posted February 8, 2011 Share Posted February 8, 2011 Quest variables will keep their values, no matter if the quest is running, has been stopped with StopQuest or has never started running in the first place. Variables in Object scripts will also keep their values as long as the object exists. Enable / Disable do not affect the variables here either, btw. Function scripts will destroy their Array_vars on exit, as they (function scripts) are designed to be single-use. Be careful here: function scripts do not destroy their String_vars automatically. You have to destroy them with sv_destruct. I suppose the same is true for Pluggy vars in function scripts. Link to comment Share on other sites More sharing options...
Noggog Posted February 8, 2011 Author Share Posted February 8, 2011 (edited) Quest variables will keep their values, no matter if the quest is running, has been stopped with StopQuest or has never started running in the first place. Variables in Object scripts will also keep their values as long as the object exists. Enable / Disable do not affect the variables here either, btw. Function scripts will destroy their Array_vars on exit, as they (function scripts) are designed to be single-use. Be careful here: function scripts do not destroy their String_vars automatically. You have to destroy them with sv_destruct. I suppose the same is true for Pluggy vars in function scripts. Unfortunate, as I would like an array that's persistent. I don't want my arrays to be scrapped when my script ends. Is there any way to stop the destruction of the Array_vars on script exit? Edited February 8, 2011 by Leviathan1753 Link to comment Share on other sites More sharing options...
QQuix Posted February 9, 2011 Share Posted February 9, 2011 As whalecakes said, put your arrays in a quest script and have the functions use them instead of local arrays. Scn MyQuestSCRIPT Array_var MyArray01 Array_var MyArray02 Scn MyFunction Begin Function {} Let MyQuest.MyArray01 := ar_construct array Let MyQuest.MyArray01[0] := Apple Let MyQuest.MyArray01[1] := MyQuest.MyArray02[99] ;;; whatever MyQuest.MyArray02[99] may be end Link to comment Share on other sites More sharing options...
Noggog Posted February 9, 2011 Author Share Posted February 9, 2011 Ah sorry, I was thinking of quest scripts and functions as equivalent things. Cool, thanks for all the help guys! Link to comment Share on other sites More sharing options...
Recommended Posts