setScript won't do as i want it to

Post » Fri May 27, 2011 9:53 am

hello there,

i've been trying to write a (as i thought) simple little mod that allows me to process cloth into items of more use. My problem is, i can't seem to give those clothes several charges to respect different qualities of cloth.
So i set up an array that is synchronized with my inventory every fQuestDelayTime seconds, if in menuMode. it's working fine and cloth bolts, (fine) folded cloth is added / removed when bought / sold or picked up / dropped, but the charges i was storing in the array are of course resetting each time such an item is added to my inventory.
Marking every "cloth" item as quest item isn't the right way i guess so i thought of setScript. If i understood what i could find about setScript it should be an elegant way to have every item in question manage their uses individually, even if dropped or something.
Well but i can't seem to get setScript to work. What i've got so far is like:

begin menuMode 1002	...	let miscItems := player.getItems ;; getItems 27 didn't seem to work, some "misc" items weren't included	while index >= 0		let miscItem := miscItems[index]		if eval (getObjectType miscItem != 27)			ar_Erase ...			let index -= 1			continue		endif			   ;; ok, miscItem is applicable, add it to the array		if eval (isScripted miscItem) == 0			ref tmpScriptRef		   ;let tmpScriptRef := *someObjectWiththeScript*.getScript			let tmpScriptRef := setScript *someScriptRef* miscItem			let tmpScriptRef := 0		endif	   ; add the item		...	loop	...end

ok, it's not all of the script but i hope it shows what i'm trying to do. So... it compiles, it runs, but when "use"ing the item(s) in question (-> miscItem) nothing happens. No that's not correct, sOmething happens, as the animation of my character in the menuMode is resetted ^^ but the OnEquip block of the "attached" script won't run.
Well, does anyone know what i'm missing to get it working?
i read something about adding the item to, well, someone, should help to start the script added to it... that is something i don't quite understand, because then i would have two of them in my inventory, one scripted (hopefully) and the other not, or how it is supposed to be meant?
I'm really new to this all, so don't slap me for my simple question, if so, nor for my poor English :) but if anyone can help me out here ... please, do so! :P

regards, leptoton
User avatar
Love iz not
 
Posts: 3377
Joined: Sat Aug 25, 2007 8:55 pm

Post » Fri May 27, 2011 9:00 pm

You'll need to "reinitialize" the item's reference after the setScript call to see the changes. Disable, wait for a frame and then enable the item.
User avatar
Clea Jamerson
 
Posts: 3376
Joined: Tue Jun 20, 2006 3:23 pm

Post » Fri May 27, 2011 12:42 pm

Well, i tried what you suggested, but it doesn't seems to work.
whenever i call getDisabled, disable or enable the script seems to abort immediately upon or after running the command, at least i don't see any messages i would have it display after one of them. However, even if it was only one item in the inventory that i wanted to attach a certain script to, it's still not running after whatever the enable command did to it.
Maybe someone could explain a bit more clearly how to disable, and then (re)enable items (a frame or so later) ?
to show a bit of code to work with, if needed :
int enableFlagfloat fQuestDelayTimebegin MenuMode 1002	setfQuestDelayTime to 2.5	if enableFlag == 0		let miscItems := player.getItems		let index := ar_Size miscItems		while (index -= 1) >= 0			let miscItem := miscItems[index]			if eval (getObjectType miscItem) == 27				if *name contains "folded cloth"					*addtointernalArray* miscItem					setScript *someScriptRef* miscItem					let enableFlag := 1					miscItem.disable			;;everything after above command doesn't seem to run					printC "testTest"				endif			endif		loop	else		while *walkThroughInternalArray*			let miscItem := internalArray[index1]			miscItem.enable	;; again anything after the above lone doesnt seem to run			printC "just did it, no?"		loop		let enableFlag := 0	endifend

again, just to give an example, although it's quite the same i do in my script

thanks for your ideas :)


edit:
I realized that testExpr returns false if given a .disable like:
if testExpr (miscItem.disable) ;all okelse	printC "error"endif

