Nicolas Weeger wrote: >> It'd be really help to post a plugin snippet that exhibits the bug. > > > Actually it's easy to show (my apologies for not giving enough details > once again *writes down 'give enough details next time'). > Start server, goto Goth's tavern, to the casino machine. > Drop some gold coins, and play until you get some gain. > Notice the gold coin #, you'll see it's incoherent > (you drop 50 coins, play machine, gain some, and there are only 5 on the > ground, for instance) > >> IF what your doing is doing is calling the function to create the >> object, and then the function to set the nrof, then the behaviour >> above is correct. The setquantity has no idea of past object state, >> so thus doesn't know if it should set the value absolute or add to it. >> >> The correct method then in the script would be to call getquanity on >> the item, and then add onto that. > > > I think the bug is that createobject, as used in the script, is assumed > to return a newly created object with nrof == 1. Thus using setquantity > is ok. > Which works most of the time, but not when there is already some objects > like the one being created (they get merged, thus nrof != 1) > > Nicolas 'Ryo' > The way the objects are being created now is as follows (pretend this is pseudo code even though it is Python :)) object = CFPython.CreateObject(cointype,(x,y)) <-- creates object CFPython.SetQuantity(object, payoff) <-- sets quantity I thought the second time through (you leave the coins on the floor) the new coin object would be seperate until merged (when does this happen?) This code I shamelessly lifted from the IPO scripts before I knew anything about crossfire functions (like I do now ;)). As there has not been much work done with the scritps there may be a better way this should be done. For example I found out the hard way NEVER us CFPython.RemoveObject without checking for the object first. I am trying to write some reusable scripts to show/do common things like add or remove X number of items safely or to call call the server paths so any input on this would be great. _______________________________________________ crossfire-devel mailing list crossfire-devel at lists.real-time.com https://mailman.real-time.com/mailman/listinfo/crossfire-devel