Jump to content

Alchemy Sorter Script not working


dtom1962

Recommended Posts

Hi

 

I'm trying to implement an Alchemy Sorter Script for Skyrim

The original Oblivion Script ran somethinmg like this.

 

Scriptname Sorter
Short Total
Begin OnActivate
If Player.getitemcount  AntlersLarge >= 1
               Set TOTAL = GetItemCount  AntlersLarge
               Player.removeitem AntlersLarge TOTAL
               AntlersLargeCHESTREF.additem AntlersLarge TOTAL
Endif
If Player.getitemcount  AntlersSmall >= 1
               Set TOTAL = GetItemCount  AntlersSmall
               Player.removeitem AntlersSmall TOTAL
               AntlersSmallCHESTREF.additem AntlersSmall TOTAL
Endif
End

 

Where AntlersLargeCHESTREF was a referenced example of a unique labelled container. (I've only shown the first two of a much longer script)

I've set about translating this to SKYRIM

1. I created unique lablled containers for all the ingredients

2. I then gave each a Reference name.

3. I wrote the script below.

 

 

Scriptname DTOMSorterScript extends ObjectReference
{A script to sort Alchemicals into REF jars}

Int TOTAL
Ingredient Property AntlersLarge  Auto
Ingredient Property AntlersSmall  Auto
Container Property AntlersLargeCHESTREF  Auto
Container Property AntlersSmallCHESTREF  Auto

Event OnActivate(ObjectReference akActionRef)

If (Game.GetPlayer().GetItemCount(AntlersLarge) >= 1)
      TOTAL =  Game.GetPlayer().GetItemCount(AntlersLarge)
      Game.GetPlayer().RemoveItem(AntlersLarge, TOTAL)
      AntlersLargeCHESTREF.AddItem(AntlersLarge, TOTAL, 1)
Endif
If (Game.GetPlayer().GetItemCount(AntlersSmall) >= 1)
      TOTAL =  Game.GetPlayer().GetItemCount(AntlersSmall)
      Game.GetPlayer().RemoveItem(AntlersSmall, TOTAL)
      AntlersSmallCHESTREF.AddItem(AntlersSmall, TOTAL, 1)
Endif

EndEvent

 

This produced this when compiled

 

Compiling "DTOMSorterScript"...

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\DTOMSorterScript.psc(15,23): AddItem is not a function or does not exist

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\DTOMSorterScript.psc(20,22): AddItem is not a function or does not exist

No output generated for DTOMSorterScript, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on DTOMSorterScript

 

I'm confused since the additem follows the syntax in the CK wiki.

Also do I really haved to declare properties for every ingredient and Container as seems to be the case. It's such an inelegant solution.

 

Any help?

Link to comment
Share on other sites

Properties are very unwieldy, and you constantly trip over their instantiation. You have to wonder whether the person in charge of designing Papyrus is even computer literate.

 

That said, I wonder if you're going about doing the sorting the right way. I mean, Oblivion's limited scripting solutions necessitated the use of containers, but it seems to me like you could use message boxes and formlists to accomplish that nowadays.

Link to comment
Share on other sites

Properties are very unwieldy, and you constantly trip over their instantiation. You have to wonder whether the person in charge of designing Papyrus is even computer literate.

 

That said, I wonder if you're going about doing the sorting the right way. I mean, Oblivion's limited scripting solutions necessitated the use of containers, but it seems to me like you could use message boxes and formlists to accomplish that nowadays.

You could be right. But I like the multi container solution. I'm a pack rat and love to store.

Link to comment
Share on other sites

Look at my http://skyrim.nexusmods.com/downloads/file.php?id=10045

Part of it is an ingredient sorting function, I stole the object list from somebody else, then I used excel to generate long series of function calls to move the items.

 

It stores everything in the container you activates, lets you use the inventory take all button

Skyrim removeitem is more powerful than in Oblivion, it let you specify target container and is optional silent.

Link to comment
Share on other sites

Look at my http://skyrim.nexusmods.com/downloads/file.php?id=10045

Part of it is an ingredient sorting function, I stole the object list from somebody else, then I used excel to generate long series of function calls to move the items.

 

It stores everything in the container you activates, lets you use the inventory take all button

Skyrim removeitem is more powerful than in Oblivion, it let you specify target container and is optional silent.

Thanks for the heads up.

However, As I read it, this script deposits all ingredients in a single container. I want to sort to individual containers.

But I am having trouble getting the script to operate as expected

I added some debug statements to see what was going on.

Again I've forshortened the actual script for space but I can include the whole thing, under a spoiler tab if you wish

Thats when things got weird.

 

Scriptname DTOMSorterScript extends ObjectReference
{A script to sort Alchemicals into REF jars}
Int TOTAL
ObjectReference property objSelf auto hidden
Sound property QSTAstrolabeButtonPressX auto
Ingredient Property AntlersLarge  Auto
ObjectReference Property AntlersLargeCHESTREF2  Auto
Ingredient Property AntlersSmall  Auto
ObjectReference Property AntlersSmallCHESTREF  Auto
Ingredient Property BearClaws  Auto
ObjectReference Property BearClawsCHESTREF  Auto
Ingredient Property BeeHiveHusk  Auto
ObjectReference Property BeeHiveHuskCHESTREF  Auto
Ingredient Property BeeHoneyComb  Auto
ObjectReference Property BeeHoneyCombCHESTREF  Auto
Ingredient Property WispWrappings  Auto
ObjectReference Property WispWrappingsCHESTREF  Auto
Event OnCellAttach()
PlayAnimation("Open")
EndEvent
Event OnActivate(ObjectReference akActionRef)
if (akActionRef == Game.GetPlayer())
Debug.MessageBox("Gotto Start!")
PlayAnimationAndWait("Trigger01", "done")
if (QSTAstrolabeButtonPressX)
 QSTAstrolabeButtonPressX.Play(Self)
endif
If (Game.GetPlayer().GetItemCount(AntlersLarge ))>= 1
Total=  Game.GetPlayer().GetItemCount(AntlersLarge)
(Game.GetPlayer().removeitem (AntlersLarge,TOTAL,1))
AntlersLargeCHESTREF2.additem(AntlersLarge,TOTAL,1)
Endif
Debug.MessageBox("Got Antlers Large!")
If (Game.GetPlayer().GetItemCount(AntlersSmall ))>= 1
Total=  Game.GetPlayer().GetItemCount(AntlersSmall)
(Game.GetPlayer().removeitem(AntlersSmall,TOTAL,1))
AntlersSmallCHESTREF.additem(AntlersSmall,TOTAL,1)
Endif
Debug.MessageBox("Got AntlersSmall!")
If (Game.GetPlayer().GetItemCount(BearClaws ))>= 1
Total=  Game.GetPlayer().GetItemCount(BearClaws)
(Game.getPlayer().removeitem(BearClaws,TOTAL,1))
BearClawsCHESTREF.additem(BearClaws,TOTAL,1)
Endif
Debug.MessageBox("Got bears!")
If (Game.GetPlayer().GetItemCount(BeeHiveHusk ))>= 1
Total=  Game.GetPlayer().GetItemCount(BeeHiveHusk)
(Game.GetPlayer().removeitem(BeeHiveHusk,TOTAL,1))
BeeHiveHuskCHESTREF.additem(BeeHiveHusk,TOTAL,1)
Endif
If (Game.GetPlayer().GetItemCount(BeeHoneyComb ))>= 1
Total=  Game.GetPlayer().GetItemCount(BeeHoneyComb)
(Game.GetPlayer().removeitem(BeeHoneyComb,TOTAL,1))
BeeHoneyCombCHESTREF.additem(BeeHoneyComb,TOTAL,1)
Endif
Debug.MessageBox("Got honeycomb!")
If (Game.GetPlayer().GetItemCount(WispWrappings ))>= 1
Total=  Game.GetPlayer().GetItemCount(WispWrappings)
(Game.GetPlayer().removeitem(WispWrappings,TOTAL,1))
WispWrappingsCHESTREF.additem(WispWrappings,TOTAL,1)
Endif
Debug.MessageBox("Got End!")
Endif
EndEvent

 

1. I have all the ingredients in Inventory.

2. I activate the sorter.

 

The messages first appeared in this order

Start

Antlers Long

Bear Claws

Honeycomb

End

AntlersSmall !!!!!

 

Further Testing has shown that they appear in a fairly random way.

 

The only item that is removed is the long antlers

However, it does not appear in the container with AntlersLargeCHESTREF2 as its reference and set as the value in the properties window.

So the

 


AntlersLargeCHESTREF2.additem(AntlersLarge,TOTAL,1)

 

line does not work as expected. Using Debug Messages I can confirm that TOTAL is being set to the number of Large Antlers in the Players Inventory.

and that these are removed, so

Total=  Game.GetPlayer().GetItemCount(AntlersLarge)
(Game.GetPlayer().removeitem (AntlersLarge,TOTAL,1))

is working as expected.

Anyone got any thoughts why the additem line is not working as expected.

 

The other ingredients are not touched but this might be because the additem line fails in game?

This is so frustratiing.

I'm sure its a really small issue, but I've been all around the houses on this one.

 

I tried changing the

 

(Game.GetPlayer().removeitem (AntlersLarge,TOTAL,1))
AntlersLargeCHESTREF2.additem(AntlersLarge,TOTAL,1)

 

to

a single line

 

 

(Game.GetPlayer().removeitem (AntlersLarge,TOTAL,0,AntlersLargeCHESTREF2))

 

it compiles and removes the antlers but it still doesn't deposit them in the container.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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