[RELz] Oblivion Script Extender (OBSE) 0020

Post » Wed Mar 30, 2011 12:43 pm

Dude, I can all but guarantee that neither you nor anyone you have ever known has ever had any real, noticeable slowdown due to scripts. They just don't even register compared to the graphical and AI needs that Oblivion has. You seriously need to calm down about that. Unless you're doing absurdly stupid looping, you're never going to degrade anyone's performance ever. We have tested this. It took something like 15,000 concurrent object scripts running a bunch of IF/ELSEIF/ENDIF blocks to start knocking down framerate, IIRC. It's seriously stupid number of scripts.

Plus, the testing showed something of a "brick wall" effect — if you really are overdoing it with scripts, your FPS drops like a stone, making it almost impossible to do accidentally if you're doing any testing at all.

Asking Scruggs to do a lot of unnecessary work because you have some idiosyncrasies about how code "should be written" is honestly just rude.
User avatar
DAVId Bryant
 
Posts: 3366
Joined: Wed Nov 14, 2007 11:41 pm

Post » Wed Mar 30, 2011 5:02 am

:obliviongate:
User avatar
Kortknee Bell
 
Posts: 3345
Joined: Tue Jan 30, 2007 5:05 pm

Post » Wed Mar 30, 2011 10:12 am

A few suggestions for OBSE 21:

  • OnJump Event (check for player jumping);
  • SetDayOfWeek (set the day of week, much like GetDayOfWeek);
  • ResetContainer (force a container to reset its contents);
  • Double variable (for dealing with bigger numbers).


Thanks in advance.
User avatar
JLG
 
Posts: 3364
Joined: Fri Oct 19, 2007 7:42 pm

Post » Wed Mar 30, 2011 8:57 am

How about a function to get he number of uses an enchanted weapon has........ would make my life a lot easier.
User avatar
Dina Boudreau
 
Posts: 3410
Joined: Thu Jan 04, 2007 10:59 pm

Post » Wed Mar 30, 2011 7:01 am

A few suggestions for OBSE 21:

  • OnJump Event (check for player jumping);
  • SetDayOfWeek (set the day of week, much like GetDayOfWeek);
  • ResetContainer (force a container to reset its contents);
  • Double variable (for dealing with bigger numbers).


Thanks in advance.
> A gamemode script that checks if the jump control key has been pressed ?
> Directly modify the appropriate time global variable ? Or is SetDayOfWeek supposed to do something else ?
User avatar
Nicole Coucopoulos
 
Posts: 3484
Joined: Fri Feb 23, 2007 4:09 am

Post » Wed Mar 30, 2011 1:48 am

Hi folks.

I seem to be having some trouble with GetEnchantmentCost. It continually returns Zero.... which makes the later division by it kill the script... The code in question:

let temp2 := ( getobjectcharge object )
let temp3 := ( getenchantmentcost object )
Printc "AM- charge %0f Cost %0f" temp2 temp3
set quantity to ( temp2 / temp3 )
printc "AM- Quantity %0f" quantity

Get object charge works fine. GEC.... doesn't.... the object is a cloned bow, if that matters.


I think that's due to an error in the docs about http://cs.elderscrolls.com/constwiki/index.php/GetEnchantmentCost using the Enchantment as parameter, not the enchanted object.
Try using
ref enchint costlet ench := getenchantment objectlet cost := getenchantmentcost ench

User avatar
jessica robson
 
Posts: 3436
Joined: Mon Oct 09, 2006 11:54 am

Post » Tue Mar 29, 2011 11:01 pm

I think that's due to an error in the docs about http://cs.elderscrolls.com/constwiki/index.php/GetEnchantmentCost using the Enchantment as parameter, not the enchanted object.
Try using
ref enchint costlet ench := getenchantment objectlet cost := getenchantmentcost ench



OOooo. Thank you, makes good sense. I will give that a shot. :D
User avatar
zoe
 
Posts: 3298
Joined: Sun Nov 12, 2006 1:09 pm

Post » Wed Mar 30, 2011 12:45 pm

> A gamemode script that checks if the jump control key has been pressed ?
> Directly modify the appropriate time global variable ? Or is SetDayOfWeek supposed to do something else ?


I'm using a script for jumping now, but would prefer a jumping event. Would be much cleaner imo.

I'm not aware of any global variable you would be able to set to change the value returned by GetDayOfWeek. It's a value (1-7) linking to the name of the day displayed in-game.
User avatar
jesse villaneda
 
