[BETA] Oblivion Script Extender (OBSE) v0018

Post » Fri May 27, 2011 12:23 pm

Yes, with the latest functions in http://tesnexus.com/downloads/file.php?id=23979
FromOBSE (STILL IN DEV PHASE !!!) (alt: FromOBSEString)Imports an OBSE string to a Pluggy string.Note that this is preferable to "SetString PluggyStringID $OBSEStringVar", as that method has a 256 character limit.		   FromOBSE <PluggyStringID:long> <OBSEString:long> <Global:long>

ToOBSE (STILL IN DEV PHASE !!!) (alt: ToOBSEString)Exports a Pluggy string to an OBSE string.Note that you must use Set instead of Let - i.e., "Set sOBSEvar to ToOBSE PluggyStringID".		   (OBSEStringID:short) ToOBSE <StringID:long>

Thank you.
User avatar
Tinkerbells
 
Posts: 3432
Joined: Sat Jun 24, 2006 10:22 pm

Post » Fri May 27, 2011 4:18 am

Any chance of removing the string echo to the console when sv_Construct or sv_Set are used from batch scripts?
User avatar
Syaza Ramali
 
Posts: 3466
Joined: Wed Jan 24, 2007 10:46 am

Post » Thu May 26, 2011 10:55 pm

Got converting a Pluggy string to an OBSE string working.

However
set PTemp to FromOBSE S
gives 'Missing parameter OBSEid'

I know FromOBSE is 'STILL IN DEV PHASE', but anyone got it to work?
User avatar
Kevin S
 
Posts: 3457
Joined: Sat Aug 11, 2007 12:50 pm

Post » Fri May 27, 2011 10:45 am

Got converting a Pluggy string to an OBSE string working.

However
set PTemp to FromOBSE S
gives 'Missing parameter OBSEid'

I know FromOBSE is 'STILL IN DEV PHASE', but anyone got it to work?
FromOBSE has a different syntax than ToOBSE:
FromOBSE PluggyStringID OBSEStringVar

User avatar
elliot mudd
 
Posts: 3426
Joined: Wed May 09, 2007 8:56 am

Post » Fri May 27, 2011 7:48 am

:facepalm:
User avatar
Natasha Biss
 
Posts: 3491
Joined: Mon Jul 10, 2006 8:47 am

Post » Fri May 27, 2011 5:09 am

:facepalm:
Don't feel bad, I still have a little copy-paste of those two functions from the Pluggy docs at the top of most of my scripts. I always forget how the exact syntax is. :P
User avatar
Lisa Robb
 
Posts: 3542
Joined: Mon Nov 27, 2006 9:13 pm

Post » Fri May 27, 2011 10:12 am

Any chance of removing the string echo to the console when sv_Construct or sv_Set are used from batch scripts?
+1

Better off in just the debug build.

Bug report repost - Let allows using ;= as an operator.
User avatar
Kate Schofield
 
Posts: 3556
Joined: Mon Sep 18, 2006 11:58 am

Post » Fri May 27, 2011 12:35 am

Put me out of my misery and tell me honestly....does cloneform work at all with statics?
User avatar
SiLa
 
Posts: 3447
Joined: Tue Jun 13, 2006 7:52 am

Post » Fri May 27, 2011 8:00 am

Quick question: What would happen if I called DeleteReference on an object to which the object script was attached to, like:

scn ANRLVarlaStoneLightScriptBegin OnActivate playerdisableDeleteReferenceplayer.AddItem VarlaStone 1End


Since I've just removed what the script is running on, will the player.additem line not run, or will the script terminate on completion?

I have not tested this. I will if you don't.
FYI, at least one frame must pass between the call to Disable and the call to DeleteReference. The ref must be disabled at the time deleteReference is called, and disable doesn't kick in until the next frame at the earliest.
More specifically the ref is queued for disabling and not actually disabled until the task manager gets around to doing so - generally the next frame but not guaranteed.
DeleteReference operates similarly (as do other commands like PlaceAtMe, RemoveMe, etc); in general you should structure your script with a state variable rather than rely on frame counting e.g.
scn ANRLVarlaStoneLightScriptshort state; 1=disabled 2=deletedbegin gamemode  if state == 2	return  elseif state == 1	if GetDisabled	  DeleteReference	  set state to 2	  return	endif  endifendBegin OnActivate player  player.AddItem VarlaStone 1  disable  set state to 1End

Did some testing on optional arguments - Didn't see any screw ups. The local variable that stores the argument remains uninitialized and the function doesn't have any issues with that. In essence, un-passed (leading) arguments practically pass 0 to the function.

