Lord Valarian Posted July 24, 2012 Share Posted July 24, 2012 (edited) In OBSE 20, i'v found a number of bugs. I know how to trigger them as well. Is there anyone still working on it? Who do I private mail? Zaldiir That's who listed on the uploader. Edit: Using construction set extender 5.1 Use this on an object in game. Scriptname aaaOBSEinvtest short invPos short invCount ref pInvObj ref pCont int pObjType Begin OnActivate set pCont to GetActionRef ;get access to player's inv set invPos to 0 set invCount to pCont.GetNumItems While invPos < invCount set pInvObj to (pCont.GetInventoryObject invPos) Set pObjType to pInvObj.GetObjectType printc "%g %n %g" invPos pInvObj pObjType if (pObjType == 33) ;weapon ;printc "%g %n %g" invPos pInvObj pObjType endif set invPos to invPos + 1 Loop End All items get zero as object type.Don't use the quick edit feature it has a tendency to muck things up, always use the full editor. --Admin Thanks --LV Edited July 24, 2012 by Lord Valarian Link to comment Share on other sites More sharing options...
QQuix Posted July 24, 2012 Share Posted July 24, 2012 It is not an OBSE error. GetInventoryObject returns a Base Object and, when using Base Objects, the syntax must be "FunctionName BaseObjectRef" So to get the Object type of a Base Object you must use "Set pObjType to GetObjectType pInvObj" (and this will make your code work) If you are not comfortable with the concepts like "Base Object", "Reference", "FormID" and "EditorID", I suggest you read the Getting Started articles on the CS WIKI. Link to comment Share on other sites More sharing options...
Lord Valarian Posted July 24, 2012 Author Share Posted July 24, 2012 http://cs.elderscrolls.com/index.php/GetObjectTypehttp://obse.silverlock.org/obse_command_doc.html This where I got the instructions from. They are confusing. You/someone needs to add examples to the docs. Thanks for the tip. I need to go through the players inv, filter, check, then alter data. I need an accurate count of actual number of items. Same baseid different items. Two swords, two different damage values. Getnumitems get unique items, but not the actual item count? Link to comment Share on other sites More sharing options...
QQuix Posted July 25, 2012 Share Posted July 25, 2012 Read the Function Syntax Format section of the OBSE doc. Basically, what it says is when you encounter a function with a syntax: "reference.FunctionName objectID:ref", you can either call it on a reference (MyRef.GetName) or on a base object (GetName MyRef)Example: Ref MyRef String_var s Let Myref = ArenaFan1 ;(the EditorID of the base object) Let s := GetName MyRef Print $s ; Prints "Adoring Fan" Let MyRef := ArenaFan1Ref ;(the EditorID of the reference) Let s := MyRef.GetName Print $s ; also prints "Adoring Fan" As for counting items, GetItemCount is what you need. Using your example above: set invPos to 0 set invCount to pCont.GetNumItems While invPos < invCount set pInvObj to pCont.GetInventoryObject invPos set pObjType to GetObjectType pInvObj let n := pCont.GetItemCount pInvObj printc "#%g - Name: %n Type: %g Count: %g" invPos pInvObj pObjType n set invPos to invPos + 1 Loop Link to comment Share on other sites More sharing options...
Lord Valarian Posted July 26, 2012 Author Share Posted July 26, 2012 (edited) I tried to use those functions for days. I gave up and abandoned the whole method. I designed a totally different way of doing it. Not pretty, but it works. Thanks for the info. I may use it at a later date. FYI, the mod nearly complete. Some small finishing touches to do. An addon for it is giving me a weird syntax error. First, what's wrong here? short health ; obse code begin onactivate set health to 71 printc "health: %g%%" tempend health: 71 Percents won't print. Using '%a' won't work either. '%g' isn't listed is the docs, but other webpages reference it? Edited July 26, 2012 by Lord Valarian Link to comment Share on other sites More sharing options...
QQuix Posted July 26, 2012 Share Posted July 26, 2012 %g is documented in the PrintC page and all other pages where it applies. %% is broken and already reported to the OBSE team in case they come back from Skyrim The only way I've found to print a % is Print "%%" or let MyString := "%%" + Print $MyString (PRINT, not PrintC) Link to comment Share on other sites More sharing options...
Lord Valarian Posted July 27, 2012 Author Share Posted July 27, 2012 setname and setnameex These are not saved to the gamefile. Right? Can you set a quest var to a string? Link to comment Share on other sites More sharing options...
QQuix Posted July 28, 2012 Share Posted July 28, 2012 setname and setnameexThese are not saved to the gamefile. Right? I don't know.Write a test script that sets the name of something. Save and load and check if the new name stuck. Can you set a quest var to a string?Yes, quests may have string_var variables. Link to comment Share on other sites More sharing options...
Lord Valarian Posted July 28, 2012 Author Share Posted July 28, 2012 Write a test script that sets the name of something. Save and load and check if the new name stuck. No, the new name stays if you use the load screen. However, it disappears if you exit the game then restart. I might have a way around that. This mod really pushes my programing skills to the limit. Yes, quests may have string_var variables. Can you set those string vars at the console? quest1.name1 "test" gives an error Link to comment Share on other sites More sharing options...
QQuix Posted July 28, 2012 Share Posted July 28, 2012 Sorry. I am not familiar with console usage. Link to comment Share on other sites More sharing options...
Recommended Posts