-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathElevines script - named variables.cos
217 lines (193 loc) · 5.6 KB
/
Elevines script - named variables.cos
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
**CAOS2PRAY
*# Pray-File "elevines.agents"
*# DS-Name "Elevines"
*# Depend blnk.c16
*# attach elevinehelp.catalogue elevines.c16
*# desc = "An easy-to-use custom elevator system. Read the help file included for details. Lovely sprites by Mea."
*# Agent Animation File = "elevines.c16"
*# Agent Sprite First Image = 4
*# Agent Animation Gallery = "elevines"
*# Web URL = "naturingnurturing.blogspot.com"
*# Web Label = "Naturing :: Nurturing"
agent_variable $unique_id ov00
agent_variable $unique_pose ov96
agent_variable $unique_tintr ov97
agent_variable $unique_tintg ov98
agent_variable $unique_tintb ov99
constant :elevine_classifier 3 1 21051
constant :elevine_clac_script 1000
constant :key_shift 16
constant :key_ctrl 17
constant :noun_elevator 26
constant :verb_reset -1
constant :stimulus_disappoint 0
constant :stimulus_wait 75
constant :stimulus_travelled_in_lift 94
constant :script_activate_1 1
constant :script_activate_2 2
constant :script_timer 9
macro CreateElevine parent
*lift teleporting ball things.
new: comp :elevine_classifier "elevines" 13 4 2000
*parts-- 1, top button, 2, bottom
pat: dull 1 "elevines" 0 6 21 1
pat: dull 2 "elevines" 2 12 72 1
clac :elevine_clac_script
bhvr 3 * activate 1 (1) activate 2 (2)
tick 30
attr 198 * ouse pickupable (2) mouseclickable (4) collisions (64) physics (128)
accg 30
elas 20
fric 100
perm 100
*targ.$unique_tintg and 99 are going to be the random tints, targ.$unique_tintr is the random -pose-
doif $parent = null
setv targ.$unique_pose rand 0 12
setv targ.$unique_tintr rand 50 200
setv targ.$unique_tintg rand 50 200
setv targ.$unique_tintb rand 50 200
else
setv targ.$unique_pose $parent.$unique_pose
setv targ.$unique_tintr $parent.$unique_tintr
setv targ.$unique_tintg $parent.$unique_tintg
setv targ.$unique_tintb $parent.$unique_tintb
endi
pose targ.$unique_pose
tint targ.$unique_tintr targ.$unique_tintg targ.$unique_tintb 128 128
*We'll base your ID number off your tints, just for fun:
sets targ.$unique_id vtos targ.$unique_tintr
adds targ.$unique_id vtos targ.$unique_tintg
adds targ.$unique_id vtos targ.$unique_tintb
endmacro
macro TeleportCreature targetring creature
doif from = null or from.fmly <> 4
stop
endi
*So $targetring should be the ideal ring to tele to now
*assuming there is one.
*if there's NOT, stop this whole thing now!
doif $targetring eq null
*put a bug in it's ear-- stop pushing this!
urge writ from :noun_elevator -2 :verb_reset 2
stim writ from :stimulus_disappoint 1
sndc "buzz"
stop
endi
*if it's being carried (like by the hand), stop
doif $targetring.movs ne 0
stop
endi
* make sure the creature's not being carried
doif from.movs <> 0
stop
endi
*if it's not a VALID PLACE make a sndc
doif from.tmvf $targetring.posx $targetring.posb <> 1
sndc "buzz"
stop
endi
*Lock it out from creatures for a second!
$targetring.tick $targetring.tick
$targetring.attr 214
from.mvft $targetring.posx $targetring.posb
* tell the norn it just travled
* and it needs to wait?
* tell the norn to STOP now..
* and make some dingysound
stim writ from :stimulus_travelled_in_lift 1
stim writ from :stimulus_wait 1
urge writ from :noun_elevator -2 :verb_reset 2
sndc "snap"
stop
endmacro
*Create initial elevine, and move it where it belongs:
CreateElevine null
doif game "CreatorX" > 0 and game "CreatorY" > 0
mvsf game "CreatorX" game "CreatorY"
else
mvsf 6110 9200
endi
*Push -- Want to go up
scrp :elevine_classifier :script_activate_1
inst
lock
*first off, is it actually possible to go up?
seta $targetring null
enum :elevine_classifier
doif ownr.$unique_id = targ.$unique_id and posy < ownr.posy
*herein lies the tricky part-- you want it to be lower than the ring
*being pushed, but higher than the rest.
doif $targetring = null or posy > $targetring.posy
seta $targetring targ
endi
endi
next
TeleportCreature $targetring from
endm
*Pull -- Want to go down
scrp :elevine_classifier :script_activate_2
inst
lock
*first off, is it actually possible to go down?
seta $targetring null
enum :elevine_classifier
doif ownr.$unique_id = targ.$unique_id and posy > ownr.posy
*herein lies the tricky part-- you want it to be higher than the ring
*being pushed, but lower than the rest.
doif $targetring = null or posy < $targetring.posy
seta $targetring targ
endi
endi
next
TeleportCreature $targetring from
endm
*you've been CLICKED or clac'd or something
scrp :elevine_classifier :elevine_clac_script
inst
*Here is how it works....
*shift+click creates a copy of the same OV
*ctrl+click creates a copy of a new OV
*shift+click kills it.
doif keyd :key_shift eq 1 and keyd :key_ctrl eq 0
sndc "opn1"
CreateElevine ownr
*move it to the old one, and make it hop a bit
mvsf ownr.posl ownr.post
velo 15 100
elif keyd :key_shift eq 0 and keyd :key_ctrl eq 1
sndc "unlk"
CreateElevine null
*move it to the old one, and make it hop a bit
mvsf ownr.posl ownr.post
velo 15 100
elif keyd :key_shift eq 1 and keyd :key_ctrl eq 1
kill ownr
endi
endm
*Meh. I tried to avoid using a timer for this but it's just
*SO MUCH MORE FLUID with it. ]:
scrp :elevine_classifier :script_timer
inst
*reset the attr if it's been changed
attr 198 *mouse pickupable (2) mouseclickable (4) collisions (64) physics (128)
* the indicator orbs change color. Yay.
setv $ishigher 0
setv $islower 0
enum :elevine_classifier
doif ownr.$unique_id = targ.$unique_id
doif posy < ownr.posy
setv $ishigher 1
elif posy > ownr.posy
setv $islower 1
endi
endi
next
part 1
pose $ishigher
part 2
pose $islower
endm
rscr
enum :elevine_classifier
kill targ
next