forgottenserver icon indicating copy to clipboard operation
forgottenserver copied to clipboard

OnCreatureSay out of range value error

Open ghost opened this issue 3 years ago • 5 comments

Before creating an issue, please ensure:

  • [x] This is a bug in the software that resides in this repository, and not a support matter (use https://otland.net/forums/support.16/ for support)
  • [x] This issue is reproducible without changes to the C++ code in this repository

Steps to reproduce (include any configuration/script required to reproduce)

  1. Go to any shop NPC and say trade

Expected behaviour

no error

Actual behaviour

download

ghost avatar Feb 27 '22 01:02 ghost

The problem is that now we must handle numbers carefully on the lua side, in this case we are setting a negative number and getNumber expects a number of the same type. sell = -1 I guess now we should use the number 0? I'm not sure if 0 is a valid index for lua references though, or it would also work to change the type of number we expect to int instead of uint https://github.com/otland/forgottenserver/blob/d87a01521243a4e9a94f4320d58085b1edc1337f/data/npc/lib/npcsystem/modules.lua#L819

https://github.com/otland/forgottenserver/blob/7a74c3d7383ceccc77d53d6af2d6ab5cdcc90291/src/npc.cpp#L1055-L1056

MillhioreBT avatar Feb 28 '22 18:02 MillhioreBT

number 0 works fine, tested https://github.com/Zbizu/forgottenserver/commit/095a8ffb5e3e132ecef33e6a991c582f9f21d20a

there's no reason to have type different than u32 in these fields anyway

Zbizu avatar Apr 02 '22 20:04 Zbizu

number 0 works fine, tested Zbizu@095a8ff

there's no reason to have type different than u32 in these fields anyway

What if you want to sell item for free? Thus setting 0. and u64 is perfectly fine for money prices.

nekiro avatar Nov 10 '22 12:11 nekiro