Issue information

Issue ID
#5529
Status
Fixed
Severity
Fair
Started
Hercules Elf Bot
Mar 31, 2012 21:55
Last Post
Hercules Elf Bot
Nov 20, 2012 3:47
Confirmation
N/A

Hercules Elf Bot - Mar 31, 2012 21:55

Originally posted by [b]xRaisen[/b]
Hi,

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

[CODE]rentitem groupranditem(IG_group_item),86400;[/CODE]

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 [b]5931[/b], I change this code

[CODE]script_pushint(st,-itemdb_searchrandomid(group));[/CODE]

into this

[CODE]
script_pushint(st,itemdb_searchrandomid(group));
[/CODE]

I removed the negative and it works well.

[b]EDIT:[/b] FIXED! I found this! http://rathena.org/board/topic/60307-additional-script-command-for-math-function-absx/page__pid__96528#entry96528 you may now revert it to its original form again :)

This post has been edited by xRaisen on Apr 30, 2012 2:27

Hercules Elf Bot - Apr 2, 2012 20:48

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

Hercules Elf Bot - Apr 2, 2012 21:35

Originally posted by [b]Ind[/b]
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,
[CODE]
//Violet Box, Blue Box, etc - random item pick
if( nameid < 0 ) {
nameid = -nameid;
flag = 1;
}
[/CODE]
this code is now broken however.

This post has been edited by Ind on Apr 2, 2012 21:44

Hercules Elf Bot - Apr 2, 2012 22:06

Originally posted by [b]Epoque[/b]
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>; ?

Hercules Elf Bot - Apr 2, 2012 22:31

Originally posted by [b]xRaisen[/b]
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 [b]abs()[/b] 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.

This post has been edited by xRaisen on Apr 2, 2012 22:37

Hercules Elf Bot - Jul 1, 2012 11:51

Originally posted by [b]Ind[/b]
we need a new design for this

Hercules Elf Bot - Sep 6, 2012 20:38

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

This post has been edited by Ind on Sep 6, 2012 23:00

Hercules Elf Bot - Sep 7, 2012 8:05

Originally posted by [b]Kenpachi[/b]
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

Hercules Elf Bot - Sep 7, 2012 12:37

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

Hercules Elf Bot - Sep 7, 2012 16:00

Originally posted by [b]Ind[/b]
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.
[code]
getitem groupranditem(IG_BlueBox),1;[/code]
should become
[code]
getrandgroupitem IG_BlueBox,1;[/code]

Hercules Elf Bot - Nov 20, 2012 3:47

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