getOrderById returns null for inactive orders


  • int_max

    Game.market.getOrderById() is returning null instead of the expected order when the order is inactive. Other functions (extendOrder and cancelOrder) work as expected with same order id.

    Thanks for your help.


  • Dev Team

    @starwar15432 hey, what do you mean by 'inactive'? An order with zero remaining amount? An order that is blocked due to its terminal being full? An order tied to a destroyed terminal? Unclaimed room? Please give us more details so we can reproduce and fix the issue. Or, if the order is still in place, please specify its id so we can take a closer look.

    Thanks in advance!



  • I'm having the exact same problem: [11:02:35 AM][shard1]Order 5c27b0b56e6fa00924837c7a returns null

    The order is persistent, and only goes active / inactive. It goes inactive when the terminal is full and cannot receive more.

    When the terminal becomes available: it turns to: [11:09:34 AM][shard1]Order 5c27b0b56e6fa00924837c7a returns [object Object]

    Same order. It was never cancelled. Only difference in active/inactive status.

    Edited to add an update about 25 minutes later:

    It seems fairly clear that Game.market.get OrderById(id); only looks in the global list filtered by active status. Knowing that the ID I was looking for would always be my own order, I changed it to: Game.market.orders[order_id]; to search only in my orders... which contains all MY orders regardless of active status.

    That works fine. It always returns the object as you'd expect. What this means is Game.market.get OrderById(id); is minimally useful as it's ONLY guaranteed to work on active orders. Which... you almost certainly JUST GOT A LIST OF... so you already have all that info.



  • How about a rename to Game.market.isOrderActive(ID) should be much more accurate.



  • @mrfaul Are you saying that if we want to retrieve a specific order, we should use a renamed function called Game.market.isOrderActive(OrderId)? Is this an attempt at humour or...



  • No what I'm saying is that the function name and result are not accurate associations.
    You could also reflect it by changing the result to the correct one.


  • int_max

    @o4kapuk So, by 'active' I mean not active by the market my orders page. This has been mainly from remaining amount being 0.

    If I extend the order to cause it to become active again the function works as expected.

    An example of this is the order 5c368c3e2eab140cce899111 for room W11N1.


  • Dev Team

    @starwar15432 Thanks, I'll take a look