Any chance of proper support in 18 Final ?

I assume you are using a ref variable as a function pointer to get around the compiler complaining about missing arguments?
Don't rely on this behavior, please. It is not supported.
Optional function arguments won't be present in 0018 final. When they are supported you'll be allowed to specify default values rather than defaulting to zero.
GetBookSkillTaught can only be used with base objects, despite what the docs claim?

Let b := r.GetBaseObjectPrint "Skill: " + $GetBookSkillTaught b

is fine, but this isn't :

Print "Skill: " + $r.GetBookSkillTaught

EDIT:
From the Command Doc:

I'm only seeing the correct result in an if eval with -1.

Docs are wrong, GetBookSkillTaught returns -1.
What does your second Print statement actually print?
Any chance of removing the string echo to the console when sv_Construct or sv_Set are used from batch scripts?

Sure.
Bug report repost - Let allows using ;= as an operator.

Semicolon is indicating a comment, the rest of the line is ignored. It probably sneaks by the compiler by luck (last byte of your expression happens to be equivalent to an assignment operator opcode).
Put me out of my misery and tell me honestly....does cloneform work at all with statics?

It ought to. What's wrong?
User avatar
A Boy called Marilyn
 
Posts: 3391
Joined: Sat May 26, 2007 7:17 am

Post » Fri May 27, 2011 5:27 am

Back on the beat, eh ? Nice :thumbsup:

I assume you are using a ref variable as a function pointer to get around the compiler complaining about missing arguments?
Don't rely on this behavior, please. It is not supported.
Optional function arguments won't be present in 0018 final. When they are supported you'll be allowed to specify default values rather than defaulting to zero.
Yes. I guess I misread the documentation ( confused it with the usual convention followed when using a script as a function argument ).

I'm writing a new function for ConScribe that allows per-script logs. How do I extract the function's calling script's formID (or name if possible) ?

EDIT : Repost from the previous thread :
. Are arrays referenced when passed as function arguments ?
. Does array manipulation inside an iterator to the same invalidate it (the iterator) ?
User avatar
Robyn Lena
 
Posts: 3338
Joined: Mon Jan 01, 2007 6:17 am

Post » Fri May 27, 2011 4:39 am

It ought to. What's wrong?
I think I actually asked the wrong question. I was trying to have a script on an object cloneform a static item, then move the cloneform to the object and position it precisely.

set refid to cloneform objectid
refid.setpos x xpos
refid.setpos y ypos

Nothing was appearing, but instead my object was sinking a little further into the ground each time I tried it. I found out the sinking was because the "refid.setpos" commands were defaulting to the object because the refid wasn't valid. I was able to use showvars to determine that the cloneform was being created, but apparently when I thought I was giving it a RefID it was instead being used as a new ObjectID for the cloneform, hence the reference in my script was never getting set for anything and wasn't valid.

I couldn't figure out how to get the cloneform to appear in my objects worldspace as a reference that I could manipulate, but I may have found something else.

If I use placeat me in this case like this:

set refid to placeatme objectid
refid.setpos x xpos
refid.setpos y ypos

That seems to work okay. Now, placeatme is listed as problematic, but I wanted to use cloneform specifically to have the created item stored in the savegame so that it would also store modelpath changes, so I don't think this is any worse.

The question is: Does using placeatme in this way accomplish the same thing as making a cloneform and moving to my object? Or am I missing a huge fault.

edit: wait, I think I answered my own question...setmodelpath changes the base object, so does setmalegroundpath also change the base object? If it does, then I'm going to have to cloneform the item and then use placeatme on the cloneform to place the reference. That'll double the items stored in the savegame. That's a bit worrying as I'm thinking this will likely lead to hundreds fo cloneformed and/or placeatme items.
User avatar
Chloe Botham
 
Posts: 3537
Joined: Wed Aug 30, 2006 12:11 am

Post » Fri May 27, 2011 10:58 am

Back on the beat, eh ? Nice :thumbsup:

Yes. I guess I misread the documentation ( confused it with the usual convention followed when using a script as a function argument ).

I'm writing a new function for ConScribe that allows per-script logs. How do I extract the function's calling script's formID (or name if possible) ?

EDIT : Repost from the previous thread :
. Are arrays referenced when passed as function arguments ?
. Does array manipulation inside an iterator to the same invalidate it (the iterator) ?

From within a Cmd_Execute handler, scriptObj->refID is the formID of the calling script. Script names are not accessible at run-time.

Arrays are referenced when passed as function args. The function script cleans up those references when it returns.