so its the call itself... maybe because i'm in menumode when disabling the item(s) ?
ah, it would be pretty usefull, if it could be done with setScript, so i wouldn't have to worry about other mods adding items made of cloth.. hmm
well, let's see what others have to say :)
User avatar
Elina
 
Posts: 3411
Joined: Wed Jun 21, 2006 10:09 pm

Post » Fri May 27, 2011 3:41 pm

hm.. maybe i could explain more claerly, what i'm trying to to :-/
it's all going about cloth, that i want to use to fashion other useful things for me, like brandnew clean pants, because my old ones may got dirty or something ^^. Well, now at compile time i do not know all the cloth items, like 'folded cloth', cloth bolts and such that are added through whichever mods i'm using, so i can't attach the script for "using" those items to them in the cs, as they aren't there. And i guess, it would be way to much work to look over each and every mod out there that possibly adds those items to the game. Maybe there are other possibilities to accomplish this, but for the moment i would consider setScript the best to get all the items to do what i want them to... give me fresh pants (or something ^^). Well, now all my scripts shall run in menuMode, if possible, to have the smallest possible impact on gameplay. As stated by shadeMe, setting the script with setScript could be done, if i'd "reinitialize" the item(s) in question, which would involve disabling and then reenabling them. So that would be the thing i'd be interested in.


meanwhile i tested if it works if an item in question could be attached the script to in menumode, then dropped and, a frame or so later, picked up again.
this was my next thought, should dis- and (re)enabling directly in menuMode not work.
so i attached the script i want to use for the items to a book that is added to the player upon starting the mod for the first time. i tested with a specific item named 'Ausgezeichneter gefalteter Stoff' (i'm using the german version of the game, i guess it would be something like 'Fine Folded Cloth' in the English one). I just bought the item off of a vendor and ran the following script:
ref droppedRefref bookRefshort pickingbegin menumode 1002	if eval (getActiveMenuFilter < 4)		return	endif	array_var miscItems	ref miscItem	string_var miscItemName	short invI	if bookRef == 0		printC "search for book"		let miscItems := player.getItems 21		let invI := ar_Size miscItems		while (invI -= 1) >= 0			let miscItem := miscItems[invI]			if eval (miscItem == myBook);myBook is the book added to the player upon startingthe mod				let bookRef := miscItem				break			endif		loop	endif	if bookRef == 0		printC "no book, leaving"		return	endif	let miscItems := player.getItems 27	let invI := ar_Size miscItems	if picking == 0		printC "first time, search for stoff"		while (invI -= 1) >= 0			let miscItem := miscItems[invI]			let miscItemName := toString miscItem			if eval (sv_Find "stoff" miscItemName >= 0)				let miscItemName += " is contained"				printC $miscItemName				ref scriptRef				let scriptRef := getScript bookRef				setScript scriptRef miscItem				printC "script attached, dropping"				player.drop miscItem 1				break			endif		loop		set picking to 1	elseif picking == 1		printC "now checking outdoors"		let miscItem := getFirstRef 27 1 1		while (miscItem)			if miscItem.getDistance player < 64				let miscItemName := toString miscItem;printC $miscItemName				if eval (sv_Find "stoff" miscItemName >= 0)					printC "found stoff outside"					miscItem.activate player, 1					break				endif			endif			set miscItem to getNextRef		loop		set picking to -1	endif	set miscItemName to sv_Destruct	let miscItems := ar_Null	printC "done."end

well, after running it, the attached script now runs! :D
so the above could be another approach... although i fear it could get kind of hard to ensure i don't "pickup" items that aren't actually mine

regards leptoton
User avatar
Benji
 
Posts: 3447
Joined: Tue May 15, 2007 11:58 pm

Post » Fri May 27, 2011 12:47 pm

well... as long as noone can explain me how to dis- and (re)enable items in menuMode i will stick to the second approach :-/
i'm even playing around with an attached object script doing quite the same as the original, only for setting the health of my "used" items, so vendors will eventually buy them for less gold, if they were used. it works by now, isScripted and hasVariable are seemingly enough to ensure that i pick up the right items after dropping them, i've read some more over at the wiki about that and i'm quite confident that it is now. I've not implemented the setCurrentHealth or whatever part yet, so if there were some dangers or the like, that were worth knowing about before even trying it... feel free to post it :).
Well still it seems to me that the first idea stated by shadeMe could be better in means of workflow and maybe performance...

