SphereServer BugTracker - SphereServer
View Issue Details
0002549SphereServerexecutable - genericpublic17-08-15 14:5929-12-15 14:21
nolok 
 
normalminoralways
confirmedopen 
 
 
Automated (specify build number)
None
None
2419
0002549: SELL/BUY not working under IF clause in @NpcRestock
On a vendor:

ON=@NpcRestock
SELL=i_dagger,2
IF 1
  SELL=i_katana,2
ENDIF


This results in a purchasable dagger but an Undefined keyword 'SELL' for the katana.
I'm using the last nightly.
No tags attached.
Issue History
17-08-15 14:59nolokNew Issue
17-08-15 19:02darksun84Note Added: 0002948
17-08-15 19:32nolokNote Added: 0002949
30-10-15 13:11XuNSummaryIF clause not working in @NpcRestock => SELL/BUY not working under IF clause in @NpcRestock
30-10-15 13:11XuNStatusnew => confirmed
15-11-15 14:41BenNote Added: 0002991
15-12-15 02:08BenNote Added: 0002997
29-12-15 14:21nolokNote Added: 0003004

Notes
(0002948)
darksun84   
17-08-15 19:02   
You have to use the BREAK keyword

 Added: "BREAK" function under @create and @npcrestock to return to normal script interpratation after an ITEM= line since any lines under it was designed to modify the item. (any BUY or SELL line will also break ITEM loop)
(0002949)
nolok   
17-08-15 19:32   
24-07-2015, XuN
Fixed 0002535: NPCRestock is now accepting code like any other triggers.

It should work without BREAK, and even with it:
ON=@NpcRestock
SELL=i_dagger,2
BREAK
IF 1
  SELL=i_katana,2
ENDIF

it doesn't work.
(0002991)
Ben   
15-11-15 14:41   
I know where this issue is. @create and @npcrestock were designed differently then the others. BUY and SELL are only present in these triggers, and when normal trigger scripting is added, it no longer recognize these keywords as it thinks it's a normal trigger.
I'll see if I can find a way to change that.
(0002997)
Ben   
15-12-15 02:08   
Been looking at this some more, and it's not an easy fix with the current engine.
There is one solution to this... Make @NPCRestock and @Create act like regular triggers and be forced to use NEW.attributehere to affect the previous item.

Example how it is now:
BUY=I_katana
COLOR=color_red

With suggested changes this would be required:
BUY=I_katana
NEW.COLOR=color_red
(0003004)
nolok   
29-12-15 14:21   
Would be it possible, in order to achieve both backwards compatibility and a good speed, to enable this suggested behaviour calling FULLINTERP at the beginning of the trigger?