Jump to content

Checkweight upgrade suggestion


Lighta

Recommended Posts


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

Hi,

so I already had that suggestion in the past : http://rathena.org/board/topic/59194-upgrade-checkweight/page__p__79979#entry79979" but I feel it was refused, well Kenpachi didn't look that interested. Nethertheless I'll retry a last time cause I feel he didn't get my point or just didn't want to bother core dev.

1st Here the diff for easier explanation : http://upaste.me/b38515856bea1995

(yes I know label are useless here etc doesn't matter)

So right now the issue is that checkweight only return true or false for chekcking space for a new item. That small return prevent to chain check like for say :

chekweight(517,500) && checkweight(516,500) <=> test 17

right now the && check will return true and true wich is true but doesn't check the total weight of both.

But that not all it also prevent slot amount check, <=> test 19.

32K overamount could also be fooled even if this one should be rare <=> test 22

Now I'm sure we may do a NPC function to fix those chaintest (I was originally planning to do so to demonstrate in the test npc), but doing so ain't the good way looking it imo :

1 - chekweight is meant to check if you have enough place in inventory so it would be change like a sub ? or even not used at all ?

2 - chekking via NPC will always be slower, just think of all the pushint, getnum, rechek if sd, recalculate slot etc when we already have all that.

3 - only bad point that I see is that is complexify a bit the chekweight command.

nb : by doing the npc I originally wrote .@succes += ChkResult().. but this failed so we may have a little issue on this.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

This suggestion is for checkweight to accept multiple sets of <item>,<amt> right?

checkweight(<item1>,<amt1>, <item2>,<amt2>, <item3>,<amt3>)

I vote yes!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  213
  • Reputation:   109
  • Joined:  05/21/12
  • Last Seen:  

This suggestion is for checkweight to accept multiple sets of <item>,<amt> right?

checkweight(<item1>,<amt1>, <item2>,<amt2>, <item3>,<amt3>)

I vote yes!

XD I asked him that, and he said no I believe. Ind understood what he was saying. I agree with this though, Brian, and I liked this idea.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

Ah sorry Cookie I tought I missunderstood, but if you look the diff you'll see that I'm checking for multiple item at once.

I was trying to say it's mean to fix check for multiple item without chaining them with if. Those if that currently won't work unless you rewrite a whole NPC function.

Question and little leak here is how many argument could be pass to a script, right now I'm taking as mush as I can and check if it's a pair but a array ref would be better to increase the nb of item that could be checked.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

For examples of script commands that accept multiple pairs of arguments, there's:

isequipped, isequippedcnt,

npcshopitem, npcshopadditem, npcshopdelitem

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

Didn't get exacly what you wanted I check there, those command read it just like I do without really checking the lenght of the list, well we do lastdata wich give us the lenght cheking if it's pair and that all.

Anyway I did a small other version with array, wich imo I found more usefull. I didn't integrate this one with the previous checkweight as he may complicate it a bit.

http://upaste.me/f6491597e6d952ad

all 32 tests succed.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  169
  • Topics Per Day:  0.04
  • Content Count:  1260
  • Reputation:   750
  • Joined:  11/19/11
  • Last Seen:  

looks good

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  213
  • Reputation:   109
  • Joined:  05/21/12
  • Last Seen:  

So, with Ind's response, I'd say we're all in favor of implementation as long as it doesn't remove the current functionality of checkweight (as Ind mentioned in IRC). I mean, that's pretty much of all us voting in favor.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  213
  • Reputation:   109
  • Joined:  05/21/12
  • Last Seen:  

Lighta implemented this in r16941.

Link to comment
Share on other sites

×
×
  • Create New...