Date: 2014/09/14 05:32:05 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
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?
[edit] This does not seems to be a issue.
############################################
Step 6
What I did is:
Check the script closely: on click under assignment
- Found: - note 'in@selling bag' as:<player.name>_selling_bag
- Search: - note remove
Conclusion: No remove =/
###########################################
Step 7
What I did is:
- ask myself: Where the FUCK do you erase the content of the Selling bag????
} else if <npc.owner> == server {
- chat "ok let's total these items up for you then!"
- define total_price 0
- foreach <in@<player.name>_selling_bag.list_contents> {
- adjust %value% quantity:1 save:item
- define price <yaml[prices].read[prices.<<entry[item].result>.full.escaped>].mul[<%value%.qty>]>
- define total_price <el@val[%total_price%].add[%price%]>
}
- note 'in@selling bag' as:<player.name>_selling_bag
- give money qty:%total_price%
- take 'i@selling bag'
- narrate "<aqua>The shopkeeper gives you <green>%total_price% coins"
- foreach <in@<player.name>_shopping_bag.list_contents.full.escaped> {
- adjust %value% quantity:1 save:item9
- flag server <<entry[item9].result>adjust:-:<def[value].qty>
- run script:price_adjuster def:<entry[item9].result>
Conclusion:
Back to the freaking sell talk event... Since I dont see any removal here.
###########################################
Step 8
What I did is:
- being frustrated
- search on sell message.
- conclusion: Nothing there.
- search on click event with selling bag
Conclusion:
Found on player picks up i@shopping_bag.
FIX:
on player picks up i@selling bag:
- if '<player.inventory.contains[i@selling bag]>' {
- determine cancelled
} else {
- note 'in@player bag' as:<player.name>_selling_bag
- narrate "<aqua>You pick up a brand new selling bag. It's empty!"
}
##########################################