Posts: 3359
Joined: Wed Aug 08, 2007 1:37 pm

Post » Tue Mar 29, 2011 10:43 pm

I think that's due to an error in the docs about http://cs.elderscrolls.com/constwiki/index.php/GetEnchantmentCost using the Enchantment as parameter, not the enchanted object.
Try using
ref enchint costlet ench := getenchantment objectlet cost := getenchantmentcost ench



Update.

IT WORKED!!! Thank You VERY much. :celebration:
User avatar
Danii Brown
 
Posts: 3337
Joined: Tue Aug 22, 2006 7:13 am

Post » Wed Mar 30, 2011 4:18 am

I'm not aware of any global variable you would be able to set to change the value returned by GetDayOfWeek. It's a value (1-7) linking to the name of the day displayed in-game.
As it happens I just spent some time looking into the 'time globals' (no pun intended :P) and GetDayOfWeek doesn't do anything particular. Or rather, the 'day of the week' isn't a unique value at all. Each time it is needed the game calculates it based on the hardcoded start and length of the ingame months vs based on just GameDaysPassed (simply % 7).

EDIT: In case scruggy finds it useful, the appropriate function for this calculation is at 0x00402C40.
User avatar
Dan Stevens
 
Posts: 3429
Joined: Thu Jun 14, 2007 5:00 pm

Post » Wed Mar 30, 2011 1:55 am

As it happens I just spent some time looking into the 'time globals' (no pun intended :P) and GetDayOfWeek doesn't do anything particular. Or rather, the 'day of the week' isn't a unique value at all. Each time it is needed the game calculates it based on the hardcoded start and length of the ingame months vs GameDaysPassed.

EDIT: In case scruggy finds it useful, the appropriate function for this calculation is at 0x00402C40.


That does make it a little more difficult (impossible?). Anyway, if at all possible, I would like to be able to do something like ''SetDayOfWeek 1'' and that way have the day display as ''Sundas'' in-game.
User avatar
Deon Knight
 
Posts: 3363
Joined: Thu Sep 13, 2007 1:44 am

Post » Wed Mar 30, 2011 5:37 am

That does make it a little more difficult (impossible?). Anyway, if at all possible, I would like to be able to do something like ''SetDayOfWeek 1'' and that way have the day display as ''Sundas'' in-game.
Actually it would be very simple, just a single hook at the address I mentioned should take care of everything. And the 'DayOfWeek' is only used for display purposes so the chance of it somehow messing up the game a next to none. :)
User avatar
Rob
 
Posts: 3448
Joined: Fri Jul 13, 2007 12:26 am

Post » Wed Mar 30, 2011 4:28 am

Actually it would be very simple, just a single hook at the address I mentioned should take care of everything. And the 'DayOfWeek' is only used for display purposes so the chance of it somehow messing up the game a next to none. :)


(Noob question) And it won't mess up NPC's AI when they're set up to do tasks in certain days of the week?
User avatar
Jennifer Munroe
 
Posts: 3411
Joined: Sun Aug 26, 2007 12:57 am

Post » Wed Mar 30, 2011 12:32 pm

Scruggs, congrats again on 20.

GuruSR.
User avatar
Rich O'Brien
 
Posts: 3381
Joined: Thu Jun 14, 2007 3:53 am

Post » Wed Mar 30, 2011 2:12 am

That does make it a little more difficult (impossible?). Anyway, if at all possible, I would like to be able to do something like ''SetDayOfWeek 1'' and that way have the day display as ''Sundas'' in-game.

Since, as Kyoma figured it out, it is calculated from GameDaysPassed, you can manipulate GameDaysPassed to set the day that will be the desired day of the week (let GameDaysPassed += x). Problem is that GameDay-Month-Year are not synchronized automatically by the engine, so you would need to adjust those too.

But messing with GameDaysPassed may break other mods (unless, of course, your needs allows for changing it and restoring it in the same script/same frame).
User avatar
REVLUTIN
 
Posts: 3498
Joined: Tue Dec 26, 2006 8:44 pm

Post » Wed Mar 30, 2011 4:12 am

First of all thanks for all the great additions in OBSE 20. I am really impressed by the new expressions extension for all commands. I love how you are creating functions and making them reduce code and make it reusable. Very slick and intuitive to use. Thanks.

Now that I have played with animations a bit using the new playidle command I got a idea that I hope you could explore for a future version of OBSE. I like the event system you have. What I was wondering is if there is a way to trigger events on animation events like the Sound event or any of the animation events. It would probably need to provide the actor, the animation sequence, and the time of the event in the animation. This could be a great way to do custom attack sequences, spell sequences, etc. It looks like you already have a tie in to some of those events and I was hoping this could be explored a little further.

Thanks for making scripting in Oblivion actually fun.
User avatar
Talitha Kukk
 
Posts: 3477
Joined: Sun Oct 08, 2006 1:14 am

Post » Wed Mar 30, 2011 7:37 am

Could there be an OBSE command that detects an animation's duration?

Like,

GetCurrentAnimationTotalDuration

so for example: If I could detect that the custom power attack animation being used is .5 seconds long
then in most cases at .25 time passed that would tell me that the attack climixed (more or less).

Just wondering if that is in the power of OBSE.
User avatar
Austin England
 
Posts: 3528
Joined: Thu Oct 11, 2007 7:16 pm

Post » Wed Mar 30, 2011 9:49 am

Could there be an OBSE command that detects an animation's duration?

Like,

GetCurrentAnimationTotalDuration

so for example: If I could detect that the custom power attack animation being used is .5 seconds long
then in most cases at .25 time passed that would tell me that the attack climixed (more or less).

Just wondering if that is in the power of OBSE.

Not that I have seen. There is an OnHit and OnHitWith event that can be used to determine if an attack landed.

OnHit	target:ref attacker:refOnHitWith	target:ref weapon:form

User avatar
Laura Wilson
 
Posts: 3445
Joined: Thu Oct 05, 2006 3:57 pm

Post » Tue Mar 29, 2011 11:53 pm

I don't know if you accept addition suggestions to obse, but is there ANY way you could add something for me?

An OnGameStart or OnSaveGameStart event handler.

It would begin the moment any savegame is started.

Here is an example:

////////////////////////////////////////////////////////////////////////////

Begin OnGameStart

set timer to 100
set DoOnce to 0

end

Begin Gamemode

set timer to timer - getsecondspassed

if (timer <= 0)

if (DoOnce == 0)

player.additem Cake 5
set DoOnce to 1

Endif

Endif

End

////////////////////////////////////////////////////////////////////////////

So this script would essentially give you 5 Cake, 100 seconds after each time you start the game.

Is there ANY way you add that to obse in the near future? It would help with the creation of my mod so very much.

What I need this event handler for is this problem:

http://bit.ly/fCGjzv

Perhaps you have a solution to this, other than an all new event handler?

Thanks!
User avatar
ShOrty
 
Posts: 3392
Joined: Sun Jul 02, 2006 8:15 pm

Post » Wed Mar 30, 2011 8:32 am

You could use the http://cs.elderscrolls.com/constwiki/index.php/GetGameLoaded function for a condition check in game mode. It should return true once after the game was loaded, and as far as I remember since OBSE 0020 it now also returns true for when a new game was started.
User avatar
Eileen Collinson
 
Posts: 3208
Joined: Thu Dec 28, 2006 2:42 am

Post » Wed Mar 30, 2011 8:09 am

err.. no I meant could the OBSE team add it or is it not in the realm of possible with OBSE.

Knowing when the attack landed is not valuable in this case unless the mod some how could know how long the animation duration was from the first time "isattacking" return true.

Is attacking can be anywhere from standing still (just at begin of the attack animation) to just about to stand still way after the "peek" of the attack is over.
So for example there is no good way to know when an actor should "duck" when the opponent is power attacking.

I can "fake it" with various scripting tricks (I have done so in many of my mods) but knowing the duration of that attack animations would be much better and would also give other clues to the script. For example I would like to speed up an attack at the beginning and slow it down after the peek. A war hammer in oblivion if you slow it down to a more realistic total duration now swings too slow at the beginning and too fast after the peek of the attack (the recovery time). One way I could fix this (other than recreating all the animations themselves) if I could detect how long the animation was for both vanilla and custom animations.

Maybe it would be even better if OBSE could read the animation file to get all the interesting informations from it such as total duration, the peek time, the sound connected to it, the priority it has....stuff like that.

But I realize this may be too much to ask for from OBSE.


Not that I have seen. There is an OnHit and OnHitWith event that can be used to determine if an attack landed.


User avatar
CYCO JO-NATE
 
Posts: 3431
Joined: Fri Sep 21, 2007 12:41 pm