regards, leptoton
User avatar
meg knight
 
Posts: 3463
Joined: Wed Nov 29, 2006 4:20 am

Post » Fri May 27, 2011 1:50 pm

I've used setscript to add a script to inventory items. All it took to get things working properly was this:

SetScript escript enchantedItemplayer.RemoveItemNS enchantedItem 1player.AddItemNS enchantedItem 1

User avatar
Kelvin
 
Posts: 3405
Joined: Sat Nov 17, 2007 10:22 am

Post » Fri May 27, 2011 10:39 pm

stattis:
and you're sure you did this in menuMode?... wow well, i see if it works. Should clean up my code quite a lot then :)
thank you for your response so far :)

regards, leptoton
User avatar
Joe Bonney
 
Posts: 3466
Joined: Tue Jul 17, 2007 12:00 pm

Post » Fri May 27, 2011 8:02 am

well... i've run into several problems now. Mainly it's that i cheat the game somehow when processing stolen cloths. I've tried both ways already, the one stated by statttis, just 'player.removeItemNS miscItem 1; player.addItemNS miscItem 1'ing, and dropping the items with player.drop miscItem (1 / count), and then ref-walking to readd them to get the attached scripts running. Well, they run, but i end up with a cloth not marked as stolen anymore after starting the script, with both ways. for addItem(NS) it seems clear why, but when trying it the other way, for which i've written something like this to cover stolen goods:
array_var clothItems;filled with the names of all my posessed items, folded cloth and the like, duplicates allowedarray_var clothItemsVariables;filled with all 'necessary' information about each itemshort tmpShort...if eval (miscItem.isOffLimits 7);item stolen, maintain it	short upper	short lower	print "found stolen " + $miscItem	let upper := ar_Size clothItems	let tmpShort := ar_Find $miscItem clothItems	while tmpShort >= 0;assuming the baseObject of picked up reference is the same stored in the array...		if eval (clothItemsVariables[tmpShort]["icon"] == miscItem.getIconPath)			let clothItemsVariables[tmpShort]["owner"] := miscItem.getOwner			if eval (clothItemsVariables[tmpShort]["owner"] == 0)				let clothItemsVariables[tmpShort]["owner"] := miscItem.getParentCellOwner			endif			print "saving owner in Array: " + $clothItemsVariables[tmpShort]["owner"]			break		endif		let lower := tmpShort + 1		let tmpShort := ar_Find $miscItem clothItems lower:upper	loopendif

it doesn't even recognize the dropped items as stolen. So i'd guess that .drop resets the stolen flag or something. Does anyone have an idea how to retain it then?

i found a post from shadeMe about getting the owner of items which reads:
It's currently not possible to get the owner of an inventory object directly. An alternative would be to grab the object that is to be sold ( using getActiveMenuSelection and isKeyPressed ), drop it to the ground, grab it's owner, put it back ( taking it out and putting it back can be an issue ), check if the owners are the same; if yes, exit the menu and call the proper dialog.


so i guess i was on the right way, but... if on the single other hand isOffLimits doesnt recognize items dropped to the ground... well, what then? ^^

please if someone has an idea, let me know :)

regards, leptoton

edit:
i mean, somehow there must be a way, since the game knows which items are stolen, if you get arrested, as all those are beeing removed... so either getting the information from inventory items, or dropping them all down and then having a look must be possible... i guess :-/

edit2:
i'v just tried the above script without checking with isOffLimits and it appears that getOwner returns the player as the owner of items i dropped with .drop
and as getOwner does, isOffLimits does so too, i'd guess. Soo... what next? checking in gamemode for each and every item that i'm targeting?? omg...
Anyone? maybe i could do the drop for the player somehow ? an item "icon" in the inventory isn't actually a gui element, is it? No? waaah, someone help me out here :D
User avatar
Nick Jase Mason
 
Posts: 3432
Joined: Sun Jul 29, 2007 1:23 am

Post » Fri May 27, 2011 9:48 am

well, if noone has an idea, i'll test with a scripted container moved to my position and then removing the items to the container and back to the player the next frame tomorrow... good night
User avatar
Mariana
 
Posts: 3426
Joined: Mon Jun 12, 2006 9:39 pm

Post » Fri May 27, 2011 1:12 pm

so... no, i couldn't get "this removing items to a container and then re-removing them to the player" thing to work, the stolen flag remained intact, but the attached script wouldn't start... maybe i missed something...
But i stumbled upon the xml functions of obse today and, well it seems this could be a way to drop items without losing their stolen flag... just simulate the drop by have the user click the item - maybe someone has some expierience with that. it's mainly clickMenuButton, while 'menuHoldKey'ing, used for every "new" unscripted item tracked down, and then ref-walking and 'activate'ing them to get them back (no onActivate Block in the attached script so far). I've only made a first attempt, means no setScript yet, but i'd guess it will work well. I noticed however, that first, names of items with a " " space in it have it replaced with a "_" instead when acquired as xml string, took me quite a while to figure it out, and second, i can 'shift click' and drop more than one item per frame, but suddenly will have to wait a frame before picking more items up again after that somehow - otherwise the game crashes for me. As i mentioned before, all i'm doing so far happens in menuMode...
Now i'm rewriting it all to get it clean again, simply to much variables and 'print's to get it merged in my old script ^^
So if someone has gathered some expieriences and wants to warn me of possible problems i could run into... feel free, it was appreciated :)
As i said, i'm new to the scripting thing... well at least i could have found something that works with both - setScript and retain the stolen flag. Hopefully there isn't much more to get my "simple, little mod" working :D

regards, leptoton
User avatar
vicki kitterman
 
Posts: 3494
Joined: Mon Aug 07, 2006 11:58 am

Post » Fri May 27, 2011 10:43 pm

Well, i guess there is :(
when i try to check the items in my inventory against the array i'm storing the already "started" items in, and to look at the related "button", what it is in XML, the only way to distingush those buttons is the name. So i specify a fully qualified name for the item currently checked and, compare e.g. its "stolenFlag" with the one stored in the maintained array, i thought. But should i have 2 items of the same type (name, icon, or formid etc match), but one stolen and the other not, then trying to access a trait of a button (item) specified by name would result in the same button, no matter at which index in the array given through getTileChildren i am, as this consists of only the ("performance friendly") names of traits. In the Documentation i read that passing an id to clickMenuButton is more peformance hungry but in my case it seems to be the only way to know, what items i did drop already to start their script, and which not. So i could use a bit help with that :)
Does anybody have an idea how to accomplish that?
Every help is appreciated!!
Thank you.

regards, leptoton

Edit:
Just to make things clear, again:
I only want to set a script to items, which aren't known at compile time, as other mods could add new items iam working with. And at this point i'm working mainly in inventory mode. More over that it shouldn't be cheating the game by just "player.drop"'ing and therefore loosing the "stolen flag" of those items.
So any other approach than the one one i currently got stuck is also worth a try for me!. I can only ask questions about things i already "know" about. :)
User avatar
Chavala
 
Posts: 3355
Joined: Sun Jun 25, 2006 5:28 am

Post » Fri May 27, 2011 8:18 am

First: Do not create variables inside blocks. All variables should be written outside of the different blocks, generally at the top of the script. This isn't C++ we're working with here :P

Secondly, let's take a big step back and try to look at the bigger picture for just a minute:

1. What is the overall goal of your mod?
2. What, exactly, are you trying to accomplish by using SetScript on the cloth items?
3. What script code are you adding to them?
4. Have you checked to see if the cloth items are already scripted?

