trade:getItem()
trade:getItem()
I started working on my server again, and noticed that trade:getItem() is not returning a simple ID integer anymore, but rather some type of user data. What changed? I was using trade:getItem() to find out what item ID the user was trading to an NPC. This was highly useful in several files of mine
How do I determine which item ID the user has traded now? hasItemQty is only useful when you know what will be traded, I need something for the unknown item that is traded.
How do I determine which item ID the user has traded now? hasItemQty is only useful when you know what will be traded, I need something for the unknown item that is traded.
Last edited by Avatarati on Thu Feb 23, 2017 11:41 am, edited 1 time in total.
Re: trade:getItem()
I see what happened now...
A commit on August 11, 2016 "changed getItem to return item object"
Guess I have to change every instance of getItem to getItemID...
My weekend schedule just filled up...
A commit on August 11, 2016 "changed getItem to return item object"
Guess I have to change every instance of getItem to getItemID...
My weekend schedule just filled up...
Re: trade:getItem()
Do you really have that many custom trades or are you just not pulling changes form DSP master? Please tell me I haven't run into yet another user that thinks they have to manually edit their fork to get updates in doing drag n drop updates. The horrors I have seen where somebody updates source without updating scripts, and other nightmare fuel.My weekend schedule just filled up...
Hi, I run The Demiurge server.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
DO NOT PRIVATE MESSAGE ME ABOUT BUGSPLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
Re: trade:getItem()
or.. you could just open notepad++ and directory replace getItem( with getItemID(Avatarati wrote:I see what happened now...
A commit on August 11, 2016 "changed getItem to return item object"
Guess I have to change every instance of getItem to getItemID...
My weekend schedule just filled up...
(case sensitive)
though you'll probably wanna search for getItem( first and keep open any stock dsp scripts so you can change them back after directory replace
Click here for a guide on scripting missions.<Giblet[NewBrain]> kj with this first step would be fine on my shit
Re: trade:getItem()
I usually download a new repository then I have a folder with all affected files. I'll copy and paste everywhere that has a //CUSTOM CODE comment. Sometimes things will change, so I'll need to tweak it a little.Do you really have that many custom trades or are you just not pulling changes form DSP master? Please tell me I haven't run into yet another user that thinks they have to manually edit their fork to get updates in doing drag n drop updates. The horrors I have seen where somebody updates source without updating scripts, and other nightmare fuel.
Explain? I'd love to know a simpler way.Please tell me I haven't run into yet another user that thinks they have to manually edit their fork to get updates in doing drag n drop updates.
Re: trade:getItem()
My original number was a little exaggerated. It's already fixed. Ended up not being many places it was used - was using hasItemQty most of the time.or.. you could just open notepad++ and directory replace getItem( with getItemID(
(case sensitive)
though you'll probably wanna search for getItem( first and keep open any stock dsp scripts so you can change them back after directory replace
Re: trade:getItem()
You can store your custom adjustments by just doing git -> stash save, pull, then pop your stash.
Re: trade:getItem()
Thanks.
I can't help but wonder what happens when you have a code conflict though.
I can't help but wonder what happens when you have a code conflict though.
Re: trade:getItem()
You "edit conflicts" in git. (if you are a tortoisegit user, do NOT choose "resolve" - doesn't do what ppl assume it does)
I edit my conflicts using tortoise's packed in diff viewer. It has a nice UI highlights all the code that needs my attention.
Pulling darkstar:master onto yourFork:yourBranch should be all you need to do to update 99% of the time, if you regularly see mountains of conflicts you should rethink what you have been doing/how you have been doing it. Examples of good practices include using block comments on npc script you are disabling and then putting your replacement code after the disabled section, and using separate files for custom SQL inserts deletions alter table and replace statements.
I edit my conflicts using tortoise's packed in diff viewer. It has a nice UI highlights all the code that needs my attention.
Pulling darkstar:master onto yourFork:yourBranch should be all you need to do to update 99% of the time, if you regularly see mountains of conflicts you should rethink what you have been doing/how you have been doing it. Examples of good practices include using block comments on npc script you are disabling and then putting your replacement code after the disabled section, and using separate files for custom SQL inserts deletions alter table and replace statements.
Hi, I run The Demiurge server.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
DO NOT PRIVATE MESSAGE ME ABOUT BUGSPLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE