Update, If anyone wants to help, feel free to write up any one of these not listed in green and send it to me, or even better, post it here.
See this post here:
http://www.bethsoft.com/bgsforums/index.ph...t&p=9996919

Firstly, I have got permission from GhanBuriGhan to do this.

Morrowind Scripting for Dummies 8 is great. It includes all the scripting functions etc. The one problem with it is that it doesn't include all the quirks that have been discovered since is was written. For example, it doesn't include anything on why you shouldn't use the AddToLevCreature related functions. The problem with ForceGreeting in if-elseif blocks etc.
It also has the odd error in it, e.g. it says that you cannot use activate on loaddoors, infact you can, but you have to use it with OnActivate.

Here is a quick list of things that need adding/changing (Off the top of my head, so it isn't anywhere near complete)
Messagebox - Multiple messageboxs (Including journal updates) in the same frame can cause a CTD
Activate - Works with Loaddoor
ForceGreeting - If you use it in a If/Esleif/Else block, it will execute the following elseif/else rather than skiping them
AddToLevCreature - How it breaks other mods that use leveled lists
Targeted Scripts - Needs info on using OnActivate with targeted scripts
GetCurrentTime - V.8 Has no info on it
Doubling - Very old info on doubling needs an update
GetWindSpeed - Info on how to detect interiors acting like exteriors using this
CellChanged - Doesn't work for scripted teleporting etc
SetStat - Why you shouldn't use it
GetTarget - Fixed erronious info
PlayBink - Added info on conveting files to .bik etc
Clarifying the difference between a local and global script

Startscript - Problem with startscript re-running scripts
Indenting - Add Manausers Morrowind Script Indenter
GetPos, Y - When the value is converted to a long, the vaule will change if you have moves on the Y axis as well (unconfirmed)
Math - Sort out reference to Soralis' Math Mod (It doesn't exist on PES) - I have the math mod, so it can be reuploaded.



"Actor_ID" -> Equip, "p_restore_health_q" p 36 is wrong potions are not drunken by NPC's when equip ....
Maximum of 255 instructions (not lines)
Advise that (in general) reducing the number of scripts running improves efficiency more than reducing the complexity of individual scripts.
34th variable bug

math - loads of maths stuff
Remote communication between Global / Targeted Scripts
Pos FPS hogs and tips to avoid them


Chargen State Bug
GetWeaponDrawn Problem
http://www.bethsoft.com/bgsforums/index.ph...t&p=8001859

Updating local variable from script/object. More details
http://www.bethsoft.com/bgsforums/index.ph...t&p=8053380

Dialog notes:
http://www.bethsoft.com/bgsforums/index.ph...t&p=8183967
Note: May just need copy paste.

RemoveSpellEffects
http://www.bethsoft.com/bgsforums/index.ph...t&p=8384287

Fall
http://www.bethsoft.com/bgsforums/index.ph...t&p=8384287

Info on using Curse:
http://www.bethsoft.com/bgsforums/index.ph...t&p=8942914

Load of info on stuff:
http://www.bethsoft.com/bgsforums/index.ph...t&p=9611691

Gamesettings:
http://www.bethsoft.com/bgsforums/index.ph...t&p=9675763

GetWeaponType bug:
http://www.bethsoft.com/bgsforums/index.ph...t&p=9995291

Targeted Script Problems:
http://www.bethsoft.com/bgsforums/index.ph...t&p=9996919


Basically, anything that you think needs changing/adding/removing feel free to say.

Many thanks,
~Yacoby
Great News !!! good one foodndrink.gif
Need to get back later with a list but :

Remote communication between Global / Targeted Scripts

Pos FPS hogs and tips to avoid them

"Actor_ID" -> Equip, "p_restore_health_q" p 36 is wrong potions are not drunken by NPC's when equip ....

Get/Mod/SetSwimSpeed p 113 broken ....

more to follow
This is an awesome idea!

Ditto that, I'll come up with more later, I haven't got much right now.

I was gonna mention the potions one but I guess it's been said. You could mention ways around it?

And there are a couple of typos I noticed in there ...
QUOTE(Yacoby @ Sep 5 2006, 12:08 PM) *

Firstly, I have got permission from GhanBuriGhan to do this.

Morrowind Scripting for Dummies 8 is great. It includeds all the scripting functions etc. The one problem with it is that it doesn't include all the quirks that have been descovered since is was written.


First: yes, you have my blessings and godspeed smile.gif

I'll try to dig up my changelog stuff, couple things people have sent in over the years, and either post it here or send it to Yacoby directly.

Ghan

Good to see. Feel free to use my modstat/setstat info (I PMed).

Other thoughts:
It'd be nice to include some more info on scripting limits, e.g.

Maximum of 255 instructions (not lines) within an IF...ENDIF block or WHILE...ENDWHILE block.
Blanks / comments don't count, but some lines become two instructions, for example I think this is two:
Set anotherScript.someVariable to ( actorID->GetStrength )

Nesting While loops does not work [EDIT: NOT CORRECT - there must have been something else wrong]


Advise that (in general) reducing the number of scripts running improves efficiency more than reducing the complexity of individual scripts.
So, for example, if two short global scripts will always run at the same time, it makes sense to combine them.

Or if you've got a few global scripts which only need to run based on some check, it makes sense to place the checks in one "parent" script, and startscript the others from there when they need to run (remembering to ensure to run them once per game session if they need to conserve variable values).

The extra overhead of starting and stopping the child scripts is insignificant compared to the saving through putting all the checks in one script. (although startscripting can cause other scripts to run more than once in a frame, that should be less of an issue when the script doing the startscripting has been running for a long time - so is likely near the start of the script queue. This is because only scripts earlier in the queue than the calling script will be run twice. [at least I think this makes sense ??? - correct me if I'm wrong]).


34th variable bug
The 34th variable of a given type (e.g. float) in a script can be confused with a double-quote character by the compiler (under some circumstances). This can lead to a load of weird issues (and adding messageboxes to detect the problem can fix/change the problem - until you remove them, of course banghead.gif).

Declaring the 34th variable of a given type as e.g.:
float UNUSED

should avoid trouble (clearly you don't use it smile.gif).

Personally I've found that using many more than 34 shorts is fine, while floats cause trouble. Others have reported trouble with shorts too.


A script to check (NOT always correctly) for scripts being run multiple times in one frame:
(Taken from the "soon"-to-be-released new version of GCD)
Clearly it'd be best to put this sort of script in a utility mod of some sort which every user should use. That way other mods can simply include and check the e.g. UTIL_FrameNotChanged variable, rather than putting in another copy of the same script.

This could go for various other commonly required checks too, e.g. finding the current, maximum, and ratio of health/magicka/fatigue where there aren't direct functions to calculate these. The checks could be performed once per frame in one fairly large script which updates some globals. Any mod then wanting e.g. the ratio of current fatigue to maximum fatigue, could simply use a getFatigueRatio global, rather than do the calculations.

This sort of thing could (theoretically) be simpler and more efficient than the current every-modder-for-himself approach. However, it would have been most important a few years ago (unless anyone fancies rewriting half the mods in existence).

It's a thought in any case smile.gif.
CODE
Begin Gals_NewFrameCheck

;this script sets the Gals_FrameNotChanged global variable to 1 if the
;frame is *probably* the same. So where startscript commands would
;cause scripts to run many times in one frame, they can return if Gals_FrameNotChanged == 1.

float oldGameHour
float oldSecondsPassed
short constantFrameRateTimeout

;by default, assume this is a new frame
Set Gals_FrameNotChanged to 0

;when not in menu, check GameHour - if it's not increasing (it's a float), we're in the same frame.
;(if some nutter has stopped time, use the GetSecondsPassed check below instead.)
if ( menumode == 0 )
    if ( TimeScale != 0 )    
        if ( oldGameHour == GameHour )
            Set Gals_FrameNotChanged to 1
        else
            Set oldGameHour to GameHour
        endif
        return
    endif
endif


;When in menu, assume we're in the same frame if GetSecondsPassed returns the same as last time.
;This only usually works - sometimes GetSecondsPassed will happen to be the same two frames in a row.
;It's possible that constant framerates might lead to GetSecondsPassed returning the same value repeatedly.
;[this could happen for very low framerates, (GSP never returns > 0.2), or high capped framerates].
;For this reason, if the same value is returned 20 times in a row, the frame is assumed to have changed.
;So, when in menu, the Gals_FrameNotChanged variable is a good indicator, but can be wrong in both directions.

if ( GetSecondsPassed == oldSecondsPassed )
    Set constantFrameRateTimeout to ( constantFrameRateTimeout + 1 )
    if ( constantFrameRateTimeout == 20 )
        Set constantFrameRateTimeout to 0
    else
        Set Gals_FrameNotChanged to 1
    endif
else
    Set oldSecondsPassed to GetSecondsPassed
    Set constantFrameRateTimeout to 0
endif

End Gals_NewFrameCheck

Then this can be added to any script which shouldn't be run more than once in a frame:
CODE
;-------------------------------------------------------------
;Don't run twice in the same frame
;-------------------------------------------------------------
if ( Gals_FrameNotChanged == 1 )
    return
endif
;-------------------------------------------------------------


That's all I can think of at the moment.
QUOTE(Galsiah @ Sep 6 2006, 03:38 AM) *

A script to check (NOT always correctly) for scripts being run multiple times in one frame:
(Taken from the "soon"-to-be-released new version of GCD)
Clearly it'd be best to put this sort of script in a utility mod of some sort which every user should use. That way other mods can simply include and check the e.g. UTIL_FrameNotChanged variable, rather than putting in another copy of the same script.

I don't know if this occurs, but couldn't it happen that this script runs twice before another script has run once. That would keep that script from running that frame. that might be an issue, not sure.

For a long time I've wanted an update on MSFD, so I'm looking forward to this!
So happy to hear about this! I want to read it NOW!! biggrin.gif

Definitely include the 34th variable bug - that caused me so much grief before someone tipped me off about it. It definitely happens with the 34th short as well as floats.

And I'm interested to know the circumstances in which activate works on loaddoors - I tried it recently, with a GetDistance check to try to make a move from an exterior to an interior feel like an exterior-to-exterior "cellchange", but it wasn't having it.

K.
Hello,

This is a very good news. smile.gif
An useful thread about get/mod/set stat:
http://www.elderscrolls.com/forums/index.p...&hl=modstat
It should probably be added to the new MSFD
Edit: About levelled lists:
http://www.elderscrolls.com/forums/index.p...amp;hl=levelled

Bjam
QUOTE(Björn @ Sep 6 2006, 09:41 AM) *
I don't know if this occurs, but couldn't it happen that this script runs twice before another script has run once. That would keep that script from running that frame. that might be an issue, not sure.
Damnit. You're right.

In that case, the only reliable method might be to put a gamehour check (and perhaps the rest for scripts that run in menumode) at the top of every script which mustn't run more than once. That's rather annoying.

However, the script as it stands still might be useful. E.g. if it is not important that your script runs every frame, but is important that it doesn't run multiple times.

I can't think of a way to put it right - perhaps there isn't one. It does work quite well as it stands for startscripts in newly started scripts. Such scripts will be at/near the end of the queue, so all/most other scripts will have already run by the time the startscript occurs. This will help in the worst case, where you have a chain of scripts starting one after the other.

I'll try to think of a way to get things working more accurately.
Thanks for the thought.
QUOTE(exclusiveor77 @ Sep 5 2006, 05:10 PM) *

Great News !!! good one foodndrink.gif
Need to get back later with a list but :

Remote communication between Global / Targeted Scripts

Pos FPS hogs and tips to avoid them

"Actor_ID" -> Equip, "p_restore_health_q" p 36 is wrong potions are not drunken by NPC's when equip ....

Get/Mod/SetSwimSpeed p 113 broken ....

more to follow

Cool Thanks smile.gif


QUOTE(Danjb @ Sep 5 2006, 05:54 PM) *


I was gonna mention the potions one but I guess it's been said. You could mention ways around it?


Yup

QUOTE(GhanBuriGhan @ Sep 5 2006, 09:54 PM) *

First: yes, you have my blessings and godspeed smile.gif

I'll try to dig up my changelog stuff, couple things people have sent in over the years, and either post it here or send it to Yacoby directly.

Ghan

smile.gif

QUOTE(Galsiah @ Sep 6 2006, 02:38 AM) *


<SNIP>


Wow, thanks smile.gif


QUOTE(Kateri @ Sep 6 2006, 10:45 AM) *

And I'm interested to know the circumstances in which activate works on loaddoors - I tried it recently, with a GetDistance check to try to make a move from an exterior to an interior feel like an exterior-to-exterior "cellchange", but it wasn't having it.

I think you have to have activated the door (Which would have got caught by the OnActivate) and then you can use activate. I think. I may need to look into it


QUOTE(bjam @ Sep 6 2006, 11:51 AM) *

Hello,

This is a very good news. smile.gif
An useful thread about get/mod/set stat:
http://www.elderscrolls.com/forums/index.p...&hl=modstat
It should probably be added to the new MSFD
Edit: About levelled lists:
http://www.elderscrolls.com/forums/index.p...amp;hl=levelled

Bjam

Thanks for the links

QUOTE

For a long time I've wanted an update on MSFD, so I'm looking forward to this!

I hope I can live up to your expectations

QUOTE(Björn @ Sep 6 2006, 09:41 AM) *

I don't know if this occurs, but couldn't it happen that this script runs twice before another script has run once. That would keep that script from running that frame. that might be an issue, not sure.



QUOTE(Galsiah @ Sep 6 2006, 04:01 PM) *

I can't think of a way to put it right - perhaps there isn't one.

My logic may be totaly flawed on this, but don't you just need to keep Gals_NewFrameCheck below all of your scripts?

So when you start a script (from GCD), you would need to send Gals_NewFrameCheck to the bottom of the script que. I am assuming you could do this by using stopscript and then a startscript shrug.gif
QUOTE(Yacoby @ Sep 5 2006, 06:08 PM) *

Firstly, I have got permission from GhanBuriGhan to do this.

Morrowind Scripting for Dummies 8 is great. It includeds all the scripting functions etc. The one problem with it is that it doesn't include all the quirks that have been descovered since is was written. For example, it doesn't include anything on why you shouldn't use the AddToLevCreature related functions. The problem with ForceGreeting in if-elseif blocks etc.
It also has the odd error in it, e.g. it says that you cannot use activate on loaddoors, infact you can, but you have to use it with OnActivate.

Here is a quick list of things that need adding/changing (Off the top of my head, so it isn't anywhere near complete)
Messagebox - Multiple messageboxs (Including journal updates) in the same frame can cause a CTD
Activate - Works with Loaddoor
SetStat - Why you shouldn't use it
ForceGreeting - If you use it in a If/Esleif/Else block, it will execute the following elseif/else rather than skiping them
AddToLevCreature - How it breaks other mods that use leveled lists
Math - Sort out refrance to Soralis' Math Mod (It doesn't exist on PES)
CellChanged - Doesn't work for scripted teleporting etc
Targeted Scripts - Needs info on using OnActivate with targeted scripts
GetPos, X - When the value is converted to a long, the vaule will change if you have moves on the Y axis aswell (unconfirmed)
GetCurrentTime - V.8 Has no info on it
Doubling - Very old info on doubling needs an update
Startscript - Problem with startscript re-running scripts
Indenting - Add Manausers Morrowind Script Indenter
GetWindSpeed - Info on how to detect interiors acting like exteriors using this

Others
"Actor_ID" -> Equip, "p_restore_health_q" p 36 is wrong potions are not drunken by NPC's when equip ....

As that is just the list I have compiled quickly, I know that some of the other scripters arround here have spotted more problems/bugs/issues.

Basicly, anything that you think needs changing/adding/removing feel free to say.

Many thanks,
~Yacoby

Great idea! I'm eagerly awaiting for version 9!

Some suggestions: I'd love to have included most used/recent math scripts (similar to the TES4 wiki)
and possibly web links to mods using the different techniques described for reference.
I.E., Galsiah's pool mod/MadMax's flying/sailing items for sin/cos calculation examples, and so on...


QUOTE(abot @ Sep 6 2006, 05:09 PM) *

Some suggestions:
I'd love to have included most used/recent math scripts (similar to the TES4 wiki)

I can port some of the TES4 wiki stuff over if I need it/it looks better. The UESP Wiki also has a load of maths scripts.
QUOTE(Yacoby @ Sep 6 2006, 04:25 PM) *
My logic may be totaly flawed on this, but don't you just need to keep Gals_NewFrameCheck below all of your scripts?
So when you start a script (from GCD), you would need to send Gals_NewFrameCheck to the bottom of the script que. I am assuming you could do this by using stopscript and then a startscript shrug.gif
That wouldn't quite work - starting + stopping Gals_NewFrameCheck would send it to the bottom of the queue, but that would put scripts from other mods between my other scripts and Gals_NewFrameCheck.

This would lead to the reverse issue - if one of those in between scripts uses a startscript, my other scripts would run twice before Gals_NewFrameCheck ran at all. Equally, if one of my scripts used a startscript, the ones before it would run twice before Gals_NewFrameCheck had a chance to run.

In any case, to guarantee Gals_NewFrameCheck staying at the end, I'd be forever starting and stopping it - i.e. using the commands which cause the trouble in the first place.

Keeping it at the beginning is more of a reasonable prospect, since that just means starting it early and keeping it running. However, as Björn pointed out, that would end up possibly skipping scripts further down the queue.

It's probably doable to use somthing like this within one mod (though I'll need to be careful to avoid problems, and won't be able to solve the issue completely). I had thought it'd be possible to create a general solution for any mod to access using a global. That's just not going to work.

The best that could be done is to place gamehour checks in scripts where running twice would be a problem, and perhaps set a global called something like NewScriptStarted whenever the checking script (at the beginning of the queue) were run twice. Another mod could then check this variable, and possibly decide not to run certain scripts.

All in all, I guess an attempted centralized solution is more trouble than it's worth: best just to leave it to individual scripts to check gamehour (or GetSecondsPassed).

The main priority is to make clear in MSFD9 what happens when a startscript is used.
QUOTE(Galsiah @ Sep 6 2006, 09:19 PM) *

That wouldn't quite work - starting + stopping Gals_NewFrameCheck would send it to the bottom of the queue, but that would put scripts from other mods between my other scripts and Gals_NewFrameCheck.

I knew my logic flawed somewhere banghead.gif

QUOTE

The main priority is to make clear in MSFD9 what happens when a startscript is used.

932.gif
Good to hear about this. If my brain ever starts working again and I come up with anything to add, I most certainly will. biggrin.gif
Remote communication between Global / Targeted Scripts - Isn't this already covered (around pg 25)

well yes but it is a bit 'lite'

http://www.uesp.net/wiki/Tes3Mod:Scripting...ss_of_Variables ; here has a few tips and

well I just meant making the section more clearer

e.g. if your object starts with a numeric eg an NPC 11NPC01 you need quotes

"11NPC01".RemoteVar <- Good
"11NPC01.Remote" <-BAD

actually naming withOUT numbers is much better wink.gif

Also why bother - well we all know that the Number of Vars / Global Vars has an effect on FPS so this keeps the Var number lower - but if your Global/Tagetted script is not running ... etc etc - I am happy to help ...

Using variables in functions - may be a list of which do and which don't - that is also in but its a bit confusing to nooby's - don't forget we all are farmiliar with scripting - I was hoping for a more "make it clear for dummy's" type approach wink.gif

StopScript Delay
Don't count on stopScript stopping execution immediately. StopScript signals Morrowind not to run the global script again. But it does not stop the current execution of the script.

When calling stopScript from the script being stopped, either make sure that the remaining script is okay to be executed, or use a return statement to force the script to stop executing immediately.

a lot of this whole section could be incorporated :
http://www.uesp.net/wiki/Tes3Mod:Scripting_Pitfalls


QUOTE
If ( CellChanged == 1 ) P54

CellChanged returns 1 for one frame when player changes cells. If the script calling this function is local, this function will trigger when the player enters the cell where the script is active – leaving the cell will not trigger the function, because the script terminates before the cell change registers (Thanks to Klinn for this correction). There seems to be a slight bug: teleporting out of a cell reportedly does not trigger this function (unconfirmed) - think it is now confirmed also teleporting out .


I think this is a bit confusing - IMHE (in my humble experience) I have found in global scripts it does accept a fix (at least it compiles) and well it gets set to 1 when you enter - but I always have problems when you "leave" when I get the time I will play a round with it (this weekend) but if someone already has a definite answer ....


Magic

well here I would explain diferences between 'Abilities' (once set cannot remove) Curses (can be +ve and removable) and spells


Weather p 121 typo

is => ChangeWeather, "West Gash", 4
should be => ChangeWeather, "West Gash Region", 4

more later ....

[EDIT] : IDEAS

1) an Appendix on MWSE .... ???
2) Dave's MWEDIT ???? ....

