RandomDiceRoll Bug?

Report core bugs regarding the Ultima Online Emulator Core release (version 097). You can attach your Core Dump. One bug per post.

Moderator: POL Developer

Locked
VeNdOr
Apprentice Poster
Posts: 52
Joined: Tue Feb 07, 2006 10:36 am
Location: Rome, Italy

RandomDiceRoll Bug?

Post by VeNdOr »

i've done a test command

Code: Select all

program test(who,param)
    Sendsysmessage(who,CStr(RandomDiceRoll(param)));
endprogram
launching more times with param=2d1000+64800, here is the sequence:

281
935
587
65936
295

there is something strange :D
User avatar
Core Essence
Neophyte Poster
Posts: 38
Joined: Tue Feb 07, 2006 10:40 am
Location: Palermo, Italy

Post by Core Essence »

Up, this issue is a little bit annoying, already added some pharser to shrink the string, but the problem can still persist with higher numbers I think
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Post by Yukiko »

It sounds like it's somehow limiting the random number to 60,000 or less. Similar to the stacked item limit of 60,000.
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm
Location: Cross Lanes, WV

Post by MuadDib »

No, it seems to be where it's not reading the +- correctly, thus ignoring them. WIll have to look into that.
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm
Location: Cross Lanes, WV

Post by MuadDib »

If I get time I'll look into this soon, but everything looked as it should :/
User avatar
CWO
POL Expert
Posts: 1159
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Post by CWO »

Even though its already passed as a string, CStr() the param inside the RandomDiceRoll() and see.
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm
Location: Cross Lanes, WV

Post by MuadDib »

It's due to your large amount on the + side. It pushed the results (I believe) above 66k whatever, and that is the reason on the cutoff of the + amount.

Do the math, it comes out :)

dropping the + to +63000 works just fine every time basically. It's cuz of a limit being hit in the core. Shini would be better to answer the why to this one.

My stab is this though, it's coverting to LONG, and your range is going above that (XXXX hex ability, yours is hitting XXXXX when it breaks).
User avatar
CWO
POL Expert
Posts: 1159
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Post by CWO »

I was thinking that too Muad... its above 16-bit but I thought POL was able to handle those. Plus the one result "65936" throws off that thinking because 0xFFFF = 65535...
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm
Location: Cross Lanes, WV

Post by MuadDib »

It can, but, the specific internal functions used converts it to a unsigned long that is XXXX, which is where it breaks it.
Locked