The way to invalidate a foreach iterator is like this:
foreach iter <- arr  ar_erase arr iter[key]loop

In other words, don't remove the element currently pointed to by the iterator. Removing other elements or adding new elements is fine.
The limitation is there mainly for behind-the-scenes efficiency.
I think I actually asked the wrong question. I was trying to have a script on an object cloneform a static item, then move the cloneform to the object and position it precisely.

set refid to cloneform objectid
refid.setpos x xpos
refid.setpos y ypos

Nothing was appearing, but instead my object was sinking a little further into the ground each time I tried it. I found out the sinking was because the "refid.setpos" commands were defaulting to the object because the refid wasn't valid. I was able to use showvars to determine that the cloneform was being created, but apparently when I thought I was giving it a RefID it was instead being used as a new ObjectID for the cloneform, hence the reference in my script was never getting set for anything and wasn't valid.

I couldn't figure out how to get the cloneform to appear in my objects worldspace as a reference that I could manipulate, but I may have found something else.

If I use placeat me in this case like this:

set refid to placeatme objectid
refid.setpos x xpos
refid.setpos y ypos

That seems to work okay. Now, placeatme is listed as problematic, but I wanted to use cloneform specifically to have the created item stored in the savegame so that it would also store modelpath changes, so I don't think this is any worse.

The question is: Does using placeatme in this way accomplish the same thing as making a cloneform and moving to my object? Or am I missing a huge fault.

What you're missing is that cloneform clones base objects, not references. PlaceAtMe references, like cloneform'ed objects, are stored in the savegame. However model path functions operate on the base object, not the reference, so placeAtMe alone will not give you the desired behavior.
set cloneID to cloneForm objectID; is a base objectset refID to playerAtMe cloneID; refID is a reference to cloned formrefID.setPos x xpos; and so on

User avatar
ladyflames
 
Posts: 3355
Joined: Sat Nov 25, 2006 9:45 am

Post » Fri May 27, 2011 9:20 am

What you're missing is that cloneform clones base objects, not references. PlaceAtMe references, like cloneform'ed objects, are stored in the savegame. However model path functions operate on the base object, not the reference, so placeAtMe alone will not give you the desired behavior.
set cloneID to cloneForm objectID; is a base objectset refID to playerAtMe cloneID; refID is a reference to cloned formrefID.setPos x xpos; and so on
Okay, so my late brain thought was right. I'm going to have to cloneform a base object first, then placeatme a reference to the cloneform. After that I can use setmalegroundpath on the reference as many times as I like without bloating the savegame any further, correct?

I think that's the only way to accomplish what I want, so if each Object is going to generate up to 16 or 17 references (32 to 34 items stored in the savegame) how many Objects can I reasonably have before I start screwing up the savegame? How much bloat is a problem?

edit: never mind that last part. That's not an OBSE question, and it's not important till I get everything else working.
User avatar
Yama Pi
 
Posts: 3384
Joined: Wed Apr 18, 2007 3:51 am

Post » Fri May 27, 2011 11:59 am

What does your second Print statement actually print?

What it should now. Must have been an issue with my code.
User avatar
OJY
 
Posts: 3462
Joined: Wed May 30, 2007 3:11 pm

Post » Fri May 27, 2011 7:48 am

Cool, thanks for the reply. :)

EDIT: My testing shows that it works fine, it takes about 3 frames for me to go from being disabled to being deleted, but there aren't any problems with that. :)
User avatar
Caroline flitcroft
 
Posts: 3412
Joined: Sat Nov 25, 2006 7:05 am

Post » Fri May 27, 2011 11:09 am

From within a Cmd_Execute handler, scriptObj->refID is the formID of the calling script. Script names are not accessible at run-time.
Ah ... keep forgetting that :facepalm: Thank you.
User avatar
Amy Smith
 
Posts: 3339
Joined: Mon Feb 05, 2007 10:04 pm

Post » Thu May 26, 2011 11:50 pm

How does "getbipedmodelpath" determine if it wants the male path or the female path?
User avatar
Setal Vara
 
Posts: 3390
Joined: Thu Nov 16, 2006 1:24 pm

Post » Fri May 27, 2011 6:29 am

How does "getbipedmodelpath" determine if it wants the male path or the female path?


From the docs http://obse.silverlock.org/obse_command_doc.html#GetBipedModelPath:
(path:string_var) reference.GetBipedModelPath bipedPathCode:short object:ref


From the docs http://obse.silverlock.org/obse_command_doc.html#Biped_Path_Codes:
Specifies icon/model paths associated with biped objects, i.e. clothing and armor	0:	Male Biped Path	1:	Female Biped Path	2:	Male Ground Path	3:	Female Ground Path