QUOTE(Yacoby @ Sep 6 2006, 04:25 PM) *

I think you have to have activated the door (Which would have got caught by the OnActivate) and then you can use activate. I think. I may need to look into it


Well, yeah, this was my experience... you can Activate it if you've Activated it! wink.gif (no, I do get your point, and yes, those kinds of scripts work, although I have found them to be a bit odd-behaving at times) ...but am I right in thinking that there's no way to teleport the player via "Activating" a loaddoor via script, when the player has not clicked on the door?

K.
QUOTE(exclusiveor77 @ Sep 7 2006, 07:23 AM) *


a lot of this whole section could be incorporated :
http://www.uesp.net/wiki/Tes3Mod:Scripting_Pitfalls

Yup, most of it now is

QUOTE

I think this is a bit confusing - IMHE (in my humble experience) I have found in global scripts it does accept a fix (at least it compiles) and well it gets set to 1 when you enter - but I always have problems when you "leave" when I get the time I will play a round with it (this weekend) but if someone already has a definite answer ....
Magic


CellChange returns 1 when you change cells
it will not return 1 in any of these cases: Magic Teleporting, Scripted Teleporting

It returns one in the cell that the player has just entered. (So after the "loading area" bar)

QUOTE(Kateri @ Sep 7 2006, 10:02 AM) *

Well, yeah, this was my experience... you can Activate it if you've Activated it! wink.gif (no, I do get your point, and yes, those kinds of scripts work, although I have found them to be a bit odd-behaving at times) ...but am I right in thinking that there's no way to teleport the player via "Activating" a loaddoor via script, when the player has not clicked on the door?

K.

Ok, this was just from a quick test

if you have a script on a door
CODE

begin DoorScript

if ( OnActivate )
     Activate
endif

end


When the door has been opened by the player, you can activate it whenever you want

You can also activate a door like this:

CODE
begin Door_Script
    
     float timer
    
    
     if ( OnActivate )
         set timer to 1
     endif
    
     if ( timer >= 1 )
         set timer to ( Timer + Getsecondspassed )
         if ( timer > 5 );4 secs
             activate
             set timer to 0
         endif
     endif
    
end


You cannot activate a door like this
CODE
begin Door_Script
    
     if ( GetDistance, Player < 256 )
         activate
     endif
    
end
QUOTE(Yacoby @ Sep 7 2006, 07:26 AM) *


if you have a script on a door
CODE

begin DoorScript

if ( OnActivate )
     Activate
endif

end


...snip...


This reminds me quite a bit of the problem with activating a container remotely. I find that the container requires the "if (onActivate) Activate" sillyness, just like the door, and it only works *after* the container has been activated normally. After a reload, the container needs to be reactivated normally again for the script to continue working. Very annoying and perplexing.

Probably worth mentioning.

Has anyone else had trouble with detecting the sRestoreFatigue effect? I find that it just doesn't work, but the other effects are detected just fine. I don't recall seeing anyting on this in MSFD 8. Maybe I just missed it.

QUOTE(Yacoby @ Sep 7 2006, 12:26 PM) *


You cannot activate a door like this
CODE
begin Door_Script
    
     if ( GetDistance, Player < 256 )
         activate
     endif
    
end



As I thought. Dang. Thought someone might have found a way. Thanks for the info! smile.gif

K.
I know i've run accross stuff thats not in MSFD but I can't think of any of it right now, I'll probably remember long after all this is done LOL.
Here's what I can think of right now:

CharGenState bug
This bug is probably completely unknown except for me. Whenever a command such as EnableStatsMenu or EnableInventoryMenu is used while CharGenState is other than -1, you will never be able to turn off the menus again with CharGenState. The EnableInventoryMenu command only seems to have this effect in the CharGen process, while EnableStatsMenu has this effect all the time. If the menus were supposed to be turned off in a mod, it won't work. You still can't save or use quick keys. But what really is annoying about this is that this applies for the whole game session! You actually need to exit the game and restart it. And there's no way for a mod to check if this has happened, so you can never rely on that menus will be turned off. I think this is worth mentioning in the CharGenState section, and maybe alternative ways to disable menu access using MenuTest and ToggleMenus.

GetWeaponDrawn
This may or may not be useful information, but I noticed a thing with this function. When a weapon (or lockpick/probe) is broken (or removed with script?(not tested)), you will "equip" hand to hand like we all know. However GetWeaponDrawn will return 0 a few frames inbetween. That could mess things up (it did in my Advanced Lockpicking mod yesterday 'til I figured this out). But maybe it could be useful too, to figure out when something has been used up. Or in combination with DisablePlayerFighting it might be a way to bring down your hands for some reason.

Like everybody else: I'll come up with more.
QUOTE(exclusiveor77 @ Sep 5 2006, 05:10 PM) *

Get/Mod/SetSwimSpeed p 113 broken ....

I gave this some testing, and it seems to work fine.

Did you use player as the infix?
CODE

player->setswimspeed 100


@Bjorn
Thanks smile.gif
I'm pretty sure Get/Set Chameleon doesn't work, but maybe I'm wrong.
QUOTE(Yacoby @ Sep 10 2006, 04:13 PM) *

I gave this some testing, and it seems to work fine.

Did you use player as the infix?
CODE

player->setswimspeed 100


@Bjorn
Thanks smile.gif



Dumstruck - I have a whole thread here and I never got it working plse post script so I can fix mine too

player->setswimspeed 100 - no I went swimming and had a partner was useing Player->GetSwimspeed == 1
messagebox " blah blah"

and an activator

hang on I'll find the thread => 2 Questions : Swimming & Script limit


so plse plse give me yr test script 'cos I still need it - the getsoundplaying is so long winded
QUOTE(Danjb @ Sep 10 2006, 03:42 PM) *

I'm pretty sure Get/Set Chameleon doesn't work, but maybe I'm wrong.

It works, you just don't get anything graphically

QUOTE(exclusiveor77 @ Sep 10 2006, 04:06 PM) *

Dumstruck - I have a whole thread here and I never got it working plse post script so I can fix mine too

player->setswimspeed 100 - no I went swimming and had a partner was useing Player->GetSwimspeed == 1
messagebox " blah blah"

and an activator

hang on I'll find the thread => 2 Questions : Swimming & Script limit
so plse plse give me yr test script 'cos I still need it - the getsoundplaying is so long winded

You can't do what you want with GetSwimSpeed. It seems to be a mult for setting the swimming speed of a (N)PC

So if you
CODE

player->setswimspeed 1000

The player would swim very very fast
QUOTE(exclusiveor77 @ Sep 10 2006, 05:06 PM) *

Dumstruck - I have a whole thread here and I never got it working plse post script so I can fix mine too

player->setswimspeed 100 - no I went swimming and had a partner was useing Player->GetSwimspeed == 1
messagebox " blah blah"

and an activator

hang on I'll find the thread => 2 Questions : Swimming & Script limit
so plse plse give me yr test script 'cos I still need it - the getsoundplaying is so long winded

You can't use GetSwimSpeed to detect swimming. Abot had a script to detect it, but I can't find it now. I think it should be in his waterlife mod, but you could PM him if you want it. Yacoby had another method to detect swimming which is in his swimming realism mod. You could try that too, i don't know which is the most reliable, but since I know pretty much how Yacoby's works (it uses my method of detecting th player's height), I think it should be completely reliable.
Oh OK set SwimSpeed works but not GetSwimSpeed ... shoot

@Björn - thanks - I'll try those - At the moment Im using sound (from Theotherfelix) it works but it windy - it detects the sound of walter walking as you walk in and then some other stuff ...

wink.gif
QUOTE
It works, you just don't get anything graphically


Interesting ... That explains a lot biggrin.gif
Could be useful to me then ...

Maybe could write something about this in v9?

How exactly does it work then? Say you set Chameleon 100, would NPCs not be able to see you, despite the fact that you don't actually look transparent?
QUOTE(Björn @ Sep 10 2006, 04:58 PM) *

You can't use GetSwimSpeed to detect swimming. Abot had a script to detect it, but I can't find it now. I think it should be in his waterlife mod, but you could PM him if you want it. Yacoby had another method to detect swimming which is in his swimming realism mod. You could try that too, i don't know which is the most reliable, but since I know pretty much how Yacoby's works (it uses my method of detecting the player's height), I think it should be completely reliable.

My version is based on abots, but it uses your Height checking script to make it more accurate. I think all swimming detection scripts are fairly similar, and follow the same basic format.

Which reminds me of some stuff to add in about water level. smile.gif

QUOTE


How exactly does it work then? Say you set Chameleon 100, would NPCs not be able to see you, despite the fact that you don't actually look transparent?

Yup, You don't look transparent, but when you greet them, all they say is "Who's there?" etc

QUOTE

Maybe could write something about this in v9?

932.gif
QUOTE(Yacoby @ Sep 10 2006, 06:18 PM) *

My version is based on abots, but it uses your Height checking script to make it more accurate. I think all swimming detection scripts are fairly similar, and follow the same basic format.

Which reminds me of some stuff to add in about water level. smile.gif
Yup, You don't look transparent, but when you greet them, all they say is "Who's there?" etc
932.gif


Im using

CODE
    If ( watercell == 0 )                ; check for swimming
        If ( GetSoundPlaying "FootWaterLeft" == 1 )
            Set watercell To 1
        ElseIf ( GetSoundPlaying "FootWaterRight" == 1 )
            Set watercell To 1
        ElseIf ( GetSoundPlaying "DefaultLandWater" == 1 )
            Set watercell To 1
        EndIf
    EndIf

==== SNIP ===
            set surfaceheight To ( GetWaterLevel - 113.7094 )
            If ElseIf ( watercell == 1 )
            Set ( myz <= surfaceheight )
                Set minsubheight To ( surfaceheight - 25.1806 )
                Set surfaceheight To ( surfaceheight - 5 )
                If ( pcz <= minsubheight )
                    Set matchpcz To 1
                ElseIf ( myz <= surfaceheight )
                    Set matchpcz To 1
                EndIf
            EndIf
        EndIf




thanks to Grumpy + TheOtherFelix

but for swimming
well I just tried ActivateAI

CODE
AddItem "potion_local_liquor_01" 1
set timer to 4
AiActivate "potion_local_liquor_01"


no success

CODE
AddItem "p_restore_health_q" 1
set timer to 4
AiActivate "p_restore_health_q"


either ...P68 S4Dv8 ....*sad* someonelse wanna try ?
Hello,
QUOTE(exclusiveor77 @ Sep 12 2006, 03:09 PM) *

well I just tried ActivateAI

CODE
AddItem "potion_local_liquor_01" 1
set timer to 4
AiActivate "potion_local_liquor_01"


no success

CODE
AddItem "p_restore_health_q" 1
set timer to 4
AiActivate "p_restore_health_q"


either ...P68 S4Dv8 ....*sad* someonelse wanna try ?

Have you try to use AIActivate with a potion just in front of the NPC instead of putting it in his inventory?

Bjam
QUOTE(bjam @ Sep 12 2006, 07:49 PM) *

Hello,

Have you try to use AIActivate with a potion just in front of the NPC instead of putting it in his inventory?

Bjam



ok - will try that wink.gif
Nesting While loops definitely works (at least for simple ones).
Please ignore my earlier lies.
Updating a local variable from dialog or another script using set “ObjectID”.localVariable to x will not work if the cell containing the target object/(script) has not previously loaded.
how's this coming along
I've got some notes on AI, pathgridding and positioncell functions, as well as a good way of explaining how to make a pseudo-load door.. maybe that can be put in.
QUOTE(exclusiveor77 @ Sep 15 2006, 08:16 PM) *

Thanks smile.gif


QUOTE(exclusiveor77 @ Sep 24 2006, 09:16 PM) *

how's this coming along

It is at present going very slowly, as I have got board of the Morrowind Scripting Engine (Don't worry, this has happend before), so I am at present learing PHP, XHTML and CSS. I should be back going with Morrowind stuff in a week or so.

QUOTE(Casey Tucker @ Sep 24 2006, 11:39 PM) *

I've got some notes on AI, pathgridding and positioncell functions, as well as a good way of explaining how to make a pseudo-load door.. maybe that can be put in.

Yup, sounds good
Some Notes: (Don't know if I should post them here.. I will organize all this later, anyways, for a more.. short and user friendly way. Also, most people probably know this stuff.. but for a newbie wanting to have an NPC use a door or some pathgridding, this might come of use)

QUOTE
These are a few notes on Morrowind's AI system, as much for myself as for anyone wishing to look them over. The most I noticed the AI is incredibly stubborn. There are quite a few unpredictable script functions that deal with AI. I find that the AIFollow is actually the most stable of them.
When working on "The Triumvirate" quest/war mod, if the player went to Dragonhold Castle to join the Legion, I had to have the player's Imperial Centurion, (A centurion was the leader of a Roman "century," a unit of around 80 to 100 men in a legion) Sensius Tanarii, show the player where his barracks room is.
Initially I had Sensius follow the player until you wandered around long enough to find your barracks room. Sensius would confirm the location and disappear, once Proximus Taiatius, (your legionary roommate) noticed you. (GetTarget Player == 1 Usually works - For the desired effect, GetDistance is more accurate.)
So, that was sort of the opposite of I wanted. I wanted Sensius to take the player to their room. When I first actually thought of this, I tried thinking of several ways to get an NPC to "AiEscort" through several cells to the given coordinates. Let me tell you of my findings on AIEscort. It's either broken, works only in exterior cells, or I was doing something wrong. Regardless, I noticed that the NPC did not budge at all from their location, though they WERE set to guard the player. Upon further research, I saw that during the CharGen process, when the prison ship guard appears to be escorting you to the door, Bethesda actually used AIWander, making checks to see if the player was following or not.
From this I drew the conclusion that AITravel would be so much more convinient and stable. I only use AIEscort to get a stationary actor to guard the player if they came under attack. Useful for battle scenes when you want it to appear that two forces are fighting eachother, without having an entire side follow the player. About mass battles... I will lead into that later.
First, I must explain how to get an NPC to escort a player, from point A: an interior cell, through several interior and exterior cells, to point B: also an interior cell. First things first.. we don't want the NPC to get stuck. You'll need some pathgrids. A few notes about pathgrids: the NPC doesn't seem to care about the gridpoints' Z coordinate. That's a very good thing. Pathgrids are like magnetic roads. The NPC is seemingly "magnetically attracted" to that pathgrid, and their AIWandering, AITraveling, and AIFollowing will follow along those grids. To see how these grids work, go in-game, to Ebonheart or another semi-crowded city, and type in the console: 'TPG'. That will show the pathgrids - you'll see the NPC's walking between the two yellow "rails" that are drawn out, as if they were trains. An NPC will reluctantly pull away from a pathgrid if led so by the player, need to walk around something blocking their way, chasing someone/thing, and such scenarios.
Now that I got pathgridding done, I noticed another thing. AITravel is not "unstable" per se, but not very reliable. Two factors come into play here, that dictate if the NPC will blatantly ignore it's orders or do as told. The first, I noticed, was the AI distance setting, changable by FPS optimizer or in-game menu. Makes sense. However, the next one is rather annoying. The NPC cannot get distracted or their travel will stop. This means you'll have to set their "Hello" distance to 0 during their little stroll, otherwise they will stop and greet the player instead.
Now we come to the point where the NPC reaches a load door through cells. The game will CTD if the NPC activates it. Here is a snippet of an "escort" script I wrote, that gets the NPC through a load door.
-------------------------------------------------------------------------------------
Begin Sensius_Escort_Script
Short EscortOnce
Float Timer
;In my theory, a load door is simply a PositionCell function referencing to the PlayerSaveGame once the door is
;activated. (By the player.) For an NPC to activate a load door would, as this "door script" seems hard-coded
;strictly to the player, would call an error that would cause a CTD. This script creates an artificial load door, by
;replacing the "Player" function references to the NPC in question. As this is concerning a REAL load door, I cannot
;have the NPC activate it. Rather, the NPC teleports when they are close enough to the door for activation, and
;a certain variable is set, accompanied by a 3D sound to finalize the effect. NPC load doors are possible. The only
;problem is that the NPC disappears rather than shows an animation of entering the door - but it's not much worse
;than in Oblivion, when the NPC just fades.

If ( MenuMode == 1 )
Return
Endif

If ( EscortOnce == 0 )
"Sensius Tanarii"->AiTravel 4990.000 5200.000 15456.000
Set EscortOnce to 1
Endif

If ( EscortOnce == 1 )
If ( "Sensius Tanarii"->GetPos, X <= 5060 ) ;I am "boxing in" the coordinates. When he stands in this area, the door is activated.
If ( "Sensius Tanarii"->GetPos, X >= 4930 )
If ( "Sensius Tanarii"->GetPos, Y <= 5360 )
If ( "Sensius Tanarii"->GetPos, Y >= 5177 )
"Sensius Tanarii"->PlaySound3D "Door Latched Two Open" ;
"Sensius Tanarii"->PositionCell 3186 5191 15050 0 "Dragonhold Keep - Main Entry Hall"
Set EscortOnce to 2
Endif
Endif
Endif
Endif
Endif
.............................................
-------------------------------------------------------------------------------------

That should explain how it would work. Coordinates are often more reliable than a "GetAIPackageDone" function, mainly because that function is easily broken by several factors.

I'll be sure to read it wink.gif How's it going?
i found a werid bug in the editor today so i though i'd share it here so it can be noted.(it might have already been addressed, i did a quick look in the MWSFD but didn't see it)

your scripts' name should never go over 31 charaters in length. it , if you have 32 charaters in the script namethere will be a box on the end of the script and when there is 33 charaters the 33rd charater goes funny, the 34th charater seemed to be fine. i'll get screenies if you need it. but anyway it seems to have to do something 33rd charater if the 33rd charater you use is an 'a' the editor will use a c
for example i had for mt script

begin tac_dam_soulgemremove_creaturepack

but the editor saw it as tac_dam_soulgemremove_creaturepaek

it tried

tac_dam_soulgemremove_creaturepak

but the editor saw it as

tac_dam_soulgemremove_creaturepam

so yeah werid bug
One more minor thing about msfd8, the function FALL, is on page 74, but it's not listed in the index.
Which brings up my next idea, a HTML format version would be nice, with links from the table of contents and index to the page/s refered to, and links to apendix's refered to throughout the document, would be alot of work to impliment, but handy. I have recently found that in acrobat you can type the page number in at the bottom, no more scrolling for me. blush.gif

I've also noticed the function, RemoveSpellEffects, is not documanted in there. I must have read that in a forum somewhere or just made it up, but it compiles and works,
I'm not sure if it's vanilla, or an expansion or patch, but works with GOTY.

especially handy for scripted spell effects.

CODE
if ( player->getspelleffects, "Uber Spell" == 1
;trigger scripted uber spell effect
  player->removespelleffects, "uber spell"
endif


I'll post more nitpicks as they come to me.
QUOTE(Trey Leavens @ Oct 20 2006, 04:26 PM) *

One more minor thing about msfd8, the function FALL, is on page 74, but it's not listed in the index.
Which brings up my next idea, a HTML format version would be nice, with links from the table of contents and index to the page/s refered to, and links to apendix's refered to throughout the document, would be alot of work to impliment, but handy. I have recently found that in acrobat you can type the page number in at the bottom, no more scrolling for me. blush.gif

I've also noticed the function, RemoveSpellEffects, is not documanted in there. I must have read that in a forum somewhere or just made it up, but it compiles and works,
I'm not sure if it's vanilla, or an expansion or patch, but works with GOTY.

especially handy for scripted spell effects.

CODE
if ( player->getspelleffects, "Uber Spell" == 1
;trigger scripted uber spell effect
  player->removespelleffects, "uber spell"
endif


I'll post more nitpicks as they come to me.


I never noticed that before ...

there is a RemoveEffects [p112] ....

HTML - see my sig Script Cmds ...
Thanks for the notes, Casey.

I plan to do a lot more complex scheduling in future mods, and your approach was exactly how I planned to do it - so by showing me that it works you have saved a lot of time and headaches smile.gif

One thing for the update:

MSFD mentions cutscenes theoretically but doesn't give any practical advice. To the best of my knowledge, no mod has ever included a working cutscene - those that appear to be are usually scripted events. Please could you either make it clear that cutscenes are actually impossible, or give an example/instructions on how to create .bik files with FRAPS?

Ditto sound files - the game is "picky" about the format of .wav files for voices - the details of frequency etc would be handy for those trying to include new voiced dialogue.

Finally, including further details about scripted real-time travel would be helpful. For example, when I was making the silt strider ride, I didn't know about the need to disable/delete/recreate the ride as you cross cells - otherwise you just slam into an invisible wall! The way I got around it was simply to move the ride so it was all within a single cell, but anyone wanting to create a cross-Morrowind silt strider system would have to know about that little eccentricity.
QUOTE(Raveren @ Oct 12 2006, 11:09 PM) *

I'll be sure to read it wink.gif How's it going?

Uh. I have got abit distracted, but I am still managing to do bits here and there.

QUOTE(exclusiveor77 @ Oct 13 2006, 07:14 AM) *

Thanks smile.gif


QUOTE(TunaandCheese @ Oct 20 2006, 01:50 PM) *

i found a werid bug in the editor today so i though i'd share it here so it can be noted.(it might have already been addressed, i did a quick look in the MWSFD but didn't see it)

your scripts' name should never go over 31 charaters in length. it , if you have 32 charaters in the script namethere will be a box on the end of the script and when there is 33 charaters the 33rd charater goes funny, the 34th charater seemed to be fine. i'll get screenies if you need it. but anyway it seems to have to do something 33rd charater if the 33rd charater you use is an 'a' the editor will use a c
for example i had for mt script

begin tac_dam_soulgemremove_creaturepack

but the editor saw it as tac_dam_soulgemremove_creaturepaek

it tried

tac_dam_soulgemremove_creaturepak

but the editor saw it as

tac_dam_soulgemremove_creaturepam

so yeah werid bug

The length (32 chars) would make sense. Thanks


QUOTE(Trey Leavens @ Oct 20 2006, 03:26 PM) *

One more minor thing about msfd8, the function FALL, is on page 74, but it's not listed in the index.

I will add that in

QUOTE

I've also noticed the function, RemoveSpellEffects, is not documanted in there. I must have read that in a forum somewhere or just made it up, but it compiles and works,
I'm not sure if it's vanilla, or an expansion or patch, but works with GOTY.

Intresting. I think I have also used it in mods, but never noticeted that it wasn't in MWSFD

QUOTE

I'll post more nitpicks as they come to me.

fing34.gif


QUOTE(exclusiveor77 @ Oct 20 2006, 08:23 PM) *

I never noticed that before ...

there is a RemoveEffects [p112] ....



QUOTE(princess_stomper @ Oct 20 2006, 11:07 PM) *

One thing for the update:

MSFD mentions cutscenes theoretically but doesn't give any practical advice. To the best of my knowledge, no mod has ever included a working cutscene - those that appear to be are usually scripted events. Please could you either make it clear that cutscenes are actually impossible, or give an example/instructions on how to create .bik files with FRAPS?

I heard the Goblin Lab may have a cut scene(s?). I will try and make one.

QUOTE

Ditto sound files - the game is "picky" about the format of .wav files for voices - the details of frequency etc would be handy for those trying to include new voiced dialogue.

IIRC MWFSD already has some sound info. Does the format for voices differ from this at all?

QUOTE

Finally, including further details about scripted real-time travel would be helpful. For example, when I was making the silt strider ride, I didn't know about the need to disable/delete/recreate the ride as you cross cells - otherwise you just slam into an invisible wall! The way I got around it was simply to move the ride so it was all within a single cell, but anyone wanting to create a cross-Morrowind silt strider system would have to know about that little eccentricity.

smile.gif


More stuff tomorow on HTML formats and every other point I have missed when I am more awake.
Bik Videos
I sucsesfully converted a uncompressed avi (though it can convert other formats) to a bik (using Rad Video Tools) and replaced the Morrowind logo with the said avi. As that is the same bik player that is used when playing cutscences, I don't see how playing cutscenes would present any problem.

Also, The Goblin Lab includes two valid bik files, so I assume that mod uses them as cut scenes

Sound
@princess_stomper
This information is already included in MWSFD
QUOTE(MWSFD8)

Sound file formats
Note: Not all sound files seem to play correctly in the game (although all play in the editor). To be safe, use the formats used by Bethesda (thanks to random name) :

"Cr" and the "Fx" folder
Windows PCM (.wav)
22050 kHz, 16-bit, Mono

Lower qualities work as well, e.g. 8,000 kHz; 8 Bit; Mono. Used e.g. in my "The Regulars" mod for Tavern music.

"Vo" folder format
MPEG Layer-3, 64 Kbps
44100 kHz, 16-bit, Mono


HTML
I will see if I can make a html version when I have finished the .doc version smile.gif
Still working on this? I might be able to get a lot of good dialogue stuff for you all too, if that counts as "scripting."

If this wasn't already covered, I might offer: For a "sneak around the guards" quest, the best approach is use AI travel or wander for the guards, with high "hello" stats. The "GetTarget" function will return 1 even out of combat. The function is not entirely reliable; it goes off about 80% of the time. (I don't know how true this is in combat.) Thus, there is a slight chance you can get off lucky if the guard "sees" you. Perhaps he/she is distracted? I just figured people might use GetLOS or something, but anyways...

I have some more little tidbits of information I might dig up.
/nudge

Heya Yacoby, you still working on this? I'm waiting eagerly to get my hands on it... *prays you are*. Can't contribute much but my praise so I'm a worthless n'wah but I hope you didn't abandon this.

Then again, life gets in the way of everything... so it wouldn't surprise me. wink.gif

Hey Yacoby ... much saught after smile.gif
This isn't going anywhere near as fast as I was hoping. I keep getting distracted sad.gif. I would finish it, but how long it would take is anyone's guess.

Anyway. Instead of one person doing it, it gets passed around, a bit like some of the mods that are being worked on. Like the chain letter mod. That way, if someone wants to write in one thing, they can, or if they want to add in 20 pages they can. It would probably get done a lot faster. We would need to keep a change log though.

Anyone interested?
Not sure if you'd like to include this, but I just discovered a nifty little tidbit.

If you make a curse that is set for anything other than cast on self (not possible with the CS or MWEdit, I used MWE to do it ingame) and use AddSpell to give it to the Player, it will be automatically cast as a normal targeted spell. Quite useful IMHO.

I'm currently looking through all of the editing utilities I can find to see if there any that will let you make a curse on target.
QUOTE(Yacoby @ Dec 24 2006, 09:42 PM) *

This isn't going anywhere near as fast as I was hoping. I keep getting distracted sad.gif. I would finish it, but how long it would take is anyone's guess.

Anyway. Instead of one person doing it, it gets passed around, a bit like some of the mods that are being worked on. Like the chain letter mod. That way, if someone wants to write in one thing, they can, or if they want to add in 20 pages they can. It would probably get done a lot faster. We would need to keep a change log though.

Anyone interested?


Been offline for 4 months - back now Id be willing to 'oil the wheels' a bit I don't have constant time but get a few days inbetween projects smile.gif

I would hate to see this fade smile.gif
QUOTE(Yacoby @ Dec 25 2006, 04:42 AM) *
This isn't going anywhere near as fast as I was hoping. I keep getting distracted sad.gif. I would finish it, but how long it would take is anyone's guess.

Anyway. Instead of one person doing it, it gets passed around, a bit like some of the mods that are being worked on. Like the chain letter mod. That way, if someone wants to write in one thing, they can, or if they want to add in 20 pages they can. It would probably get done a lot faster. We would need to keep a change log though.

Anyone interested?


Putting this on a restricted Wiki would probably be an ideal way of doing it - you can see who has done what, what has changed, etc. etc.

Now, if someone would update the Morrowind Mod Maker's Manual (eg. separate all the Tribunal/Bloodmoon specifics, fix the spelling errors, turn it into a PDF) I would be really happy... smile.gif
Bumpy - Yacoby is this over ?

smile.gif

Even if the project is dead, the thread is still very useful (I wish I'd seen it before!).

Couple of things I've noticed (mostly stuff people already know, but could be useful to new modders)...

QUOTE
Player -> PositionCell -21278, -17613, 534, 0, "Balmora (-3, -3)"

This doesn't always work (though I know it does sometimes). Replacing it with:
Player -> PositionCell -21278, -17613, 534, 0, "Balmora"
did work.

-

GetPCFacRep causes errors and/or CTD when used.

-

Under "ForceGreeting":
QUOTE
It does not matter where the NPC is, this function will always work

should add the qualifier "as long as 'Corpses Persist' is checked, or the player has encountered the NPC in the last 72 game hours".

-

Under dialogue "choice":
QUOTE
Not meant for scripts as far as I know.

Actually works fine in scripts if the dialogue window is open.

-

Under "SetJournalIndex":
1) None of the info in SfD really came from me! Actually, it came from the version of SfD that was current at the time. I just posted a quote. blush.gif
2) It's not clear in SfD, but using SetJournalIndex to set the index backwards does last through a save/reload IF the given index does exist.
3) SetJournalIndex doesn't generally work properly to finish quests (the entry is given correctly, but the quest is not removed from the active quests list). It can be used to restart quests though.

-

Under "GetJournalIndex":
QUOTE
This function returns the index of the highest (or the last?) journal entry for that journal topic that the player has received.

Definitely the last - or the last valid index, if using SetJournalIndex through a save/reload.

-

And in case of further misunderstandings: I did not discover most of the above myself (certainly not the info on ForceGreeting, GetJournalIndex or choice, and I'd be very surprised if I was first on any of the others either).

-

And something not everyone might know about GetBlightDisease (there's slightly more in depth info on Emma's forum, for anyone interested)...

When the player goes to Red Mountain Region, blight disease spells are added but the effects are not. Cures won't work if the effects don't show up, and dialogue PC Blight Disease check returns false, and as far as the player knows, there isn't any blight disease. But... GetBlightDisease will return 1, and GetSpell will return 1 for the spells the player actually has.

To accurately check for blight diseases on the player, you need to use dialogue or GetSpellEffects for individual diseases. To allow the player to continue to be equally vulnerable to blight diseases after going to Red Mtn Region, you need to use GetSpell, GetSpellEffects and RemoveSpell (otherwise the player is immune to those diseases with spells not showing effects).

I'm pretty sure "ash woe blight" is always the last spell added (takes ages to turn up), but the others are all added so quickly I haven't been able to find out whether there's any particular order for them. I don't think there's a certain time taken, or a area within the region involved: it seems somewhat random, but quite fast.

None of this applies to NPCs, only the player.

EDIT: More information here. Turns out it's an ini setting for blight weather (which only happens in Red Mtn Region).
Any hopes of someone figuring out how to get the UsedOnMe function to work? I think that would be a very handy thing for puzzles so that you would have to use a specific item on an object to open a door or what have you. It says in the last SFD that it is a broken function so I've never actually bothered testing it.
QUOTE(nikki @ Mar 31 2007, 10:34 PM) *
Any hopes of someone figuring out how to get the UsedOnMe function to work? I think that would be a very handy thing for puzzles so that you would have to use a specific item on an object to open a door or what have you. It says in the last SFD that it is a broken function so I've never actually bothered testing it.
Nope, IIRC it was never implemented, there is not even the usedonme string inside the game command table.
QUOTE(abot @ Mar 31 2007, 06:13 PM) *
Nope, IIRC it was never implemented, there is not even the usedonme string inside the game command table.



Thats too bad. I could imagine adding some adventure game style puzzles to mods with that function.
If your updating MSFD, you should have a look at this thread and merge some of the info with reference to getBlightDisease
yes a new release would be nice its been a while since i've done scripting, and i'm trying to re-teach myself with version 8. banghead.gif been having some problems myself with (i believe) the removeitem command in an if or while block. for more info on this: http://www.bethsoft.com/bgsforums/index.php?showtopic=668607
A Gamesetting:

fPickPocketMod (0.3) = Multiplier to item's weigth vs player's security

As far as I've tested it, chances are as follows:

Enter/Leave inventory:
Player.Sneak > d100 + Victim.Sneak

Take items:
Player.Security > d100 + fPickPocketMod * item Weight

In the moment you successfully take an item, the inventory is reloaded (this is why sometimes items vanish or appear) and you have to make another Enter/Leave inventory check, so effectively both checks are made when taking items.

When the victim can't detect you (sneaking, invisibility or chameleon) you always succeed in entering the inventory, though only chameleon will also help you in taking items and leaving the inventory.
I think Yacoby has 'script burn out' perhaps we can use this thread as a catch all ?? smile.gif
Sounds like a plan. Of course, the UESPWiki is also a valuable resource that we should make more use of smile.gif

I didn't realise about the messagebox thing - might be a clue to a CTD problem I'm having smile.gif
Just a friendly little bump to get this back to page 1. This is too useful to let it go.

@Yacoby, and chance of finishing this? Please?
2nded smile.gif action-smiley-030.gif
Couple more things I don't think I've seen written down anywhere...

If you give an NPC a bow but no arrows, and no other weapons, then put it in combat (so it uses hand-to-hand):

HasItemEquipped will return 1 for the bow.
GetWeaponType 9 (bow) returns true as well.

I've never found a way to detect whether the NPC is actually using the bow or hand-to-hand. If anyone knows of one, maybe you could share it here? smile.gif
Note before I foget
When a target script is started on a NPC (possibly creature??) that are placed in game with a script (possibly leveled list??) and the game is saved and reloaded, the script will become unattached.

If you then call anything that required minipulating the NPCs data, for example gethealth, or sethealth, it will case an instant CTD, with no errors.


;---------------------------------------------

Sorry about the lack of input in this.

I think the best way to procide with this is to do the followind:
Upload the current V9 to a site. For now I will use ES Upload, as I don't have a FTP program to get at my server.
Create a "To Do" list with all the things that need writing up.
If someone wants to write a section, they write it seperatly, and send it to, or/and post it here for me/someone to include. I will then update the main V9. This is so we don't have multiple copies wandering arround and hell when we come to combine it.

If anyone can think of a better idea do say.



What I have done so far is here: Sorry it is a PDF, I don't have anything that I am sure can save MS Word docs correctly at this point.
http://www.yacoby.net/es/upload/?action=download&id=31


Suggestions are very welcome. If anyone wants to take over the editing of this, you are welcome to,
QUOTE(Yacoby @ May 12 2007, 12:24 AM) *
Note before I foget
When a target script is started on a NPC (possibly creature??) that are placed in game with a script (possibly leveled list??) and the game is saved and reloaded, the script will become unattached.

If you then call anything that required minipulating the NPCs data, for example gethealth, or sethealth, it will case an instant CTD, with no errors.

GetHealth is fine (I just double-checked to make sure: You had me worried there!). I've been using GetHealth as a fix for that:

CODE
if ( GetHealth <= 0 )
    StopScript ScriptName
    return
endif


at the top (I just tried it on the dialog placeholder, using placeatpc and a companion weapon sheathing script - the script just stopped, no problems).

EDIT: I don't know exactly which functions cause CTD in untargeted scripts - I just saw the GetHealth fix in Constance's levelling script and started using it. I'm sure I've seen it used elsewhere, but I can't remember where... If I find/remember more information I'll post it.
;---------------------------------------------

QUOTE(Yacoby @ May 12 2007, 12:24 AM) *
Sorry about the lack of input in this.

No worries. smile.gif

QUOTE(Yacoby @ May 12 2007, 12:24 AM) *
I think the best way to procide with this is to do the followind:
Upload the current V9 to a site. For now I will use ES Upload, as I don't have a FTP program to get at my server.
Create a "To Do" list with all the things that need writing up.
If someone wants to write a section, they write it seperatly, and send it to, or/and post it here for me/someone to include. I will then update the main V9. This is so we don't have multiple copies wandering arround and hell when we come to combine it.

Sounds good to me, but I daresay my opinion doesn't count for much. tongue.gif

QUOTE(Yacoby @ May 12 2007, 12:24 AM) *
What I have done so far is here: Sorry it is a PDF, I don't have anything that I am sure can save MS Word docs correctly at this point.

Can you save in RTF? That would work with MS Word.

QUOTE(Yacoby @ May 12 2007, 12:24 AM) *
Suggestions are very welcome. If anyone wants to take over the editing of this, you are welcome to,

Well, I'm no scripting genius and I have zero experience in writing documentation, but I can type. I might be of some use, if no-one better wants to do it. unsure.gif
QUOTE(melian @ May 11 2007, 03:23 PM) *
GetHealth is fine (I just double-checked to make sure: You had me worried there!). I've been using GetHealth as a fix for that:

CODE
if ( GetHealth <= 0 )
    StopScript ScriptName
    return
endif


at the top (I just tried it on the dialog placeholder, using placeatpc and a companion weapon sheathing script - the script just stopped, no problems).

:shurg:
I was having a problem with getHealthGetRatio whenn started on a Companion that I had placed via the console.

This fact, with the fact that DinumThinkum(sp?) siad that he found that scripts got detached from the player on load, I assumed that that was the problem.

However, this may need more looking into shrug.gif

QUOTE
Can you save in RTF? That would work with MS Word.

Yeah, I may even be able to save it as .doc... I will have a closer look.
How about doing a wiki format, at UESP, or some such?
Digging through my archives, smile.gif here's some info from an 'SFD 8 Addenda' thread I started a few years ago...

Note: I no longer have MW installed on my computer and haven't played the game or used the CS for a long time. I think this info is still good, but don't have any way of double-checking it. sad.gif

----------------------------------------------------------------------------

According to SFD, the 'Equip' statement by itself will add an item to inventory and equip it, without needing a separate 'AddItem' statement. However, for the player character, it appears that this will only work _after_ at least one 'AddItem' has been used.

----------------------------------------------------------------------------

According to a post on the Bethesda forums, on the PC version an overflow loot bag will be created if there are more than 1024 objects in a single cell. I believe the number may be different for interior and exterior cells, but I couldn't find any more specifics in either the old or the new forums.

However, if you try to put a large number of objects into a cell using 'PlaceAtPC', the game will lockup completely. Don't know the minimum number that will cause the crash, but 'PlaceAtPC p_restore_health_e 2000 0 0' will definitely do it. biggrin.gif

(Added today) In other words: the game engine won't create an overflow loot bag for excess items that are added to a cell by a script; instead, it just crashes when the maximum number of items per cell is exceeded. I ran into this with 'PlaceAtPC', but I would guess that any script function that adds items to a cell would have the same problem. I would also guess that the crash occurs as soon as the number of items in the cell reaches the number that would normally trigger the creation of an overflow loot bag.

----------------------------------------------------------------------------

In the 'Operators' section in SFD 8, Ghan talks about limits on the maximum number of variables that can be used in a single 'Set' statement.

Here's what I came up with:

Eleven variables in a single set statement will cause the following error when loading the game, followed by a crash to desktop:

"Need more room for zero pointers in Script::ReplaceGlobalsInData"; as soon as you click the button to acknowledge the error, CTD. (That script name wasn't any script of mine; apparently it's something internal to the game.)

Six variables in a Set statement work fine. Don't know the maximum number, but it's obviously at least six and definitely less than eleven.

----------------------------------------------------------------------------

When you make changes to a script, it's a very good idea to save the script _twice_ afterwards, to make sure the compiler properly checks it for errors.

For example, if you delete a variable declaration but forget to remove the variable from the script, the compiler may not report an error the first time you save the script. This also happens when you change the name of a script (in the 'Begin' statement), but leave the original name in a StopScript statement.

Apparently, the compiler doesn't update its internal list of variables, script names, etc. until _after_ it compiles the script. End result is that the compiler will use the stored variable declarations and script names from its previous pass through the script, rather than the current ones.

This probably explains why you have to save a script at least once before its name (from the 'Begin' statement) will be recognized in a StopScript statement in the same script.

----------------------------------------------------------------------------

If you 'AddItem' to an NPC's inventory when the inventory screen is already open, the display won't be updated with the new items, unless (EDIT) the player manually adds or removes displayed items (which forces the game to refresh the inventory display).

So using just a check for ( MenuMode == 1 ) to move items into an NPC's inventory will cause problems when the NPC is dead or unconscious.

(Added today) For example:

The early versions of my Potion Saver coded used 'If MenuMode == 1' to trigger putting potions back into the companion's inventory. This worked fine when the companion was alive and concious, since the script would add the potions while in the dialogue window, before the companion share inventory window was opened.

However, if the companion was dead or unconscious, clicking on the companion would open the inventory window immediately, and the potions would be added after the window was already open. End result, the potions wouldn't show up in the inventory window.

To avoid the problem, add items to an NPC's inventory as soon as they die, as soon as they fall unconscious, or when the game goes into Menu Mode (check Menu Mode after checking death and uncounciousness). That way, the items will be added before the inventory window opens.

Here's the code I used for this in the Potion Saver:

CODE

If ( GetHealth < 1 )
Set DTNPS_HandlePotions to 0
ElseIf ( GetFatigue < 1 )
Set DTNPS_HandlePotions to 0
ElseIf ( MenuMode == 1 )
Set DTNPS_HandlePotions to 0
Else
Set DTNPS_HandlePotions to 1
EndIf


'Set DTNPS_HandlePotions to 0' tells the next block of code to add potions into the companion's inventory.

----------------------------------------------------------------------------

Enough for now; I'll try to add some more later on after I take a break... smile.gif

...DT wanders off into Never Never Land in search of ?...

Edit: clarified first paragraph in the 'Additem' section.
From SFD 8:

"Note: If you use a Tribunal start script to give out a message box with a button as soon as the game is loaded, you should delay the MessageBox by one frame, otherwise the mouse pointer will not be displayed (Forum info / DinkumThinkum)."

Discovered later on that a one frame delay isn't enough if you have a massive start-up script that runs as soon as the game is loaded. So you might want to delay Message Boxes (that have buttons) for a second or so after the game is loaded, just to be on the safe side.

----------------------------------------------------------------------------

In an older version of SFD, I had a comment that local variables in global scripts would be cleared when the script stopped running. This was removed from SFD 8 because neither I nor others could reproduce this. sad.gif

After SFD 8 came out, somebody clarified this:

A global script will lose its local variable values if it's not run at least once during a gaming session. I.e., if you save and quit with the script stopped, then load, save, and quit again without restarting the global script, all the script's local variables will be cleared.

The solution is pretty basic: if you need to be sure a global script retains its variables, either make sure the script is always run at least once each gaming session or use global variables for data you need to be sure of retaining.

(Somebody might want to double-check this one: it's been a while, and I don't guarantee that my antique brain remembers this perfectly.) smile.gif

----------------------------------------------------------------------------

Edit: deleted incomplete targeted script information and reposted it further down...
QUOTE(exclusiveor77 @ Sep 7 2006, 02:23 AM) *
StopScript Delay
Don't count on stopScript stopping execution immediately. StopScript signals Morrowind not to run the global script again. But it does not stop the current execution of the script.

When calling stopScript from the script being stopped, either make sure that the remaining script is okay to be executed, or use a return statement to force the script to stop executing immediately.


That's already in SFD 8, on p. 128 (I put it there... smile.gif ):

"Note: If you use 'StopScript' from inside the global script you're terminating, it doesn't
actually terminate the script immediately. Instead, the script continues executing to the 'End'
statement, and then terminates. So you still need to use "Return" if you don't want the rest of
the script to be processed."

And this time I really am calling it quits for the moment; maybe I'll add more tomorrow... snooring.gif
QUOTE(Yacoby @ May 12 2007, 01:41 AM) *
Yeah, I may even be able to save it as .doc... I will have a closer look.

I just remembered I can save PDFs as DOCs (or RTF)... though it turns out the formatting doesn't export properly, and DOC is no better than RTF (but PDFs weren't made to be exported anyway). I could also save it as XML, though I don't know enough about XML to know that to with it after that (InDesign can import it, but I can't figure out how to automate creating a document from it - something I'll have to learn sometime). Or I could just try to fix the formatting in the DOC file using Word.

Would any of that help at all? What format were you working in?
SFD 8, pp. 25 & 26:

Referencing variables on other objects and scripts
Set … to
If a unique object has a local script running on it you can change variables from outside the
script in the following way:
26
Set MyObject.variable to 100
or
Set MyObject.variable to local_variable



If you recompile the target script (i.e., the local script on 'MyObject'), it's a good idea to also recompile any scripts that reference variables in that script. Reason: if the target 'variable' winds up in a different position in the target script's list of variables, then any scripts trying to set that variable will break if they're not recompiled.

I.e., if 'variable' is the 14th variable declared in the local script on 'MyObject', and you add a new variable ahead of it so that 'variable' is now the 15th variable declared, other scripts will need to be recompiled in order to find 'variable' in its new position.

(It's been a long time, and I no longer remember the exact symptoms: I vaguely remember that changing the order of the variables in the target script just caused the scripts to stop working correctly in the game. I don't remember seeing any error messages, which is why I didn't figure out what was going on until after I'd had several working scripts go haywire because of this problem. sad.gif )

One way to reduce the chances of this tripping you up is declare variables referenced by other scripts first, before other variables that aren't referenced externally. Then just be careful to only add or remove variables after the block of externally referenced variables. However (to be safe), it's still a good idea to recompile scripts that reference variables in other scripts any time you've added or removed variables in the other scripts.

----------------------------------------------------------------------------

I think I saw this mentioned earlier in this thread; just giving my take on it...

Script names (in Begin... statements) shouldn't be more than 31 characters long. Character 32 gets replaced by some other character in the title bar and in the Details list information. From looking at the .esm/.esp/.ess format information on Argent's web site, apparently only 32 bytes are allocated for the script name, which makes a 31 character limit reasonable.

----------------------------------------------------------------------------

SFD makes a lot of references to 'menu mode', but I don't think it really specifies just what is actually considered to be 'menu mode'.

Here's my impression: it looks to me as though the game considers 'MenuMode' to be anytime the mouse pointer is on the screen instead of the crosshairs. I.e., any time you can move the mouse pointer around on the screen to select things, rather than the whole display moving and you can only select items at the center of the screen.

For example, hitting Escape for the in-game Options menu, displaying a message box with an "OK" button (or any other clickable buttons), hitting '`' for the console window: all those count as menu mode, in addition to the more obvious ones such as the dialogue window, the character data/map/inventory screen, the container window, etc.

----------------------------------------------------------------------------

Be careful using a function in a conditional ('If' statement); simple functions seem to be OK, but ones with numeric parameters don't seem to be reliable.

For example:

"If ( NewType != OldType )" worked correctly, but "If ( ( Player->GetArmorType 0 ) != OldType )" always registered as 'Not equal', even if the variable 'OldType' had the same value as the armor type that should have been returned by 'Get ArmorType 0' function.

So use "Set NewType to ( Player->GetArmorType 0 )", followed by a separate 'If' statement to compare 'NewType' to 'OldType'.

----------------------------------------------------------------------------

(Not really script related, but I'll toss this in here anyway. smile.gif

If you give an armor item a weight of exactly '0.00' in the Construction Set, the weight won't be displayed in the game and the item's armor rating in the game will be the same as in the Construction Set: it won't be adjusted for the character's Light Armor skill. Give the item a weight of '0.01' (or any other non-zero value) in the Construction Set, and its weight will be displayed in the game as '0' and its armor rating will be correct for the character's armor skill.

For example, an armor piece with a rating of '50' (the same as glass armor) in the Construction Set, and a character with a Light Armor skill of 100:

With a weight of '0.00', the item's rating in the game will be 50. With a weight of '0.01', the item's rating in the game will be 166, the same as for glass armor.

----------------------------------------------------------------------------
SFD 8, p.24:

General syntax: Commas, parantheses and spaces

<snip>

If the ID contains a space, you must use quotation marks: "Object ID" better to avoid
spaces altogether: Object_ID

· Get used to always leave a space after parantheses and operators, sometimes it seems
to cause problems if you don't: if ( variable == 1 ), not: if (variable==1)
Object_ID1 -> Function, Object_Id2, not Object_ID1->Function,Object_ID2
While this doesn’t matter most of the time it generates weird and almost untraceable
errors sometimes, so you are much better off to get used to always leaving a space.

· (By Dinkum Thinkum:) Leading underscores on Object IDs and variables have erratic
results in the script editor: in some places they work fine, in other places the script
editor chokes on them (usually with error messages that don't have anything to do with
the actual problem...).


<snip>

Clearing up about spaces (and leading underscores) and quote marks:

In SFD, a lot of the examples of using a fix, ->, in a script look something
like this:

"Object_ID" -> Function, [parameters]

Quotes around the Object ID, and spaces around the fix. What I ran into is that the quotes and the spaces don't mix...

The following lines, with quotes around the Object_ID and spaces around the fixes, give error messages:

CODE

If ( "Sirollus Saccus" -> GetItemCount netch_leather_greaves ) >= 1

"Sirollus Saccus" -> RemoveItem "netch_leather_greaves" 1

EndIf



But this version, without spaces around the fixes, works fine:

CODE
If ( "Sirollus Saccus"->GetItemCount netch_leather_greaves ) >= 1

"Sirollus Saccus"->RemoveItem "netch_leather_greaves" 1

EndIf


And the following, without quotes but with spaces around the fixes, also works fine:

CODE

If ( manicky -> GetItemCount netch_leather_greaves ) >= 1

manicky -> RemoveItem "netch_leather_greaves" 1

EndIf


The quotes around the netch_leather_greaves didn't seem to make any difference one way or another.

(The above examples use ObjectIDs with embedded spaces, but the same logic applies to ObjectIDs with leading underscores.)


So you can use spaces and leading underscores in ObjectIDs: just make sure you put them in quotes and don't use spaces around the fixes. As a general rule, I'd say just don't put spaces around fixes; then you don't have to worry about it.


A lot of the code examples in SFD 8 do use spaces around fixes; removing those in a future edition might reduce confusion.

Note:

Leading underscores should not be used in variable names. In some types of statements they'll work OK, but in others the variable won't be recognized, and quotation marks won't solve the problem. As stated in SFD 8, variable names should always start with a letter.

Edit: credit to Simpleton for figuring out that spaces around fixes were what was causing the problem with quotes around ObjectIDs! trophy.gif
When you use the 'Drop' function on an NPC, it only works if the NPC's cell is loaded. I.e., the NPC has to be in the same interior cell as the player or, if the player is in an exterior cell, in the same cell or an adjacent exterior cell.

If the NPC's cell isn't loaded, 'Drop' doesn't appear to do anything: no error message, the object isn't removed from their inventory, and it doesn't appear at the player's feet.


Using AddItem or RemoveItem with an NPC doesn't have this problem: they both work even if the NPC's cell isnt' loaded. Also, they seem to be reliable even if you save, exit, and reload the game between using the function and actually loading the NPC's cell. I.e., AddItem and RemoveItem don't have the problem that 'PlaceItemCell' has with the changes not being saved if the cell isn't loaded (which is what I was really interested in checking; testing 'Drop' was just an extra line in my script).

----------------------------------------------------------------------------

By Klinn:

One small note I mentioned in another thread: MSFD gives good instructions on using the 'CreateMaps' console command, but note that it won't generate an image of the cell in which the player is currently located. So if you're standing in your mod's landscape, all the cells around it are processed just fine, but you'll be missing the current cell. To work around this, move to a cell you don't care about before starting the CreateMaps process. You might also be able to move to an interior cell, but this is untested.

----------------------------------------------------------------------------

By unknown:

Info about the TestThreadCells function not mentioned in MSFD.

1-It loads all exterior cells, then all interior ones.

2-Exterior cells load in he following order:


[biggest x number], [biggest y number]
[biggest x number], [biggest y number - 1]
When the "y" number reaches the last value this follows
[biggest x number - 3 _OR_ - 1], [biggest y number]
[biggest x number - 3 _OR_ - 1], [biggest y number - 1]
ect.

3-Interior cells load in alphabetical order

4-The command pauses in menumode, but not exactly when the menumode is first triggered. It waits several frames.


Another note: TestCells, TestInteriorCells and TestThreadCells is a bit buggy. Even if you load a savegame while it's in process, it will continue until the last cell is reached.

By Simpleton:

SetAngle doesn't work how sfd says it does. My guess is nobody ever noticed before because nobody ever uses it with the X or Y axis, which is where it gets funky. I wasn't going to explain how it worked because it's long and complicated and nobody but me cares, but I've got time to kill and there's always a chance somebody will run across this problem and need help.

Probably the oddest thing about SetAngle, X/Y is that neither have anything to do with the X or Y axis'. Luckily they do have a system to them that, with a bit of imagination, isn't too hard to understand. The way I found easiest to understand was to imagine a protractor with an arm being held up at a bit of an angle, so that flat side is on the table and the curved part is about 45 degrees off the table. The angle between the table and the protractor is y, and the angle of the arm on the protractor is x.

There are a couple differences, one being that if you set y to 0 the "protractor" is pointing straight up, and a positive x actually goes down instead of up (i.e. the "arm" would go down into the table). So if you set all the angles to 0 and then add 1 to x each frame the object would spin in a vertical circle that is moving down while it's pointing at you. But, if y is 90 (protractor is lying flat on the table) then adding 1 to x each frame would spin the object around the z axis.

Interestingly in the last example if you were to add 1 to *z* each frame you would get the same results. That's because while what changing x does depends on the angle in y and vise versa, changing z always does the same thing: spin the object around the z axis.

So, there ya go, and even if you don't understand what I said, you have to give me credit for pulling that picture of a protractor out of my a**.

By ManaUser:

I'm afraid I don't understand the protractor analogy but the worst thing about SetAngle is that it doesn't always save right. Particularly when an object has been rotated on more than one axis, I've noticed it facing some wonky direction after reloading.

----------------------------------------------------------------------------

By Nigedo:


While there's a thread available on this, I should clarify, for the record, the whole 'teleport to dynamic exterior positions' confusion (which was completely my fault.)


This information should entirely replace the section on "Scripting Teleporting" in MSFD 8 (acrobat version pp. 148-149).


The method that was first proposed by Aftershock_81 and subsequently revised and applied by JOG in Havish, works very well for this.

You can add a local script to an activator that will teleport the Player to any set of exterior coordinates, pre-stored in three global Float variables.

The 'COE 0 0' statement ensures that the Player starts from an exterior cell. From there, the SetPos commands position the Player at the desired coordinates and the FixMe ensures that the destination cell is correctly loaded.

The only problems with this method (as confirmed by ManaUser) appear when you attempt to run it as part of a global script; causing game freezes and failed destination cell loads.

If it does not suit your mod to apply it as a local script to an activator, an alternative is to add the script to a self-removing, miscellaneous marker object, which another script (global or local) can add to the Player's inventory. This approach was first used successfully by Kaos_nyrb.

I have updated the original script published by JOG to aesthetically improve the Player's experience, by using the Fade command to hide the multiple cell loads and ToggleMenus to conceal the HUD and cell-load progress bar.

CODE

Begin script_PlacePC
;Global Float Start_PCX
;Global Float Start_PCY
;Global Float Start_PCZ
Float xpos
Float ypos
Float zpos
Float timer
Short step
If ( OnActivate )
Set step to 1
Endif
If ( step == 1 )
FadeOut 0.1
ToggleMenus
Set step to 2
Return
Elseif ( step == 2 )
Set timer to ( timer + GetSecondsPassed )
If ( timer > 0.2 )
Set timer to 0
Set step to 3
Endif
Return
Elseif ( step == 3 )
Set step to 0
Player->COE 0 0
Set xpos to Start_PCX
Set ypos to Start_PCY
Set zpos to Start_PCZ
ToggleMenus
MenuTest
MenuTest
Player->SetPos x xpos
Player->SetPos y ypos
Player->SetPos z zpos
FixMe
Player->SetPos x xpos
Player->SetPos y ypos
Player->SetPos z zpos
FadeIn 0.1
Endif
End


----------------------------------------------------------------------------

I think that's all I have for this thread at the moment... Bolt.sml.gif

Edit: famous last words... comp26.gif
QUOTE(Yacoby @ Sep 5 2006, 12:08 PM) *
Here is a quick list of things that need adding/changing (Off the top of my head, so it isn't anywhere near complete)
Messagebox - Multiple messageboxs (Including journal updates) in the same frame can cause a CTD


Not sure how much information you have on this bug, so here's some additional info from a thread cdcooley and I got into on this; the whole thread is in Emma's private forum (on her web site; members only).

----------------------------------------------------------------------------

By cdcooley:

I'm a little late, but I'll at least confirm that you aren't the only one to see problems. I've seen this too. Multiple MessageBox commands in the same frame can cause a crash. The problem doesn't seem to appear if you do 2 MessageBox commands in a row, but stick any other commands between them and you'll have problems. Using 3 simple messages in a row can work, but usually crashes if there are variable substitutions involved.

I'm guessing it's partially an interaction with the voice subtitle boxes. There may be some overall limit to the number of messages per frame.

By cdcooley:

Quote from: DinkumThinkum
It looks like the 'Your journal has been updated' message also counts for this.
That makes sense. And would bet that the cell loading messages do too. That would help explain why too many NPCs talking, cell loads, and other "busy" times are when the game crashes.

ManaUser said he wonders if this could cause problems if message boxes from two different scripts in the same frame could cause problems. I told him I'm trying not to think about that possibility... smile.gif

Added today: I have no idea at all if anybody ever investigated that possibility.

By Cid88

There also appears to be a problem if you call too many message boxes from the same script, even if you set up a frame counter.

I'm not sure the limit, but I discovered it when testing NecroRise a while ago... Appearantly, 50 is too much.

Added today: again, no idea at all if anybody ever investigated that further.

----------------------------------------------------------------------------

Notes:

1. My impression is that any type of text messages have the potential for triggering a crash if they're generated in the same frame.

2. The bug doesn't trigger a CTD every single time you generate two text messages in the same frame: it appears to be a random chance of it happening. But, from what I saw when I tested this: if you keep generating two or more text messages in the same frame (with some other code in between them), sooner or later you will crash. Sometimes my test script would cause a CTD within a few seconds, sometimes it would take five, ten, or more minutes, but it would invariably crash if I waited long enough.

3. For a start-up script I was working on when I ran into this, adding a one frame delay between popping up a Message Box message and updating the player's Journal eliminated intermittent start-up CTDs I had been getting.
QUOTE(Björn @ Sep 7 2006, 06:19 PM) *
GetWeaponDrawn
This may or may not be useful information, but I noticed a thing with this function. When a weapon (or lockpick/probe) is broken (or removed with script?(not tested)), you will "equip" hand to hand like we all know. However GetWeaponDrawn will return 0 a few frames inbetween. That could mess things up (it did in my Advanced Lockpicking mod yesterday 'til I figured this out). But maybe it could be useful too, to figure out when something has been used up. Or in combination with DisablePlayerFighting it might be a way to bring down your hands for some reason.


Adding to this (pasted in bits and pieces from posts in a thread in Emma's private forum):

----------------------------------------------------------------------------

Discovered that if the player character is using Hand-to-Hand and has their fists readied (i.e., up in punching position), adding or removing a piece of armor or clothing will cause them to momentarily unready their fists: i.e., they'll briefly drop from fighting stance to normal standing stance.

Visually, it looks like the character sort of twitches: almost a brief convulsion.

...

It's not just a momentary graphics glitch.

If the character is ready to fight H-to-H (i.e., empty hands up in boxing postition), their fists actually are briefly unreadied when you equip or unequip a piece of armor or clothing.

In other words, "GetWeaponDrawn" will briefly change to zero; I've verified that with a small test script.

Not sure how long the unreadied state lasts, but it was at least three frames when I checked it: got three message boxes on screen from my test script.

...

For my code, I think I can still deal with it. I can't get rid of the convulsions, but I should be able to make them infrequent enough not to be annoying.

Basically, I think I can use a frame counter to 'debounce' the 'GetWeaponDrawn' value: when it changes to zero, don't respond to it until it's lasted long enough to be real and not just this glitch.

...

To see the momentary twitch: empty your character's hands and ready them for fighting. Then unequip or equip a piece of armor or clothing.

If you equip/unequip in menu mode, you'll see the twitch very briefly when you leave menu mode.

To see it more clearly, put a couple of pieces of armor or clothing on Quick Keys. Then put the character in H-to-H stance, and hit the Quick Keys: the twitching should be pretty obvious.
...

I added a couple of timers to my little test script for this glitch and came up with this:

If I use hot keys to switch between different pieces of armor (two helms in my testing), GetWeaponDrawn drops to zero for exacly one frame. This is with no weapon equipped and the PC's fists readied.

When my script removes one invisible helm and replaces it with another in the same frame, GetWeaponDrawn is cleared for between .50 and .55 seconds each time. I checked in areas with different frame rates: the time was always just over 1/2 second, but the actual number of frames varied (roughly from 14 to 26 frames, depending on where I was) .


So I decided to use a 1.5 second delay in my code to debounce that momentary change in GetWeaponDrawn, and that seems to work.

I can't stop the 'twitching' compeletely, but at least my timing changes make it pretty unoticeable: it was extremely conspicious and annoying when I first noticed it happening.

----------------------------------------------------------------------------

Note: besides being visually annoying when it happens repeatedly, the twitch when the character briefly switches from H-to-H stance to normal standing stance and then back to H-to-H stance will cause the character to creep downhill slightly if they're standing on a slope (because of the change in the position of the feet).
I've been trying to think about how to get this going...

...PDF format is a pain to edit afterwards...
...RTF/DOC conversion gives a usable document, but it's not pretty and it's not an ideal final format anyway, nor is it easy to convert and retain quality...
...HTML conversion would lose a lot of pretty as well - and would have to be multiple pages - but OTOH it doesn't require special software to edit...
...I have no clue how a wiki might be set up...

If someone could point me in some useful direction I'd like to have a go at helping to make this happen. What final format(s) would people want? I'd prefer HTML myself, but that's just me.

If someone else is already looking into this, just let me know and I'll butt out. wink.gif
From an end users perspective it's much easier to have everything in one document imo, as this makes it easier to search, and is readily available when off-line, neither of which is true of a wiki. My preferred final formats would be PDF, DOC, RTF, HTML, wiki in that order.

If I were doing it I'd compile & format everything initially in a word processor as that'll be the easiest environment to do edits, and you can take advantage of it's track changes features etc. Hopefully Yacoby can supply his edits in a more wp friendly format such as rtf, but failing that you could always download the word version of MSFD 8, and reapply Yacoby's edits by cut an pasting from his PDF. You can then easily export from your wp of choice to DOC, RTF, PDF and/or HTML so you have maximum flexibility about your distribution methods. I believe this is how GhanBuriGhan carried out his maintenance back in the day. No reason not to make all those formats available though as long as it's relatively easy to do.

I'm not sure why you're suggesting it's difficult to maintain formatting when exporting from a word processor to PDF/HTML, I haven't found that to be the case in my admittedly limited experience? Nor am I sure why you consider doc 'not pretty', as I'd think it has more than enough formatting options for the current task, you don't really want anything to flamboyant in a technical document like this anyway?

I think it'd be to much trouble to set up a wiki specifically for this, it'd make more sense to integrate the information into the existing UESP modding pages as princess & HeyYou suggested if you wanted to go the wiki route. UESP has an existing profile & Dave has a long track record of maintaining the server so there's a reasonable expectation it'll be available over the longer term.

As to how to get it from a wp into the wiki, wiki uses a unique markup language, but it's relatively simple to convert from word or html to wiki, then it'd just be a matter of cut and pasting into the wiki, which could be done as a collaborative undertaking as anyone can register at UESP and then carry out edits.
I would go for an Offline Document (HTML so you can clik on links or Word which does the same .. ) regarding wiki

we laready have one of sorts as OldeCow69 mentions http://www.uesp.net/wiki/Tes3Mod:Alphabetical_Function_List

all the actual cmd related stuff can be put and there and I would healp in transposing it .... smile.gif
@OldeCow69: I daresay there's a lot of personal preference (and, admittedly, prejudice) involved: I really hate MS Word (and the HTML it exports is rubbish, though I admit it's not difficult to clean up).

How a PDF exports really depends on the tagging and so on... I'm not up on that sort of thing and don't really know how to fix most of the problems, other than redoing the formatting after the exporter has screwed it up. But I've just discovered I can export multiple HTML files as a single PDF, so it looks like everyone's more or less pleased. smile.gif

I'll get started on it, then! 1277.gif
I got windows back banghead.gif

Anyway, .doc:
http://www.yacoby.net/es/upload/?action=download&id=33


If you want help with exporting to PDF, Dad has Adobe Acrobat Professional, which translates the word doc exactly.

If you want a HTML document from a MS Word Document, I believe Dreamweaver 8 has some ability to translate word to HTML, which would result in proper XHTML rather than Microsoft's version.
Thank you! I'm afraid I've got more experience trying to get things out of DOC format. But if that's what people would rather edit, I guess I'll live with it. tongue.gif smile.gif

QUOTE(Yacoby @ May 13 2007, 08:48 PM) *
If you want help with exporting to PDF, Dad has Adobe Acrobat Professional, which translates the word doc exactly.

S'OK, I've got it too (I just don't use it enough to remember it's there blush.gif )

QUOTE(Yacoby @ May 13 2007, 08:48 PM) *
If you want a HTML document from a MS Word Document, I believe Dreamweaver 8 has some ability to translate word to HTML, which would result in proper XHTML rather than Microsoft's version.

I don't have Dreamweaver, but I've cleaned up quite a few pages (and a few small sites) other people have exported from Word - I've got a few utils that help and the rest is mostly search and replace, it should be fine - and if it isn't, I expect someone else will be able to do it.

If nobody minds, I'd like to have a crack at it and see what I can do now.

Yacoby... What did you use to save the DOC file? I tried with Acrobat, but it just ended up scrambled in places.
QUOTE(melian @ May 13 2007, 03:29 PM) *
Yacoby... What did you use to save the DOC file? I tried with Acrobat, but it just ended up scrambled in places.

That was saved with MS Word 11.
Edit: Found this under "Fall":
QUOTE
This also seems to updates animations. I have had cases of an actor not collapsing when I have set fatigue to 0. When use this it makes them collapse.


I've not found this to be the case. Movement works, but Fall just gives a "land from short fall" animation and the NPC goes back to just standing there. Has anyone else tested this?

---

Edit yet again: Under SetDelete:
QUOTE
One last thing to be aware of is that sometimes magic effects can also cause problems with the SetDelete function


Does anyone know what this is referring to specifically? I've never had any problems with SetDelete when it's not done in the same frame as Disable, and it's such a general statement I have no idea what to check on.
QUOTE(melian @ May 13 2007, 08:55 PM) *
Does anyone know what this is referring to specifically? I've never had any problems with SetDelete when it's not done in the same frame as Disable, and it's such a general statement I have no idea what to check on.
Not sure, but probably if the disabled creature/npc is emitting some sound (or affected by any sound emitting spell?) it can crash if you setdelete it, so it's good practice to wait a few second for creatures/npcs.
Also, if you have a item1 spawning item2 by script (placeitem, placeatme...) you should not setdelete item1 before item2

QUOTE(melian @ May 13 2007, 07:55 PM) *
Edit: Found this under "Fall":
I've not found this to be the case. Movement works, but Fall just gives a "land from short fall" animation and the NPC goes back to just standing there. Has anyone else tested this?

It was an old thread that prompted that. If it is incorrect, feel free to remove it.

QUOTE(abot @ May 14 2007, 10:07 PM) *
Not sure, but probably if the disabled creature/npc is emitting some sound (or affected by any sound emitting spell?) it can crash if you setdelete it

What abot said.
QUOTE(DinkumThinkum @ May 12 2007, 03:51 AM) *
:snip:


You're on my Hugs List (sort of the opposite of a Sht List) along with Yacoby.

Just thought I'd warn you.

Most helpful advice smile.gif
QUOTE(abot @ May 15 2007, 07:07 AM) *
Not sure, but probably if the disabled creature/npc is emitting some sound (or affected by any sound emitting spell?) it can crash if you setdelete it, so it's good practice to wait a few second for creatures/npcs.

Thanks! Seems I'm being slow again - but if anyone knows more about how that works (SetDelete and magic problems) I'd love to know.

I have an NPC that casts on other NPCs by means of an invisible target NPC... Normally the targets wait 4 seconds before the disable/delete, which is fine (never had a problem). I changed it to 1 second and it CTD'd. It also CTDs if the NPC is casting (no actual magic effects on the target yet) when the target is deleted.

I'll do some more testing later.

QUOTE(abot @ May 15 2007, 07:07 AM) *
Also, if you have a item1 spawning item2 by script (placeitem, placeatme...) you should not setdelete item1 before item2

Er... I assume there's more to this than what you've said? Because I've done that any number of times with no problems. Unless it's only certain types of objects (creatures maybe)?

Edit: abot, was that meant to apply to both PlaceItem and PlaceAtMe? I was referring to PlaceAtMe when I said I hadn't had any problems doing that... I'll see what happens with PlaceItem.
QUOTE(melian @ May 15 2007, 01:39 AM) *
Er... I assume there's more to this than what you've said? Because I've done that any number of times with no problems. Unless it's only certain types of objects (creatures maybe)?
You are right, it is probably similar to the sound/casting issues: personally I had problems placing an invisible sonar/spawner npc spawning another similar npc (it was a NPC because I needed its collision to spawn it at the floor level, and because it's easy to make NPC race invisible).
As determining the correct "safe" shortest delay before deleting the "parent" npc was not so easy (and I needed a delete as fast as possible, possibly before the player could leave near cells), I ended spawning the children NPCs with player as "parent" (I.E. using player->PlaceItem childNPC x y z angle).
Still, knowing the problem before could have saved a few semi-random crashes and headaches smile.gif
[edit]typos
Thank you for that! smile.gif

I will leave digesting the info until later, though (when I've had some sleep! wink.gif ). That section really needs updating, I think.

P.S. If anyone is wondering how it's going...

Done:
-Replaced old section on dialogue cleaning with new info that's come up/been clarified recently, plus a (hopefully informative) explanation of why it works as it does.
-Bunch of small updates, extra info, etc from this thread. Too tired to remember most of them atm but I think I've got all of it at least outlined...
-Redid targeted scripts section somewhat, added more info, etc - it's too big now to be just notes.
-Missed lotsa sleep... smile.gif

Stuff for someone else to do, or send, or help with, or whatever you like really:
-Er... on second thought, I'll leave that 'til later. Will edit post soon.

P.S. There's a "detecting other mods loaded" section I thought maybe should be expanded to a "mod interaction section" - thoughts, anyone?
OOOOPS! comp26.gif

(I'll edit the original post in a minute to get rid of the incomplete info.)

QUOTE(DinkumThinkum @ May 11 2007, 10:44 PM) *
Targetted scripts lose their target when the game is saved, exited, and reloaded. I.e., if a targetted script is running when you save and quit, when you reload the game the script will no longer have a target.

Again, the solution is pretty basic:

Each time the game is loaded, have a start-up script check to see if the targetted script is running. If it is, stop and restart it to reset the targetting.

(I use this in the Unarmored Corrector, which uses a script targeted on the player character: each time the game is loaded, a start-up script checks if the main script is running. If it is, it stops and restarts it to reset the target on the player. If the main script isn't running, then it's left shut down. I'm not aware of anybody every running into any problems with this, so it seems to be a pretty reliable approach.)


Actually, the above is incomplete: it only applies to the player character and other objects that aren't placed in the game world in the Construction Set. Reading through the What is the 72 hours bug? thread archived on Emma's site refreshed my memory. blush2.gif

1. Targeted scripts work fine through a save/reload if the target was placed in the game world in the Construction Set.

I specifically tested this with NPCs: the original version of the PotionSaver was set up as a separate targeted script, targeted on the companion. That worked fine through save/quit/reload: tested that intensively, multiple times before I decided to just embed it in the companion's local script instead.

2. However, targeted scripts will lose their targets on a save/reload if the target was not placed into the game in the Construction Set. For example, if the target was added to the game from a script or dialogue results box.

Interestingly, this applies to the player character too: if you check in the editor, you'll see that the 'player' has a count of zero. They're not in the world in the Construction Set, but are placed there after the game starts. And, as I recently confirmed, scripts targeted on the player will lose their target during a save/reload.

3. Scripts that target an NPC will lose their target after 72 hours if the NPC is not in an active cell, regardless of how the NPC is placed in the game.

----------------------------------------------------------------------------

For scripts targeted on the player, here's a solution I've used successfully:

Each time the game is loaded, have a start-up script check to see if the targetted script is running. If it is, stop and restart it to reset the targetting.

I use this in the Unarmored Corrector, which uses a script targeted on the player character: each time the game is loaded, a start-up script checks if the main script is running. If it is, it stops and restarts it to reset the target on the player. If the main script isn't running, then it's left shut down. I'm not aware of anybody every running into any problems with this, so it seems to be a pretty reliable approach in this situation.

In my case, shutting down and immediately restarting the main script is completely harmless. For other scripts, it could be trickier.

I have not tested it, but the same approach might work for NPCs, etc. that are placed into the game with a script (instead of in the editor). However, if the NPC or other object does not have a unique ID this would not be reliable, since there's no way (that I know of) to control which reference the script would pick as a target.


----------------------------------------------------------------------------

Note: If you haven't seen it, the archived What is the 72 hours bug? thread has a lot of useful discussion and information, including info on targeted scripts.
Thanks, DinkumThinkum! smile.gif

I already had the unplaced object part, but I'd completely forgotten to include the startscript fix (added now). I have yet to comb Emma's for info (or the thread archive either).

Since you're here... Would you happen to know which functions cause CTD in an untargeted script?

P.S. Thank you so much for all this! smile.gif
QUOTE(melian @ May 16 2007, 01:04 AM) *
Since you're here... Would you happen to know which functions cause CTD in an untargeted script?


I can't think of anything beyond what's been posted here or is already covered in SFD somewhere.
QUOTE(DinkumThinkum @ May 17 2007, 12:41 AM) *
I can't think of anything beyond what's been posted here or is already covered in SFD somewhere.

I'll add it to the 'needs testing' list, then.

Thanks again! smile.gif
QUOTE(melian @ May 13 2007, 02:37 PM) *
I've been trying to think about how to get this going...

...PDF format is a pain to edit afterwards...
...RTF/DOC conversion gives a usable document, but it's not pretty and it's not an ideal final format anyway, nor is it easy to convert and retain quality...

If someone could point me in some useful direction I'd like to have a go at helping to make this happen. What final format(s) would people want? I'd prefer HTML myself, but that's just me.


PDF, because it's awesome. Want to work on it as a Word document and convert it to PDF later? Behold, a Free PDFCreator! It installs as a printer.

(Or, if you're feeling masochistic, learn LaTeX and convert it... smile.gif )
QUOTE(Alphax @ May 17 2007, 03:25 PM) *
PDF, because it's awesome. Want to work on it as a Word document and convert it to PDF later? Behold, a Free PDFCreator! It installs as a printer.

(Or, if you're feeling masochistic, learn LaTeX and convert it... smile.gif )

That's taken care of: I've got Acrobat for that (and I'm not feeling masochistic tongue.gif ). I just forgot about it for a while, because I don't use it much (it just came with Photoshop, Illustrator, etc).

---

Work may be a bit slow in the next day or two - got some computer-ish problems I need to sort out. I'll work on it when I can, though. Shouldn't be too much longer before I've reached my intellectual limit (then someone else needs to take over, or at least check it - please?). smile.gif
in the SFD 9, you shloud include the use of SetLevel and say that it doesn't accept variables, but only numbers
QUOTE(Arcimago @ May 21 2007, 09:40 PM) *
in the SFD 9, you shloud include the use of SetLevel and say that it doesn't accept variables, but only numbers

Adding to this, I would like some clear information on which functions take variables as parameters/arguments. It should be at the top, where you see the syntax of the function. I think GBG did try to do this like:
CODE
Function "Whatever ID" Whatever_enum Whatever_float_var short_Whatever_enum

where _enum would mean that it doesn't take a variable while _float_var would mean that it takes a float variable. I have no idea what short_Whatever_enum means, but I've seen that too. I am not sure how correct all that information is, maybe it's completely correct, but some clarification wouldn't hurt.

Occasionally when I have wanted to pass values between an (script generated or non-unique) object's local and targetted scripts, I use functions such as SetAngle to be able to obtain the value with GetAngle in another script. In the case of Set/GetAngle (at least Y axis) the value appears to be subtracted by 1. So for instance, if I use SetAngle Y 84 in one script, and use GetAngle Y in another script, it will return 83. I don't know if it's SetAngle or GetAngle that works incorrectly, but I always make sure to add 1 before I use SetAngle.
There's some stuff on Set/GetAngle in one of DinkumThinkum's posts (just a few posts back in this thread) - but I have no idea what all that stuff about a protractor was meant to mean, so at the moment it's just quoted as-is. Maybe you could take a look and let me know if that matches your experience?

About the "which functions accept vars" thing... I think someone's mentioned that before as well. Perhaps adding some kind of note with the function description would help, like "SetPos [Accepts vars with Trib]" or something to make it absolutely clear?

--

Edit: A question for anyone who knows... I'm assuming that StayOutside requires an expansion. Can anyone confirm this? I'd just rather not have to do a MW-only install to find out (HD space is getting tight). Thanks! smile.gif
Unfortunately I've gone & deleted my MW only install, but I think you'll find it was added by one of the expansions, Grumpy thought Tribunal, UESP claims it was Bloodmoon.
QUOTE(Yacoby @ Sep 5 2006, 12:08 PM) *
The problem with ForceGreeting in if-elseif blocks


What is the problem with ForceGreeting? I am starting my mod with a forced greeting from Fast Eddie. It looks like I will using If-ElseIf blocks to determine when Eddie contacts the PC.
QUOTE(Rastamage @ May 22 2007, 07:33 PM) *
What is the problem with ForceGreeting?
a nice explanation
O-kay...

I've got about as far with this as I can at this point in time, and RL is getting busy, so I would like to pass this on - at least for a while. I've used Word's 'track changes' feature, and comments where I think something still needs improvement/expansion/correction. If someone could take a look that would be great.

I'm still okay to do the file conversions once it's ready, and if you just want to add comments or send me a message something and leave it at that I'm happy to write it up in full and so on. I just don't like sitting on this while I can't work on it. Hopefully I'll have more time soon.

Word file is here.
Rotateworld does NOT update an items position.

If you use rotateworld in a script, and then call getangle, it will always return the same value, regardless of what the angle actually is. Just using rotate does not cause this problem.
Just a bump to keep this from falling into the bit-bucket, and bring it back from page 34.......
I've got something to add from a previous thread of mine:

Ok, so I've learned a few things. GetDetected calling an NPC's ID if there's more than one reference in the game will return nothing. For example:
CODE
GetDetected "fargoth"

Assuming the calling actor can detect Fargoth, this returns 1. But:
CODE
GetDetected "Imperial Guard"

doesn't return anything! Not 0, not 1...absolutely no return at all. There's only 1 Fargoth, but many guards. Now if I do:
CODE
GetDetected "Imperial Guard00000002"

I get a value returned.

GetLineofSight and GetLOS work in the same way.
I am again working on this. I will upload again when I stop, and hopefully someone else can take over for a bit...
QUOTE(Yacoby @ Jul 10 2007, 06:37 PM) *
I am again working on this. I will upload again when I stop, and hopefully someone else can take over for a bit...



Thank you!!

This is another one of your VERY worthwhile projects.
QUOTE(HeyYou @ Jul 11 2007, 05:21 PM) *
This is another one of your VERY worthwhile projects.
I wouldn't call it one of my projects anymore. 30 people have posted in this thread, most adding suggestions and information, and melian has done a huge amount of work on the document itself. All I did was start the ball rolling.

Can anyone who has a Morrowind only install check if the following scripts will compile:

CODE
begin MWSDF_T2a

ModRegion, "West Gash Region", 100

end


CODE
begin MWSDF_T2b

ModRegion, "West Gash Region", 50, 50, 0, 0, 0, 0, 0, 0

end




MWSFD says:
Execute script only if the player is suitably near. If you have scripted a fancy magic bouncing ball, or basically anything that is a visible effect, there is no reason to run the script if the player cannot see it. So put something like this on top of your script:
CODE
If ( GetDistance, player < 5000 )
    Return
Endif


I always thought that doing square root calculations was not something you wanted to be doing every frame? I am unsure, as I don't know the algorithm for working out the root of a number...
QUOTE(Yacoby @ Jul 11 2007, 08:28 PM) *
MWSFD says:
Execute script only if the player is suitably near. If you have scripted a fancy magic bouncing ball, or basically anything that is a visible effect, there is no reason to run the script if the player cannot see it. So put something like this on top of your script:
CODE
If ( GetDistance, player < 5000 )
    Return
Endif


I always thought that doing square root calculations was not something you wanted to be doing every frame? I am unsure, as I don't know the algorithm for working out the root of a number...

Well I think that it means that the scripter has to determine which way to make his scripts as efficient as possible. And in some cases it definitely is faster to calculate GetDistance each frame instead of running the rest of the script each frame. I think this goes for objects that emit sounds or rotate, well pretty much what MSFD says. So it's in no way wrong, but possibly unclear.
Has this been finished yet? I want to learn scripting language but don't want to download version 8 and see 9 come out the next day.
OK, here's an suggested amendment:-

PCLowerRank and PCRaiseRank also take the optional ["FactionID"] as the example "treboniusScript" makes clear.

In addition, it seems that LowerRank and RaiseRank can also take ["FactionID"]; or at least, not complain about it. Not that there should be any need as, as far as I know, an NPC can only be in one faction.

Well that's a coincidence... More stuff on RaiseRank/LowerRank:
From SfD:
QUOTE
In the original game, this was only used in dialogue.

RaiseRank is used in ajiraScript.

I've done a little testing - I need to do some more, but so far: RaiseRank doesn't work in a global script. It definitely works in a local script (or dialogue, of course). I think targeted scripts work too.

Edit: Yep, targeted scripts work. And: If you use the faction ID and it's not the faction the NPC belongs to, it still raises their rank in the faction they're set to in the CS. If they don't belong to a faction, it won't do anything (whether or not you use a faction ID). So the faction ID makes no difference whatsoever, it's just ignored.
QUOTE(melian @ Jul 17 2007, 09:12 PM) *
Edit: Yep, targeted scripts work. And: If you use the faction ID and it's not the faction the NPC belongs to, it still raises their rank in the faction they're set to in the CS. If they don't belong to a faction, it won't do anything (whether or not you use a faction ID). So the faction ID makes no difference whatsoever, it's just ignored.


So faction ID can be appended to RaiseRank to help document the script, but otherwise does nothing. Don't get it incorrect or it will confuse.

Hmmm, have you tested what happens if you RaiseRank <none existent faction>? Does it error or accept even this?
Well, RaiseRank "eel pie" not only compiles, it works as usual with no errors. So the faction ID is completely ignored.

ActorID->RaiseRank works in dialogue to target a different actor, but not in script (unless the script is local to or targeted on "ActorID", in which case the ID is pointless anyway). Kind of annoying, that.
Is this done yet?
Couple more things...

I was (partly) wrong about choice being limited to 5 choices per call: it sometimes is, but sometimes isn't. I haven't tested properly yet, but I think maybe it's only choices in if-blocks and/or scripts (not in the resultbox) that are limited. Or something... I'm not sure what the limit is for "just plain choices" but it seems fairly large. Sorry about that, I just assumed it would be the same regardless. blush.gif

Cast mentions activators but not other types of objects - I just tried a ring and it works, but if the ring is in inventory it will crash the game. Another thing I don't think is mentioned is that you can use cast to get non-actor objects to cast on themselves (I don't know if it works using the object's ID as target, I just use "player" with an on self spell).
I was wondering, when do we say it is "Finished", and stop work on it, setout the page numbers/links (ug) and call it done. If we don't do it soon, it could end up draging on for years. It is nearly a year already.

The only things that haven't been done are:
QUOTE
Some suggestions: I'd love to have included most used/recent math scripts (similar to the TES4 wiki)
and possibly web links to mods using the different techniques described for reference.
I.E., Galsiah's pool mod/MadMax's flying/sailing items for sin/cos calculation examples, and so on...


and some of the stuff that the past 5 - 6 1 posts.


Personaly, I say that we say that anything beyond this point goes in V10 (If that ever comes shrug.gif), I add the stuff from the latest 5 - 6 posts, try and convince abot or someone good at maths to add some maths scripts.

Then just upload it for people to have a look over. If no more suggestions are made, set the page number links, contents page etc and call it done.


How does that sound?
Sounds fine to me. smile.gif

One small suggestion: An explanation of how float variables work would have saved me a lot of headaches. Some of us don't know about programming or how float values are stored, and therefore don't know that testing exact equality with a float isn't a good idea. Just an extra paragraph in the variables section maybe?
QUOTE(Yacoby @ Aug 23 2007, 05:07 PM) *
I was wondering, when do we say it is "Finished", and stop work on it, setout the page numbers/links (ug) and call it done. If we don't do it soon, it could end up draging on for years. It is nearly a year already.

The only things that haven't been done are:
and some of the stuff that the past 5 - 6 1 posts.
Personaly, I say that we say that anything beyond this point goes in V10 (If that ever comes shrug.gif), I add the stuff from the latest 5 - 6 posts, try and convince abot or someone good at maths to add some maths scripts.

Then just upload it for people to have a look over. If no more suggestions are made, set the page number links, contents page etc and call it done.
How does that sound?

Well there is one other thing I haven't seen mentioned that would be nice to include - here is how I commented on it in another board. Sorry about the lateness of this post for your scripting update but this is the first time I have seen it...

QUOTE
Since when you are in an exterior cell (haven't checked with interiors) any object you disable IN THE EXTERIOR CELL AND ADJOINING EXTERIOR CELLS while you are in that cell will retain it's collision properties in the game world until the next time that exterior cell is loaded - i.e. you disable a fence piece through a script where that fence piece is in the same exterior cell as your PC. You still can't walk through the area where the fence piece is disabled until you exit and reenter that exterior cell. Similarily, you subsequently reenable that fence piece that was disabled when your PC entered that exterior cell. You can walk right through that fence piece until the next time that exterior cell is reloaded by the game.

The fix:

Use the "FixMe" command in your script after you disable or enable a game object that exhibits collision. You should check that you are in the same exterior cell as the game object before you execute the FixMe command - if you aren't you don't need FixMe. This is useful in global scripts that enable or disable objects with references persist so you could be in any cell when the object is enabled or disabled. Using FixMe will cause your PC to also move 128 game units (hardly noticeable in most cases other than as a "stutter") when it executes but since there is no other script command (that I know of) that reloads a cell that is something you will have to live with. Using FixMe will cause the collision to be reset for the cell FixMe reloads so is a way to immediately fix collision on script enabled/disabled objects. Hope this helps someone. Took me hours to figure out.


- Rougetet
i'm not to sure if any of the information has been mention in any of the WIPz for this, but i didn't see any of what i have recently found out about random numbers and bascially a way to have a random number range from 0 to 10 000 with out the need of trib or BM and still get a wide range, how? well here is how

CODE
begin randomnumber

short spare
short number

set number to random, 10
set number to ( number * 1000 )

set spare to random, 10
set spare to ( spare * 100 )
set number to ( number + spare )

set spare to random, 10
set spare to ( spare * 10 )
set number to ( number + spare )

set spare to random, 11
set number to ( number + spare )

end


instead of trying to get a random number in one go we break it up into its different units, here we have thousands, hundreds, tens and ones. all numbers need to have a range from 0 to 9 execpt for the last one ( unless you want your range to be 9999 )that way if all numbers get their max possible random value it'll add up to 10 000. now what if you want to have a random number between 0 annnd say 4756 it gets a bit more complicated but its possible still.

CODE
begin randomnumber

short spare
short number
short state

set number to random, 5
if number == 4 ;first check
set state to 1
endif
set number to ( number * 1000 )

if state == 1
set spare to random, 8
if spare < 7;second check
set state to 0
endif
else
set spare to random, 10
endif
set spare to ( spare * 100 )
set number to ( number + spare )


if state == 1
set spare to random, 6
if spare < 5;third check
set state to 0
endif
else
set spare to random, 10
endif
set spare to ( spare * 10 )
set number to ( number + spare )


if state == 1
set spare to random, 7
if spare < 6;fouth check
set state to 0
endif
else
set spare to random, 10
endif
set number to ( number + spare )


end


this time every time we do a random, var we need to check to make sure it hasn't gone to the max number it can be, hopefully some one can make sence of this mess, i may come back and edit this when i'm not tired biggrin.gif

EDIT: made it easier on our scroll buttons
QUOTE(Rougetet @ Aug 24 2007, 07:14 AM) *
Well there is one other thing I haven't seen mentioned that would be nice to include - here is how I commented on it in another board. Sorry about the lateness of this post for your scripting update but this is the first time I have seen it...
- Rougetet

Well again late but just ran across this seconds ago. It contains some very obscure script pitfalls, some of which, such as Do Not Use the 34th variable, I had never seen before nor did I see in your other posts in this thread. It would be worth a look to include in your Version 9 Update.

Please forgive me if someone commented on these previously and I missed it.

EDIT: OOPS - I see that post # 109 in this thread by abot already covered that link. Sorry.... blush2.gif

- Rougetet
QUOTE(Rougetet @ Aug 28 2007, 06:42 AM) *
... Do Not Use the 34th variable


Oh, that's the rogue variable. I'm working on a big script and remembered that one variable causes problems, but I couldn't remember which it was.
QUOTE(melian @ Aug 24 2007, 10:10 AM) *
One small suggestion: An explanation of how float variables work would have saved me a lot of headaches. Some of us don't know about programming or how float values are stored, and therefore don't know that testing exact equality with a float isn't a good idea. Just an extra paragraph in the variables section maybe?

Yeah, that would be very useful. Someone who has a better understanding than me need to write it though. The only people I can think of at present is someone like Timeslip or Dave Humphrey.
I asked my husband to write something, but I don't know if he will - he seemed quite indignant at my assumption that one paragraph was enough to explain The Wonders Of Mathematics And Computing rolleyes.gif . If I can get him to write something reasonably concise I'll post it.

Some more things I've noticed - hopefully not too late (sorry!):

Activate function - I've got a script using onactivate/activate on a book and the 'take' option appears just fine. Might be version-dependent? (tested with 1.6.1820).

AIActivate - some of the 'activations' are wrong, e.g. NPCs don't enter dialogue with the player (and certainly not with each other!), they just walk up and then circle round the player/other actor. Same with activators that don't have an OnActivate in their local script. If you put the item to be activated too high for the NPC to reach you get much the same effect (NPC walk up until he's under it then rushes round in circles). Also - I've never had AI package done register with AIActivate, either.

Minor nitpick:
QUOTE
According to info provided by Nigedo, OnPCHitMe also registers if the NPC commits a crime, and the Actor has a sufficiently high alarm setting.

I think it means if the PC commits a crime, not the NPC!

Discovered that if you use Linux-style file paths the compiler won't complain, but you get odd results ingame - sometimes an error (can't find file), sometimes it works, sometimes it silently drops that line and can cause problems with other scripts (scripts can stop, fail to start, or might not be executed properly while the problem script is running). The best part is that if you get an error, it's something like "Cannot find file "Data Files/Sound/Vo\folder\filename"". Hooray for consistency! blink.gif

I was being overly paranoid when I made it sound like "show var" only works for globals - of course it does work for objects with local scripts, but sometimes if the object doesn't have a local script it can crash the game. I think that might happen when you try to use it on statics, not sure.

CellChanged - Just a note that this doesn't always trigger, even if the player enters the cell via a normal teleport door. I get the impression that scripts running in the cell can have some effect on this, somehow. ForceGreeting seems to muck it up in particular (and no there wasn't a menumode return in that script). Another thing - CellChanged does NOT trigger immediately, and checking GetInterior will usually register a change between interior/exterior before CellChanged does.
Just me being a nuisance again tongue.gif

PlayLoopSound isn't listed in the "Playing Sounds" section, though it does appear in an example script for GetSoundPlaying.

Nothing on float variables yet, unfortunately.
QUOTE(melian @ Sep 4 2007, 10:12 AM) *
\
Nothing on float variables yet, unfortunately.


Wikipedia's got some info, I think:
http://en.wikipedia.org/wiki/Loss_of_significance
http://en.wikipedia.org/wiki/Floating_point#Addition

The main point being that numbers are stored in finitely many decimal places. This usually is close enough that errors are too small to be a problem, but when testing for equality you get things like this:

num1 = 1/3 ; Stored as, say, .3333333
num2 = 3 ; Stored as 3

num3 = num1 * num2 ; 0.9999999

if ( num3 == 1 ){
; Never happens.
}

It may be more complex than that, but that's my understanding of it. Short and Long variables can only store integers so these sorts of rounding errors just don't happen.
I have found that “Goodbye” in dialog result window is an EVIL.

e.g. “set NPCstatus to 100
Goodbye” does NOT work

“set NPCstatus to 100” without “Goodbye” is OK for assigning new values for local and global variables within dialogs.
Better not to use it all if the result window contains other statements.

I haven’t read anything about this problem.

fing04.gif
That's weird... I've never had any problems with it. Even this works:

CODE
if ( GetBlightDisease == 1 )
    if ( vix_Ralia.MagickaTotal < 100 )
        MessageBox "Ralia: I don't have enough magicka to cure a blight disease now."
    else
        ModDisposition 5
        MessageBox "All right. Stand back, please, ^PCName!"
        set vix_RaliaState to -1
        StartScript vix_m_RalHealBlightD
        goodbye
    endif
elseif ( GetCommonDisease == 1 )
    if ( ( vix_Ralia->GetMagicka ) < 15 )
        MessageBox "I don't have enough magicka just now."
    else
        ModDisposition 2
        MessageBox "All right. Stand back, please, ^PCName!"
        set vix_RaliaState to -1
        StartScript vix_m_RalHealComD
        goodbye
    endif
else
    MessageBox "Ralia: She's not sick, ^PCName!"
endif


I would have thought if it was going to fail, that should do it. Are you sure the problem wasn't in the script? What exactly were you trying to do?

Edit: Sorry, just realised I made it sound like I didn't believe you... I really just want to know if there's some specific combination that messes things up. banghead.gif
I am talking about dialog result window in the TESCK, not about scripts with MessageBox functions. Perhaps, in the later case this works differently.

smile.gif
That was a dialogue resultbox script - the messageboxes were to give the impression of a three-way conversation (Ralia is not the NPC the player is in dialogue with here).

I'm wondering... PositionCell in dialogue results works for some people but crashes the game for others. And some things are version-dependent... I don't know. shrug.gif

I will keep an eye out for info, but I don't think I've seen anything on it before.
I see. I have never tried to use such complicated scripts in the dialog result box or at least to use “goodbye” within an “if endif” construct. I will try.
Thank you.

smile.gif
Back again...

It seems that sEffectWaterBreathing can't be detected from script (at least on the player, haven't tried for NPCs), though it does work in the console. sad.gif

Edit: Just realised there's a really obvious workaround: GetWaterBreathing (does work, tested). Still, the info might be useful to someone... blush.gif

---

Edit #2: Limit on choices in dialogue results seems to be a limit on the number of choices displayed at one time (max 20) - thread here.
Is there a download link for this anywhere?
QUOTE(melian @ Aug 24 2007, 05:10 AM) *
One small suggestion: An explanation of how float variables work would have saved me a lot of headaches. Some of us don't know about programming or how float values are stored, and therefore don't know that testing exact equality with a float isn't a good idea. Just an extra paragraph in the variables section maybe?


QUOTE(Yacoby @ Aug 29 2007, 08:41 AM) *
Yeah, that would be very useful. Someone who has a better understanding than me need to write it though. The only people I can think of at present is someone like Timeslip or Dave Humphrey.


QUOTE(melian @ Sep 1 2007, 05:17 AM) *
I asked my husband to write something, but I don't know if he will - he seemed quite indignant at my assumption that one paragraph was enough to explain The Wonders Of Mathematics And Computing rolleyes.gif . If I can get him to write something reasonably concise I'll post it.


Well, I'm not one of those guys Yacoby mentioned, but maybe melian's hubby or somebody can use the following muddle as a starting point to the needed concise paragraph:

Floating point numbers in a computer are stored in a format similar to that used for scientific or engineering notation. The number is rounded off to a fixed number of significant digits, any leading or trailing zeros are dropped, and an exponent is added to indicate the correct location of the decimal or binary point.

The advantage of this format is that a wide range of values can be expressed using a relatively small number of digits or bytes. The disadvantage is that the rounding off means floating point numbers don't have the precision of an integer, so they shouldn't be used when you need to make exact comparisons or keep track of exact counts.

For example, a floating point variable is fine if you just need to check if a distance is greater or less than a certain value. But if you need to check if the player has specific number of some item in their inventory, then you want to use a long or short integer variable for the count.

Note: as pointed out in SFD 8, global long variables are actually stored as floats, so they should be used as floats, not integers. Local long variables are stored as integers, so they can be used for values that require exact values.

...DT staggers off into the sunset babbling incoherently...
There is something I would like to know for sure, that I have never seen documented. The function Add/RemoveSoulGem

For example Player->RemoveSoulGem "winged twilight" is used in the Telvanni StrongSoulRemove script. This will remove the any soul gem that contains a winged twilight soul from the player's inventory.

But I wondered if it was possible to add a soulgem with a soul in it to the player's inventory...so I played around with console commands in game, and found that this worked!

CODE
Player->AddSoulGem "winged twilight" "misc_soulgem_grand"


I found this out after testing several variations and it kept telling me it needed a second ID, so I figured, one ID has to be soul the gem contains and the other has to be the soul gem itself. It only works in the order specified above. I typed that into the console, and behold! a soulgem with a winged twilight soul appeared in my inventory.

Again, I have never ever seen this documented anywhere. I may have missed it somewhere, but I thought I'd share it just in case it hasn't been documented before. This function is really useful! And really hidden...and the next step is to find out if it works in a dialogue result or in a script, and not just the console.
QUOTE(Stuporstar @ Oct 4 2007, 01:00 AM) *
There is something I would like to know for sure, that I have never seen documented. The function Add/RemoveSoulGem


SFD 8, pp.108-109: "Checking and managing souls and soulgems"
QUOTE(DinkumThinkum @ Oct 4 2007, 05:47 PM) *
SFD 8, pp.108-109: "Checking and managing souls and soulgems"


Heh, good thing I asked. I totally missed that in SFD8. Well, at least I figured it out when I actually needed it. smile.gif
this ever get completed?
QUOTE(HeyYou @ Sep 25 2007, 07:04 PM) *
Is there a download link for this anywhere?

Latest Version:
[Link Removed]

I just need to work out how to do an index and table of contents
QUOTE(Yacoby @ Nov 1 2007, 09:08 AM) *
Latest Version:
http://www.yacoby.net/es/upload/?action=download&id=84

I just need to work out how to do an index and table of contents



Thank You.
awesome yacoby!
Nice foodndrink.gif
Slight update...
[Link Removed]
Added some stuff by TunaandCheese and ran a spellcheck on 200+ pages (Ug, not doing that again)


Anyone got any comments or suggestions? It is going to get called done soon smile.gif


Update (again):
[Link Removed]
QUOTE(Yacoby @ Nov 12 2007, 04:46 PM) *


Well on a quick run thru its is LOOKING GREAT foodndrink.gif I think the screen shots are really clearer and well it seems great
how long do we have or should I say what is required from us 'proofreaders' would you like feedback on stuff or is genrally the last pass ??

Great - Fantastic - lot of hard work - not going to waste ... foodndrink.gif intergalactic.gif bubbly.gif
QUOTE(exclusiveor77 @ Nov 12 2007, 04:29 PM) *
how long do we have or should I say what is required from us 'proofreaders' would you like feedback on stuff or is genrally the last pass ??

Feedback on stuff would be very good, although it is getting close to the last pass, perfect as possible is the way to go.


Before I release it, I really want to get in touch with melian, but she doesn't seem to be arround, which gives me more time shrug.gif



OK sondsz good I'll give it a rough going over to see if there is anything that sticks out - -ve response mode smile.gif - no post then I didn't spot anything ... but it looks great ...
Question - has any progress been made into the "undocumented" GMSTs? I'm specifically looking into things like the multipliers that are applied to enchanting and alchemy...
plans on pdf version?
Dear authors,

Thank you very much for this great work!

I have some questions/remarks:

When you are describing a certain function it would be easier for the reader if you specify in a special paragraph what types of actors this function designed to work with. Descriptions like that “The following functions do not work on the player, NPCs or monsters.” (than another 100 pages of detailed text) are not very clear IMHO.

Have you ever succeeded in using PlayGroup/LoopGroup functions with NPCs?
These function calls corrupt animations and this is not only d40 my observation.


smile.gif
QUOTE(Alphax @ Nov 20 2007, 04:35 PM) *
Question - has any progress been made into the "undocumented" GMSTs? I'm specifically looking into things like the multipliers that are applied to enchanting and alchemy...

Not much, I think only iAlchemyMod for alchemy and nothing for enchant, mostly the new info on GMSTs is for pickpocketing. If you have any new info I'm sure it would be useful.

QUOTE(pc_gamer @ Nov 21 2007, 09:54 AM) *
plans on pdf version?

Yes, there'll be a PDF version. I believe there's going to be an HTML version this time too.

QUOTE(A1x2e3l @ Nov 21 2007, 12:03 PM) *
When you are describing a certain function it would be easier for the reader if you specify in a special paragraph what types of actors this function designed to work with.

We've sort of got that, as much as possible... most of the new info added is the bugs, unexpected behaviour, workarounds, etc. It's certainly not perfect, but to make it really clear the whole document would have to be more or less rewritten, which would take forever. That's the problem with adding new info instead of rewriting the original: it gets messy very quickly. Most of the messier sections have been rewritten though.
Closed per OP request.
Submit a Thread