And in order to add back stolen items to the player with the stolen flag cleared, you will want to use http://cs.elderscrolls.com/constwiki/index.php/RemoveAllItems on your container.
User avatar
Stu Clarke
 
Posts: 3326
Joined: Fri Jun 22, 2007 1:45 pm

Post » Fri May 27, 2011 9:53 pm

If I may say so, make your posts as concise as possible - You're more likely to get an answer to your query if it didn't require prospective users to read through a wall of text.
User avatar
jasminĪµ
 
Posts: 3511
Joined: Mon Jan 29, 2007 4:12 am

Post » Fri May 27, 2011 11:51 pm

hi reneer, thanks for replying :)

ok, will declare my variables on top of all my code from now on :D

well, to your questioons...

1. this is the hardest to answer i gues. It shall be an addition to another mod that i'm using. Its good and i simply don't want to to without it, so... but i don't want to mention this mod's name as it isn't a "public" mod yet, and i didn't ask the original author for permission. It's just for me at this point. The code itself runs in a seperate mod of course, so i'm not pasting scripts into an existing one or the like. I hope this is enough. But i can say the goal is the ability to 'use' all "cloth items", meaning no apparel, robes or cloaks and such, only those misc items (type 27), and giving the player new items for it, just like tailoring :) . The player shall have the ability to use several cloths different times, to respect their different 'qualities' (fine folded cloth, say 2 times, folded cloth, 1 time and so on).

2. setScript i thought should be a way to keep track of those uses. I had done that through adding the script to all 'cloth' items i'm currently using, but what if i install a bunch of new mods tomorrow that add new 'cloth' items, like 'superior folded cloth' ? I can't possibly know all of them at compile time. That was the first thought. then there is the problem that when i try to store the uses, or charges of my items in a quest script i wont know their counts when dropping such an item to the ground, say for storage place reasons, or accidentally sell one and then buy it back, because the script wouldn't 'know' of this specific item anymore. that was the second. SetScript would of course give me other possibilities, it was just the first intend when i had the idea to use it.

3. by now, not much, as it doesn't even start, so to keep it easy it's just printing "hello world"'s and that ^^. But there is a variable counting the uses (onEquip) and destroying the item when it is used up. Then of course a messagebox system, to let the player choose what he/she wants to fashion, say a hat or a shirt, and keeping track of all requirements (like the cloth and utilities, is the mod it applies to installed and that...) and giving the player the new item (hat or something). i can't estimate, how much or complex it get's - till now the script won't start, not without losing the stolen flag of the cloths. So this is onEquip, maybe onSell, onAdd+onDrop depending on which approach gets setScript working for me, to maybe temporarely store its variables in the quest script (in which i set the script earlier) and then read them back... hm, i hope there won't be any onActivate, at least there is nothing planned so far...

4. isScripted returns true immediately after setting the script, but as hasVariable only works for references, and i'm in menuMode, i have to work with compareScript(s?). but yes, i checked this. Well there is a point though: if i buy an item like one scripted already (the script of which is running already) my tracking script will tell me that it was scripted (checking with formid). At this moment I don't even know if setting the script to inventory items will set it to all items with the same formid and i therefore only need to "initialise" those bought items, or if it tells me so, because it can't distinguish the items of a stack (setting the script to a stack of items will set it to the hole stack at least).


ok *sweats*, i hope this is enough for you to get the idea, if not, please ask on :) ...As i wrote, i'm not an English speaker so there could be 'some' errors :D
but thanks again for replying

regards, leptoton
User avatar
Alisia Lisha
 
Posts: 3480
Joined: Tue Dec 05, 2006 8:52 pm

Post » Fri May 27, 2011 5:16 pm

hello shadeMe,

i didn't see your post while replying to reneer so i fear there Is a wall of text now *duck*. but i also have to say that i only try to describe what the problem is. Sure i could write: "hey, my script doesen't run, help me" and post the entire thing here, but at this point that would be a bit longer than my posts. And then i'm of course a newbe :-/ ^^ but...

hm, how to shorten it then ...

"setScript itself works but:
    1. i can't "reinitialize" the items afterwards without dropping them to the ground and then activate them (enable/disable didn't work for me while in menuMode)

    2. dropping the items with "player.drop", then activate them with ".activate player" did the trick, but cleared the stolen flag of the items

    3. dropping an item with "clickMenuButton " keeps the stolen flag intact but passing a name to this function implies that i can't decide which item of, say 4 with the same name (1 enchanted, 1 poisoned, 1 stOlen, 1 normal) i want to drop

Does anyone have an idea how i could get one of the above to work, or know another possibility to get the script set starting? :)"

this is as short as i can, i hope its more readible this way :-/

regards, leptoton
User avatar
Ludivine Dupuy
 
Posts: 3418
Joined: Tue Mar 27, 2007 6:51 pm

Post » Fri May 27, 2011 12:49 pm

Ok.

Overall, SetScript is a bad idea, at least for your mod. The main reason is that, if you'll note on the http://cs.elderscrolls.com/constwiki/index.php/SetScript page, upon reload all the items that you previously used SetScript on won't have the script anymore. I'm sure you can see how this detail would foul up your current system. Enchantments would be a good idea, but Misc Items can't be enchanted.

The only way it looks like you are going to make your current system work is to simply make each cloth item work once (check to see if the cloth is equipped or simply mass-convert all the cloth in the player's inventory to "yarn") and depending upon its quality produce more "yarn" or some other such object that you can script / enchant because it isn't a Misc item (example a "Fine Cloth Bolt" produces 2 sheets whereas a "Cloth Bolt" produces 1).
User avatar
Farrah Lee
 
Posts: 3488
Joined: Fri Aug 17, 2007 10:32 pm

Post » Fri May 27, 2011 10:29 pm

ah ok, i will have a look at it then once more...
but one thing though... for whatever reasons i already tested starting the mod, then scripting some items (stacks too), then saving and loading that new save game... which works fine. but you're right, i didn't try rEloading this save. I'll have to check that, too. thank you so far :)

regards, leptoton
User avatar
AnDres MeZa
 
Posts: 3349
Joined: Thu Aug 16, 2007 1:39 pm

Post » Fri May 27, 2011 9:20 pm

okay, i'm somehow unable to get it to the point which to test the reloading problem at... I remember i tested it, but i reloaded in the same cell i saved in, therefore it worked. but i'd guess it's possible to check with getGameLoaded, and let the (newly) scripted items then read back their own variables from the array they are "stored" in - a bit more work, but seems doable to me. But for now i'm stuck with my tracker script somehow. If you could help me out here, it was appreciated :)
it looks like this:
array_var clothItems;thats the main array with all relevant properties (and variables) of "already known" items...begin menuMode 1016;print "dialogue... " + $statusFlag	if statusFlag == DROPPING && updateFlag;print "click the button"		let strButton := "quantity_background\quantity_button_okay"		clickMenuButton $strButton 1016		let updateFlag := 0		set fQuestDelayTime to fastTiming	endifendBegin menuMode 1002;initialize variables, early returns	if (getGameLoaded)		let reloadedFlag := 1	endif	...	if statusFlag % 4 == 0;statusFlag is 0 or IDLEING in this case		let statusFlag := UPDATING		...		let updateFlag := 0		let tmpShort := -2		menuHoldKey 42		set fQuestDelayTime to fastTiming; 0.0001		let statusFlag := DROPPING		return	elseif statusFlag == DROPPING		set fQuestDelayTime to fastTiming		if (updateFlag)			return		endif		print "DROPPING"		if tmpShort == -2			let tmpShort := droppingItemsSize		endif;print $tmpShort		while (tmpShort -= 1) >= 0			let tmpShort1 := -1			while (tmpShort1 += 1) < droppingItemsSize				let miscItem := droppingItems[tmpShort1]				let strButton := $miscItem				sv_Replace " |_" strButton				let strTrait := clothItemsButtonsPath + "\" + strButton + "\user6"				let strTrait := getMenuStringValue $strTrait 1002				sv_Erase strTrait 0 6;print $strTrait + " vs misc: " + $(getIconPath miscItem)				if eval (strTrait == getIconPath miscItem)					let strTrait := clothItemsButtonsPath + "\" + strButton + "\user7"					let valButton := toNumber $(getMenuStringValue $strTrait 1002);print $valButton + " vs misc: " + $(player.getItemCount miscItem)					if valButton == (player.getItemCount miscItem)						let updateFlag := valButton > 1						clickMenuButton $strButton 1002						let droppedItemsCount += valButton						ar_Erase droppingItems tmpShort1						let droppingItemsSize -= 1						break					endif				endif			loop			if updateFlag				break			endif		loop		if updateFlag;print "awaiting dialogue";<-- HERE the script hangs			return; or HERE, well... ^^		endif		menuReleaseKey 42		let statusFlag := PICKING		return	elseif statusFlag == PICKING		...	endif;cleanup	set fQuestDelayTime to normalTiming	let statusFlag := IDLEINGend

