Jump to content

Recommended Posts

Guest tomm434
IsWaiting is a vanilla function xsmile.png.pagespeed.ic.5Yux4gu5_h.png

wow I didn't even know this function before you told me. Seems risky to use for me. But I think that compiler should pick this up - it compiles only with "let"

 

Why do you keep prefixing your ints with $ when outputting them with print ?

 

Well, I didn't know "Print" existed before I saw Odessa's debug script. Before I used "PrintC". But simple "Print" is more convenient.

Link to comment

@AJ: There is a function to suppress NVSE errors actually: From nvse_whatsnew.txt:

 

 

 

testexpr            (did I test that one ? Can't remember :) )

 

From OBSE docs:

 

 

TestExpr - attempts to evaluate an expression, returning false if an error occurs during evaluation and true otherwise. This can be useful when checking if an array index is out of bounds or if an element exists with a given key, among other things. TestExpr suppresses the output of error messages to the console and log file.
(bool) TestExpr expr

Example:

[code]array_var arraylet array := ar_Construct Arrayif testexpr (array[5] := 2)	PrintC "5 is a valid index, assignment succeeded."else	PrintC "Index 5 is out of bounds, no assignment."endiflet array := ar_Construct StringMapif testexpr (array["INDEX"])	PrintC "An element exists in array with key 'INDEX'"else	PrintC "No element with the specified key exists."endif

[/code]

 

 

 

 

 

 

 

So it returns false if an NVSE error is generated (and suppresses it), else true. I guess you might use it instead of bothering to check if a key exists, like try/except in some languages:

    if TestExpr MyMapArray[someKey] += 1 ; * increment entry if it exists already

    else

        let MyMapArray[someKey] := 1 ; * else create it at 1

    endif

 

Or to write pretentious 1-line loops:

    while TestExpr MyArray[iKey+=1] += 1

    loop

Link to comment

So, V4.1 added this function:

 

RunScript

 

It is not documented apart from name in nvse_whatsnew, and is not mentioned in the OBSE docs. The GECK compiler throws an error unless you pass it an inventory item base form, like "RunScript Vodka". I haven't tested it in game.

 

What does it do?

Link to comment

It requires a parameter which is a form containing a script.

 

If the script is found it will be run, as in added to the list of active scripts. This should let you start a script that is not attached to any reference. As far as I know, the script will keep running until it crashes.

Link to comment

Those that are implemented using the ScriptForm form. That includes, actors, activators, Inventory Items, Containers, Doors, Lights, Item Mod, Quest, Armor AddOn,

 

Spells and effects should logically work too, but they are not sufficiently decoded to guaranty it.

 

Link to comment

@AJ: There is a function to suppress NVSE errors actually

 

I was hoping in something more... easier, something like "DontShowMeErrorsOnConsoleForThatMod", better with a shortcut like DSME... I can't even get the OBSE example -_-

Link to comment

News from the front: :)

 

I think Odessa's issue should be fixed in the upcoming version. Turned out to a concurrency issue when using too many strings/arrays in loops.

 

@A.J. the logic behind those messages is to allow end users to report bugs to mod author. If you routinely generate those error with "non bugged" code, please upload a sample.

 

Link to comment
 
If you routinely generate those error with "non bugged" code, please upload a sample.

 

It's not really "not bugged", they do good, but I don't need them in these cases.

 

I noticed Get functions return an error on console when the ref doesn't exist.

 

For example, I have a script that checks all the slots for equipped object but it spams an error if there's nothing in the slot. I don't need it, I'm actually checking what is equipped.

 

Another example, I have a script that spawns a creature with PlaceAtMe and then executes the code on its ref. It needs "some time" to be spawned, so the script will constantly check with If GetType 43 when the creature is really spawned. But in the meantime, for some frames, it returns a error on console of course, it's the time the creature needs to be spawned.

 

They do good, they are right to notify the error, but I'm aware of those errors and I find it's normal, that's why I wanted to remove them, because I guess if all the mods work in this way all togheter it would be impossible to track down "real" errors in console

 

@Odessa thank you I'll check it :)

Link to comment

RunScript does not appear to work.

 

I have the following object script attached to a misc item:

 

 

 

scn nvserunscript

ref rMe
float fTimer

Begin GameMode

    if fTimer > 0
        let fTimer -= GetSecondsPassed
        return
    endif

    let fTimer := 2

    let rMe := GetCurrentScript
    Print "Runscript GameMode " + $rMe
    Print "or " + (GetFormIDString rMe)

End

 

 

 

RunScript nvsetestToken

 

Does not appear to do anything. If I instead additem the token, the script runs as expected.

 

Note: I only tested it for documentation purposes, so take this as informational not as a request to have it fixed, if it is broken.

Link to comment

The function IsPlayable is broken, and appears to return 1 to everything.

 

For example:

 

 

   Print "Testing IsPlayable AmmoCompanion"
   let iInt := IsPlayable AmmoCompanion
   Print "Returned: " + $iInt

   Print "Testing IsPlayable WeapKnifeCombatCass"
   let iInt := IsPlayable WeapKnifeCombatCass
   Print "Returned: " + $iInt

   Print "Testing IsPlayable Weap10mmPistol"
   let iInt := IsPlayable Weap10mmPistol
   Print "Returned: " + $iInt

Testing IsPlayable AmmoCompanion
Returned: 1
Testing IsPlayable WeapKnifeCombatCass
Returned: 1
Testing IsPlayable Weap10mmPistol
Returned: 1

 

 

 

EDIT: Actually, IsPlayable just only works for armor (see below). I have tested it for this and it works correctly

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use