Paste #9633: Edit of P#9631 - Issue Info:

Date: 2014/09/14 04:28:04 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


on player right clicks with i@selling bag:
    - announce "Right Click"
    - define is_shopping false  
    - foreach <global.flag[playerstore].escape_contents> {
      - if <player.location.is_within[<def[value].unescaped>]> {
        - announce "Shopping is true!"
        - define is_shopping true  
        - foreach stop  
        }  
      }  
    - if !%is_shopping% {
      - Announce "Shopping Bag Clear"
      - inventory clear d:in@<player.name>_selling_bag
      - narrate '<dark_red>You are not in a shop right now!'
      - take 'i@selling bag'
      - determine cancelled
      } 


Walktrough:

################################################
STEP 1

What I did is:

- type sell
- selling bag dropped
- right click with selling bag.
- got narrated: "Right Click" and "Shopping is True!"

Conclusion:

- if <player.location.is_within[<def[value].unescaped>]> This is the cause.

###############################################
STEP 2

What I did is:

- right click with selling bag while debugging:
- Debug: http://mcmonkey.org/paste/9627
- moved outside shop
- found out this is not the issue.

Conclusion:

This is to determine that the player is in the shop as it seems.
Shopping bag clear is removal bag.

##############################################
STEP 3

What I did is:
- say sell while debugging, right click selling bag
- debug: http://mcmonkey.org/paste/9628

Conclusion:

Can't find any clear action?

#############################################
STEP 4

What I did is:
- click storekeeper with selling bag with item: Quartz Block ( 155:1 )
- Debug: http://mcmonkey.org/paste/9630

Conclusion: Found possibile Error! It seems to have saved a Diamond Pickaxe?

############################################
STEP 5

What I did is:
- reproduce step 4 with longer debug.
- click storekeeper with selling bag with item: Quartz Block ( 155:1 )
- debug: http://mcmonkey.org/paste/9632

Debug:  ( I see alot of Null's, is it supposed to be this way? )

13:18:59 [INFO] +- Executing dCommand: IF/p@NLBlackEagle ---------+ 
13:18:59 [INFO]  Filled definition %is_shopping% with 'true'. 
13:18:59 [INFO]  Filled definition %is_shopping% with 'true'. 
13:18:59 [INFO]  Filled definition %is_shopping% with 'true'. 
13:18:59 [INFO]  Filled tag <player.name> with 'NLBlackEagle'. 
13:18:59 [INFO]  Filled tag <in@NLBlackEagle_shopping_bag||null> with 
                   'in@nlblackeagle_shopping_bag'. 
13:18:59 [INFO]  Comparable 1: Logic='NEGATIVE', 
                   Comparable='Boolean(true)', Operator='EQUALS', 
                   ComparedTo='Boolean(true)' --> OUTCOME='false' 
13:18:59 [INFO] +- Executing dCommand: IF/p@NLBlackEagle ---------+ 
13:18:59 [INFO]  Filled definition %is_shopping% with 'true'. 
13:18:59 [INFO]  Filled definition %is_shopping% with 'true'. 
13:18:59 [INFO]  Filled tag <player.name> with 'NLBlackEagle'. 
13:18:59 [INFO]  Filled tag <in@NLBlackEagle_shopping_bag||null> with 
                   'in@nlblackeagle_shopping_bag'. 
13:18:59 [INFO]  Comparable 1: 
                   Comparable='Element(in@nlblackeagle_shopping_bag)', 
                   Operator='EQUALS', ComparedTo='Element(null)' --> 
                   OUTCOME='false' 
13:18:59 [INFO]  Comparable 2: Comparable='Boolean(true)', 
                   Operator='EQUALS', ComparedTo='Boolean(true)' --> 
                   OUTCOME='true'  

Conclusion:

else if <in@<player.name>_shopping_bag||null> == null && %is_shopping% { 

Null?