Difference between revisions of "Global Scripts/Extended"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Haama
(So far)
 
imported>Haama
(Maybe should be called Centralized Scripts?)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
I'm thinking this should be called "Centralized Scripts" instead of global. The current global script page would either be included into or moved to a folder ("/", as this page).
----
Oblivion scripts, especially vanilla ones, tend to be object oriented, isolated, and independent. That is, the script is focused on the object alone, won't look at variables on other scripts, won't have variables that are set or even seen by other scripts, and the script will stop running once the player has left the cell. Even for quests, they act independent of other quests and only run until the quest is finished.
Oblivion scripts, especially vanilla ones, tend to be object oriented, isolated, and independent. That is, the script is focused on the object alone, won't look at variables on other scripts, won't have variables that are set or even seen by other scripts, and the script will stop running once the player has left the cell. Even for quests, they act independent of other quests and only run until the quest is finished.


This is an extremely limited way of using scripts, but it is possible to hack and abuse the system a bit to make global scripts.
This is an extremely limited way of using scripts, but it is possible to hack and abuse the system a bit to make global scripts.


There are several types of global scripts, but essentially all can run whenever you want, all the time, and can share variables.
There are several types of global scripts, but essentially they're used to control when they run, run all the time, share variables, or provide extra variables.


----
----
Activators vs. Quests


Oblivion scripts, especially vanilla ones, tend to be object oriented - each object acts independently of other objects, has their own set of variables that are untouched and unseen by other scripts, only run while the player is in the same cell, and even quests ignore the where the player is in other quests, run for a limited time (while the quest is unfinished), etc. This is an extremely limited way of using scripts, but there are tricks to
There are several types of global scripts, but (basically all are made for interconnecitvety... all are meant to always run...always in memory)
----
----
 
Functions
Global scripts are used to
----
 
Global scripts
----
Adding and running a script on everything (every NPC, etc.)
New OBSE ref walking script and a central script better than tokens
Tokens are better than scripted effects
----
----



Latest revision as of 17:21, 20 July 2008

I'm thinking this should be called "Centralized Scripts" instead of global. The current global script page would either be included into or moved to a folder ("/", as this page).


Oblivion scripts, especially vanilla ones, tend to be object oriented, isolated, and independent. That is, the script is focused on the object alone, won't look at variables on other scripts, won't have variables that are set or even seen by other scripts, and the script will stop running once the player has left the cell. Even for quests, they act independent of other quests and only run until the quest is finished.

This is an extremely limited way of using scripts, but it is possible to hack and abuse the system a bit to make global scripts.

There are several types of global scripts, but essentially they're used to control when they run, run all the time, share variables, or provide extra variables.


Activators vs. Quests


Functions


Global scripts


Adding and running a script on everything (every NPC, etc.) New OBSE ref walking script and a central script better than tokens Tokens are better than scripted effects


MenuModes[edit | edit source]

Surprisingly, generic MenuMode blocks will run during the opening Main Menu (before the player has even loaded a game!). This is unnecessary and can even cause problems and CTDs. To prevent the script from running during this time, add a 1044 block with Return before the main, generic MenuMode block

begin GameMode
	...
end

begin MenuMode 1044 ;Main Menu
	return
end

begin MenuMode
	...
end

There are other menus that may cause problems or that don't require the script to be running. This if statement will cause the script to Return during those unnecessary menus. (Note that, due to wiki limiatations, the single if line has been broken into several lines)

begin MenuMode
	;If you're using an activator, make sure to test and set the Working variable
	if (MenuMode 1001) || (MenuMode 1007) || (MenuMode 1009) || (MenuMode 1012) || (MenuMode 1013)
	 || (MenuMode 1015) || (MenuMode 1016) || (MenuMode 1017) || (MenuMode 1018) || (MenuMode 1019)
	 || (MenuMode 1020) || (MenuMode 1021) || (MenuMode 1030) || (MenuMode 1032) || (MenuMode 1036)
	 || (MenuMode 1038) || (MenuMode 1039) || (MenuMode 1044) || (MenuMode 1047)
	 ;Loading Area screen, Dialog, Sleep/Wait, Pause, Options, Audio, Video, Video Display,
	 Gameplay, Controls, Class, Skills, Race/Sex, Load, Save, Main, Credits
		return
	endif
	...