Jump to content

  •  

Bug Tracker Migration

June 3rd
Good news everyone! The staff has decided that it is time to slowly kill off this Bug Tracker. We will begin the process of slowly migrating from this Bug Tracker over to our Github Issues which can be found here: https://github.com/HerculesWS/Hercules/issues

Over the next couple of days, I will be closing off any opportunity to create new reports. However, I still will keep the opportunity to reply to existing Bug Reports. Doing this will allow us to slowly fix any bug reports we have listed here so that we can easily migrate over to our Issue Tracker.

Update - June 7th 2015: Creating new bug posts has been disabled. Please use our https://github.com/HerculesWS/Hercules/issues tracker to post bugs. Users are still able to reply to existing bug posts.

- Administration

Issue Information

  • #005529

  • 2 - Fair

  • Fixed

Issue Confirmations

  • Yes (0)No (0)
Photo

grouprandomitem - script.c

Posted by Hercules Bot on 31 March 2012 - 09:55 PM

Originally posted by xRaisen
Hi,

I discovered this by the time I use this code in the script:

rentitem groupranditem(IG_group_item),86400;

When I examined the error and debug it, it shows that its giving a negative value. Im not sure if this a bug, but in the line 5931, I change this code

script_pushint(st,-itemdb_searchrandomid(group));

into this

script_pushint(st,itemdb_searchrandomid(group));

I removed the negative and it works well.

EDIT: FIXED! I found this! http://rathena.org/b...6528#entry96528 you may now revert it to its original form again :)

Originally posted by Epoque
You are indeed correct, odd little piece of code, I have no idea why it was like that. Fixed in [rev='15822'].

Originally posted by Ind
indeed old code thing which should be replaced with something cleaner, it was like that because of getitem's way to make a obb/opb item to drop undentified,
  //Violet Box, Blue Box, etc - random item pick
  if( nameid < 0 ) {
   nameid = -nameid;
   flag = 1;
  }
this code is now broken however.

Originally posted by Epoque
Indeed. grouprandomitem; returns negative for the getitem; script command, to signal an unidentified item. It definitely does need replacing though with a newer code, potentially a separate script command to directly retrieve an item from a group, rather than rely on the passing of an item id.

Something like getrandomitem <groupid>, <amount>; ?

Originally posted by xRaisen
Yes, it does make the item unidentified. So now I know why its negative. And that code above is now broken indeed but it doesn't produces a damaging effect though.

Maybe, adding an abs() function to the scripting feature might solve it. I think its just a short line of a code that whatever negative integer value is pass, it will return positive.

Furthermore, it will add flexibility to the scripting world of fun.

Edited by xRaisen, 02 April 2012 - 10:37 PM.


Originally posted by Ind
we need a new design for this

Originally posted by Ind
Added new design in [rev=16752], need DB developers to replace the existent code all item dbs use with the new one

Originally posted by Kenpachi
I don't get the point here. What exactly should be done?
Is GroupRandItem() outdated now? If yes, why exactly and why wasn't it removed? oO

Originally posted by EvilPuncker
because of backward compatibility I suppose? until you guys update all item_db entries

Originally posted by Ind
besides backward compatibility GroupRandItem still have some uses (e.g. the report starter's one), this function is meant for use of the official items that use the "getitem GroupRandItem(group),1;" stuff.
e.g.
getitem groupranditem(IG_BlueBox),1;
should become
getrandgroupitem IG_BlueBox,1;


Originally posted by mkbu95
Fixed in [rev=16932].