it seems the script returns after the first drop and then does nothing - no quantity menu, no next loop :o. Could someone help me here please ?
i know it's a "long" post ^^ but i had to include the hole script part *duck* ... nevermind :D

regards, leptoton
User avatar
Lady Shocka
 
Posts: 3452
Joined: Mon Aug 21, 2006 10:59 pm

Post » Fri May 27, 2011 8:56 am

ok, the above code snippet didn't work because i didn't pass a fully qualified name to clickMenuButton, it was late the evening i posted it...
however, i've not yet finished testing if resetting the script for items previously handled works when a save game is reloaded - somehow i messed up the arrays in my script and will have to try to fix that tomorrow, but still i'm quite sure that it will work, because getGameLoaded is catched properly ...
One thing i noticed with the approach of doing the drop for the player with clickMenuButton to 'reinitialize' the scripted items and still retain the 'stolen flag' is, that the quantity menu which appears if i drop stacks of items shows up quite long (1/3 - 1/2 sec), which is quite confusing for a player that isn't expecting it to show up... and i don't believe that not interrupting the script after 'clicking' on the item to drop and waiting for the quantity menu to appear works, so... while i'm testing with the reloading save games - is it possible to somehow don't have this menu appear?

regards, leptoton
User avatar
Timara White
 
Posts: 3464
Joined: Mon Aug 27, 2007 7:39 am

Post » Fri May 27, 2011 9:38 am

@Reneer:
ah, finally i got it -.=
i stored all relevant variables from the object script (for each item) in an array in the quest script (tracker script) and updated them after reloading a save. to do that i checked against getGameLoaded, set the script and dropped and picked up all (previously scripted) items again. the items will then update themselfes in an onAdd block.
i tried with saving in the IC, then fast traveling to bravil and reloading, it works. I hope that is sufficient ? if so, at least that doesn't neccessarily "foul up my current" approach (anymore) :)


So... now assuming, all other eventualities are covered by my script and this last approach works indeed, i wish i could compare it to another one..
it's quite time consuming to simulate the drop, all the more as i'm forced to 'click' on all items with the same name for one that i actually want to drop. Then the quantity menu in case of dropping stacks and that... in the end it seems, performance is the main weaknes of this script. therefore again:

Does anyone have another idea how to start scripts set to items in the inventory (menuMode) without losing the 'stolen flag' ?
Maybe using dis-/enable in menuMode works after all, as opposed to what i experienced, but i may have made a mistake ?
or maybe ideas to improve performance when using clickMenuButton, possibly every 2 Frames (or how much ever, in case of stacks) ?

thank you.

regards, leptoton
User avatar
Emma-Jane Merrin
 
Posts: 3477
Joined: Fri Aug 08, 2008 1:52 am


Return to IV - Oblivion