Post » Wed Mar 30, 2011 12:50 pm

I can't speak for the OBSE team on this, but if you are talking about detecting the duration of an animation sequence in a NIF, then you might want to look at NifSE. I don't think it has anything like that now, but you might want to ask in the NifSE thread, if you think something like that would help.
User avatar
Mandy Muir
 
Posts: 3307
Joined: Wed Jan 24, 2007 4:38 pm

Post » Wed Mar 30, 2011 11:37 am

A few suggestions for OBSE 21:

  • OnJump Event (check for player jumping);
  • SetDayOfWeek (set the day of week, much like GetDayOfWeek);
  • ResetContainer (force a container to reset its contents);
  • Double variable (for dealing with bigger numbers).


Thanks in advance.

Most of these look doable.
SetDayOfWeek has potential issues mentioned by kyoma and others. Do you simply want to change the name of the day as displayed in the game, or do you need actors to behave as if the day of week had actually changed?
Script variables actually are stored as double-precision floats already (so are array elements). However some of the game code converts them to single-precision values when operating on them - for example, when you pass a float as a command argument it is extracted as a single-precision value. Are there specific circumstances under which you need double precision?
What I was wondering is if there is a way to trigger events on animation events like the Sound event or any of the animation events. It would probably need to provide the actor, the animation sequence, and the time of the event in the animation. This could be a great way to do custom attack sequences, spell sequences, etc. It looks like you already have a tie in to some of those events and I was hoping this could be explored a little further.

Probably.
I don't know if you accept addition suggestions to obse, but is there ANY way you could add something for me?

An OnGameStart or OnSaveGameStart event handler.

We have LoadGame, SaveGame, and OnNewGame events - will those do the trick?
err.. no I meant could the OBSE team add it or is it not in the realm of possible with OBSE.

Knowing when the attack landed is not valuable in this case unless the mod some how could know how long the animation duration was from the first time "isattacking" return true.

Is attacking can be anywhere from standing still (just at begin of the attack animation) to just about to stand still way after the "peek" of the attack is over.
So for example there is no good way to know when an actor should "duck" when the opponent is power attacking.

I can "fake it" with various scripting tricks (I have done so in many of my mods) but knowing the duration of that attack animations would be much better and would also give other clues to the script. For example I would like to speed up an attack at the beginning and slow it down after the peek. A war hammer in oblivion if you slow it down to a more realistic total duration now swings too slow at the beginning and too fast after the peek of the attack (the recovery time). One way I could fix this (other than recreating all the animations themselves) if I could detect how long the animation was for both vanilla and custom animations.

Maybe it would be even better if OBSE could read the animation file to get all the interesting informations from it such as total duration, the peek time, the sound connected to it, the priority it has....stuff like that.

But I realize this may be too much to ask for from OBSE.

We have access to this info for loaded animations, some of which we've already decoded. We can get the game to load an animation from disk as well - do you expect to need that, or will you be working with animations that are already in use?
User avatar
IsAiah AkA figgy
 
Posts: 3398
Joined: Tue Oct 09, 2007 7:43 am

Post » Wed Mar 30, 2011 1:55 am

Scruggs, judging by your response to my PM, I don't think you understood what I was asking, I'm way beyond anything you mentioned, I've got a good portion of the game decoded, and under my control, you should check your PMs, I responded with a lot of info about what I've done, and what I'm trying to do.
User avatar
Jessica Stokes
 
Posts: 3315
Joined: Fri Jul 28, 2006 11:01 am

Post » Wed Mar 30, 2011 6:06 am

Most of these look doable.
SetDayOfWeek has potential issues mentioned by kyoma and others. Do you simply want to change the name of the day as displayed in the game, or do you need actors to behave as if the day of week had actually changed?
Script variables actually are stored as double-precision floats already (so are array elements). However some of the game code converts them to single-precision values when operating on them - for example, when you pass a float as a command argument it is extracted as a single-precision value. Are there specific circumstances under which you need double precision?


I'm just after the correct name being displayed. Currently I'm changing all the strings directly (sDayFredas, sDayLoredas , etc.), but as some mods change these values also, it's not very compatible.

Concerning the double variable, I rechecked my mod and am able to do without it. So, not really a priority after all.
User avatar
Taylor Thompson
 
Posts: 3350
Joined: Fri Nov 16, 2007 5:19 am

PreviousNext

Return to IV - Oblivion