shulme Posted January 30, 2019 Share Posted January 30, 2019 I'm trying to update my mod from being based entirely on recipes to being based around formlists, to make it easier to modify on a maker level, and far more convenient to use on a user level. In essence, it's a automated trading box: To use, players place items in a container. Items in the container are checked against various formlists to determine their value- If an item is on formlist 1, it is replaced with 1 trading chit. If it is on formlist 7, it is replaced with 7 trading chits, and so on. This goes up to 10. If items in the container are NOT on any formlist, they are instead returned to the player. I've already poked through the wiki for geck scripting and relevant mods for comprehensible code for any hint of what commands to use, and while things like 'isinlist' look useful, I have yet to find any code regarding actually selecting items placed in a specific container to be checked against a list. Link to comment Share on other sites More sharing options...
Mktavish Posted January 30, 2019 Share Posted January 30, 2019 https://geckwiki.com/index.php/GetItemCount And use your form list for the object ID , like this for example in a script on the container. Begin OnAdd If GetItemCount MyList01 > 0 Player.AddItem MyChit 1 RemoveItem MyList01 endifEnd~~~~~~~~~~~~~~~~~~~ This is if you will only ever be adding one item at a time and getting your chits then.Otherwise should probably use a ref variable set to what gets added and the count.And any items not in the lists , will just stay in the container for the player to pull out , or leave there if they want. But could have it give any remaining items back with a "Begin OnClose" block , in the same script. Link to comment Share on other sites More sharing options...
Mktavish Posted January 30, 2019 Share Posted January 30, 2019 Oh ya sorry , you will need a Begin OnActivate block just to open the container since it has a script on it. So write your script something like this .... Begin OnActivate Activate End Begin OnAdd If GetItemCount MyList01 > 0 Player.AddItem MyChit 1 RemoveItem MyList01 If GetItemCount MyList02 > 0 Player.AddItem MyChit 2 RemoveItem MyList02 If GetItemCount MyList03 > 0 Player.AddItem MyChit 3 RemoveItem MyList03 ; etc .... endif endif endifEnd Begin OnClose RemoveAllItems Player 1 0 END Link to comment Share on other sites More sharing options...
shulme Posted January 30, 2019 Author Share Posted January 30, 2019 (edited) This is if you will only ever be adding one item at a time and getting your chits then.Otherwise should probably use a ref variable set to what gets added and the count. Thanks for the feedback! Adding one item how, as in adding the chits one by one, or items to the container? Ideally, you'd be able to just mass dump items into the container and have valid ones traded away and non-valid ones returned, so you don't have to fuss around with the existing crafting menus. The scripting so far looks comprehensible enough, so I think I could work with commands like these... Maybe you could have the number of an item be a value that is multiplied against the amount of chits? Say a laser rifle goes in the 3chit formlist. You add 5 laser rifles. The amount of chits it gives you is 5 x 3. Is that workable? Edited January 30, 2019 by shulme Link to comment Share on other sites More sharing options...
Mktavish Posted January 30, 2019 Share Posted January 30, 2019 Ya I was suggesting dropping 1 item at a time in the container which would immediatly give chits per it's chit value . Except for stackable items , would probably only give the chit value for 1 item ... unless dropped one at a time. I guess the way to have it give chits based on what you filled up the container with , would be to have a script on an activator , that you hit after dumping all the items you want to converrt into the container.And would probably need a multiframe block to get it done. Basically have an OnActivate block trigger a game mode block to run till the container is empty. Will probably need use of a variable like this for example ...`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SCN MyConvertScript Int iStageInt iCount Begin OnActivate Set iStage to 1End Begin GameMode If iStage == 1 Set iCount to MyContainer.GetItemCount MyList01 * 1 Player.AddItem Mychit iCount MyContainer.RemoveItem MyList01 iCount Set iStage to 2 If iStage == 2 Set iCount to MyContainer.GetItemCount MyList02 * 2 Player.AddItem Mychit iCount MyContainer.RemoveItem MyList02 iCount Set iStage to 3 If iStage == 3 Set iCount to MyContainer.GetItemCount MyList03 * 3 Player.AddItem Mychit iCount MyContainer.RemoveItem MyList01 iCount Set iStage to 4; etc ... ;Set iStage to 11 If iStage == 11 MyContainer.RemoveAllItems Player 1 0 ; Yadda yadda ... to stop this block from continueing to run~~~~~~~~~~~~~~~~~~~~~~~~~~~ Hope that helps .... just let me know if need more input. Link to comment Share on other sites More sharing options...
Recommended Posts