Date: 2014/04/08 13:17:22 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
172
173
174
175
176
177
"BuyHouse":
type: assignment
interact scripts:
- 10 menu
default constants:
h1: 4000
h2: 3000
h3: 3000
h4: 3000
h5: 3000
h6: 3000
h7: 3000
h8: 3000
h9: 3000
h10: 3000
h11: 3000
h12: 3000
h13: 3000
h14: 3000
h15: 3000
h16: 3000
h17: 3000
h18: 3000
h19: 3000
h20: 3000
h21: 3000
menu:
type: interact
steps:
1:
click trigger:
script:
- ^run "BuyHouseHeader"
- ^narrate "<red> <npc.name><&sc> <blue>Buy a house in town?"
- ^narrate "<blue> You can list all the houses by typing <dark_purple>List 1"
- ^narrate "<blue> And to buy a house just type for example <dark_purple>Buy 2"
- ^narrate ""
- ^narrate "<gold><&lb>Hint <&co> Buy <&lb>house number<&rb>, List <&lb>page<&rb><&rb>"
- ^zap step:1
chat trigger:
1:
trigger: /REGEX:(?i)list\s\d+$/
script:
- ^run "BuyHouseHeader"
- ^narrate "<red> Houses"
- ^narrate "<green> <&ns>, Owner, Initial Cost, Daily cost"
- ^define lstHouses "<global.flag[HOUSES].as_list>"
- ^define page "<context.message.substring[6]>"
- ^if <%page%> == 2 {
- ^narrate "<blue> 6. <%lstHouses%.get[5]>, <gold>$<npc.constant[h6]><blue>, <gold>$50"
- ^narrate "<blue> 7. <%lstHouses%.get[6]>, <gold>$<npc.constant[h7]><blue>, <gold>$50"
- ^narrate "<blue> 8. <%lstHouses%.get[7]>, <gold>$<npc.constant[h8]><blue>, <gold>$50"
- ^narrate "<blue> 9. <%lstHouses%.get[8]>, <gold>$<npc.constant[h9]><blue>, <gold>$50"
- ^narrate "<blue> 10. <%lstHouses%.get[9]>, <gold>$<npc.constant[h10]><blue>, <gold>$50"
}
else if <%page%> == 3 {
- ^narrate "<blue> 11. <%lstHouses%.get[10]>, <gold>$<npc.constant[h11]><blue>, <gold>$50"
- ^narrate "<blue> 12. <%lstHouses%.get[11]>, <gold>$<npc.constant[h12]><blue>, <gold>$50"
- ^narrate "<blue> 13. <%lstHouses%.get[12]>, <gold>$<npc.constant[h13]><blue>, <gold>$50"
- ^narrate "<blue> 14. <%lstHouses%.get[13]>, <gold>$<npc.constant[h14]><blue>, <gold>$50"
- ^narrate "<blue> 15. <%lstHouses%.get[14]>, <gold>$<npc.constant[h15]><blue>, <gold>$50"
}
else if <%page%> == 4 {
- ^narrate "<blue> 16. <%lstHouses%.get[15]>, <gold>$<npc.constant[h16]><blue>, <gold>$50"
- ^narrate "<blue> 17. <%lstHouses%.get[16]>, <gold>$<npc.constant[h17]><blue>, <gold>$50"
- ^narrate "<blue> 18. <%lstHouses%.get[17]>, <gold>$<npc.constant[h18]><blue>, <gold>$50"
- ^narrate "<blue> 19. <%lstHouses%.get[18]>, <gold>$<npc.constant[h19]><blue>, <gold>$50"
- ^narrate "<blue> 20. <%lstHouses%.get[19]>, <gold>$<npc.constant[h20]><blue>, <gold>$50"
}
else if <%page%> == 5 {
- ^narrate "<blue> 21. <%lstHouses%.get[20]>, <gold>$<npc.constant[h21]><blue>, <gold>$50"
}
else {
- ^narrate "<blue> 1. <%lstHouses%.get[0]>, <gold>$<npc.constant[h1]><blue>, <gold>$50"
- ^narrate "<blue> 2. <%lstHouses%.get[1]>, <gold>$<npc.constant[h2]><blue>, <gold>$50"
- ^narrate "<blue> 3. <%lstHouses%.get[2]>, <gold>$<npc.constant[h3]><blue>, <gold>$50"
- ^narrate "<blue> 4. <%lstHouses%.get[3]>, <gold>$<npc.constant[h4]><blue>, <gold>$50"
- ^narrate "<blue> 5. <%lstHouses%.get[4]>, <gold>$<npc.constant[h5]><blue>, <gold>$50"
}
- ^narrate ""
- ^narrate "<Gold><&lb>Hint <&co> Buy <&lb>house number<&rb>, List <&lb>page<&rb><&rb>"
- ^narrate ""
- ^zap step:1
2:
trigger: /REGEX:(?i)buy\s\d+$/
script:
- ^run "BuyHouseHeader"
- ^define lstHouses "<global.flag[HOUSES].as_list>"
- ^define house <context.message.substring[5].as_int.sub[1]>
- ^define houseData "<%lstHouses%.get[<%house%>]>"
- ^if <%houseData%> == "Available" {
- ^flag <player> buyHouse:<%house%>
- ^narrate "<red><npc.name>; <blue>This house will cost <gold>$<npc.constant[h<context.message.substring[5].as_int>]><blue> initialy and <gold>$50<blue> per day."
- ^narrate ""
- ^narrate "<blue>Do you like to buy house <context.message.substring[5]>?"
- ^narrate ""
- ^narrate "<gold><&lb>Hint <&co> Yes, No<&rb>"
- ^zap step:2
}
else {
- ^narrate "<red><npc.name>; <blue>This house belongs to <red><%houseData%><blue>."
- ^narrate "<blue>Pick another house or maybe ask the owner if you could buy it."
- ^zap step:1
}
3:
trigger: /REGEX:\w+/
script:
- ^run "BuyHouseHeader"
- ^narrate "<red> <npc.name>; <blue>Buy a house in town?"
- ^narrate "<blue> You can list all the houses by typing <dark_purple>List 1"
- ^narrate "<blue> And to buy a house just type for example <dark_purple>Buy 2"
- ^narrate ""
- ^narrate "<gold><&lb>Hint <&co> Buy <&lb>house number<&rb>, List <&lb>page<&rb><&rb>"
- ^narrate ""
- ^zap step:1
2:
click trigger:
script:
- ^run "BuyHouseHeader"
- ^narrate "<red> <npc.name>; <blue>Buy a house in town?"
- ^narrate "<blue> You can list all the houses by typing <dark_purple>List 1"
- ^narrate "<blue> And to buy a house just type for example <dark_purple>Buy 2"
- ^narrate ""
- ^narrate "<gold><&lb>Hint <&co> Buy <&lb>house number<&rb>, List <&lb>page<&rb><&rb>"
- ^narrate ""
- ^zap step:1
chat trigger:
1:
trigger: "/Yes/"
script:
- ^run "BuyHouseHeader"
- ^if <player.money> > <npc.constant[h<player.flag[buyHouse].as_int.add[1]>]> {
- ^narrate "<red><npc.name>; <blue>This house costs <gold>$<npc.constant[h<player.flag[buyHouse].as_int.add[1]>]><blue>. You only have <gold>$<player.money><blue>."
- ^narrate ""
- ^narrate ""
- ^narrate ""
- ^narrate ""
- ^narrate ""
- ^zap step:1
}
else {
- ^define lstHouses "<global.flag[HOUSES].as_list>"
- ^define test 0
- ^define counter 0
- ^flag global HOUSES:!
- ^foreach %lstHouses% {
- ^define variable <def[%variable%].as_int.add[1]>
- ^narrate "%variable% <el@value[%loop_index%]>"
}
- ^take money qty:<npc.constant[h<player.flag[buyHouse].as_int.add[1]>]>
- ^narrate "<Red><npc.name>; <Blue> Congratulations! You are now the owner of house <player.flag[buyHouse]>"
- ^narrate ""
- ^narrate ""
- ^narrate ""
- ^narrate ""
- ^narrate ""
- ^zap step:1
}
2:
trigger: /REGEX:\w+/
script:
- ^run "BuyHouseHeader"
- ^narrate "<red> <npc.name>; <blue>Buy a house in town?"
- ^narrate "<blue> You can list all the houses by typing <dark_purple>List 1"
- ^narrate "<blue> And to buy a house just type for example <dark_purple>Buy 2"
- ^narrate ""
- ^narrate "<gold><&lb>Hint <&co> Buy <&lb>house number<&rb>, List <&lb>page<&rb><&rb>"
- ^narrate ""
- ^zap step:1
"BuyHouseHeader":
type: task
script:
- ^narrate ""
- ^narrate "<green>----------------------<red> Buy House <green>---------------------"
- ^narrate ""