User avatar
Enie van Bied
 
Posts: 3350
Joined: Sun Apr 22, 2007 11:47 pm

Post » Fri May 27, 2011 3:29 am

Yeah, sorry about the question, I'm still having trouble understanding the format of the examples given.

Oddly, I usually spend a while looking at these things, post my question and then finally understand it just after posting the question. I think I need a fake message board to post my questions so I won't have to bother you guys.

Now I gotta test some scripting that I'm not entirely sure I understand.
User avatar
Deon Knight
 
Posts: 3363
Joined: Thu Sep 13, 2007 1:44 am

Post » Fri May 27, 2011 12:06 pm

Sometimes I really feel like I'm in over my head. Do I need a specific type of reference declared in the script to receive the GetBipedModelPath result? I had a "ref" set up, but I see where there's a "string_var" option now as well.

My information did not get passed along from one object to the next, so I'm thinking I had a mismatch in the reference types.

Now I'll go see if I can figure this out immediately after posting this message.
User avatar
Marlo Stanfield
 
Posts: 3432
Joined: Wed May 16, 2007 11:00 pm

Post » Fri May 27, 2011 9:11 am

If I'm reading this right, you'll have to figure out if the actor is Male or Female first. If it's not an actor reference then treat it as a male (0/2).

set six to actor.IsFemale --> returns 0/1
refID.GetBipedModelPath six

or,

GetBipedModelPath 0 refID, where 0 is =
0: Male Biped Path (path to the NIF file for the male or only model while worn)
1: Female Biped Path (path to the NIF file for the female model while worn)
2: Male Ground Path (path to the NIF for the male or only model when dropped)
3: Female Ground Path (path to the NIF for the female model when dropped)

User avatar
NEGRO
 
Posts: 3398
Joined: Sat Sep 01, 2007 12:14 am

Post » Fri May 27, 2011 12:25 pm

The items are all in inventory, so I should be okay just calling for the male path for now, correct?

I plan to expand it once I've got it working basically.

set jawPath to pInvObj.GetBipedModelPath 0


Is that all I need, or am I misreading the format again. The pInvObj is a reference from walking the inventory, which I copied directly from the CS wiki.

edit: Sigh....maybe I need Pluggy for strings or something. I'm way out of date and haven't been following all the feature discussions
User avatar
laila hassan
 
Posts: 3476
Joined: Mon Oct 09, 2006 2:53 pm

Post » Fri May 27, 2011 12:34 am

The items are all in inventory, so I should be okay just calling for the male path for now, correct?

I plan to expand it once I've got it working basically.

set jawPath to pInvObj.GetBipedModelPath 0


Is that all I need, or am I misreading the format again. The pInvObj is a reference from walking the inventory, which I copied directly from the CS wiki.

That will not work. You don't get a real reference from walking an inventory - you get a base object. So you should be calling:

string_var jawPathset jawPath to GetBipedModelPath 0 pInvObj

User avatar
laila hassan
 
Posts: 3476
Joined: Mon Oct 09, 2006 2:53 pm

Post » Thu May 26, 2011 11:43 pm

It's having an effect, but I'm getting the big mesh missing object on my items instead of the changed model.

Is there a way to check the model path of an item in the console? I tried "getbipedmodelpath 2" on the item, but I got an OBSE error saying that function only works in a "set" command.

The "sv" command shows the variables for the path as either a 0 or a 1. I have a recollection that that is a side effect of how you do things, but I'm still worried that I actually need to have Pluggy or that String plugin installed to make this work, but I can't find anything that verifies that.
User avatar
CHARLODDE
 
Posts: 3408
Joined: Mon Apr 23, 2007 5:33 pm

Post » Fri May 27, 2011 8:43 am

It's having an effect, but I'm getting the big mesh missing object on my items instead of the changed model.

Is there a way to check the model path of an item in the console? I tried "getbipedmodelpath 2" on the item, but I got an OBSE error saying that function only works in a "set" command.

The "sv" command shows the variables for the path as either a 0 or a 1. I have a recollection that that is a side effect of how you do things, but I'm still worried that I actually need to have Pluggy or that String plugin installed to make this work, but I can't find anything that verifies that.

Pluggy is not required and will only complicate things (Pluggy strings are not directly compatible with OBSE strings).
Please post your code. You may also want to explain what you're trying to do.
User avatar
Misty lt
 
Posts: 3400
Joined: Mon Dec 25, 2006 10:06 am

PreviousNext

Return to IV - Oblivion