-
Notifications
You must be signed in to change notification settings - Fork 7
/
markulie-xCalc-v0.3.ms
371 lines (349 loc) · 8.49 KB
/
markulie-xCalc-v0.3.ms
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
-- xCalc
-- Description: Simple Calculator for 3ds Max
-- Version: 0.3
-- Author: Markulie
-- Created on: February 23, 2015
-- Updated on: October 28, 2022
try ( destroydialog rltxCalc ) catch()
rollout rltxCalc "xCalc 0.3"
(
local comp_Array = #( )
Listbox storedData "" pos:[0, 0] width:126 height:6
editText constructedString "" pos:[-4, 82] width:130 height:20 readOnly:true bold:true
edittext iPr "" pos:[-4, 100] width:130 height:15 readOnly:false bold:true
button btn7 "7" pos:[0, 118] width:25 height:25
button btn8 "8" pos:[25, 118] width:25 height:25
button btn9 "9" pos:[50, 118] width:25 height:25
button btn4 "4" pos:[0, 143] width:25 height:25
button btn5 "5" pos:[25, 143] width:25 height:25
button btn6 "6" pos:[50, 143] width:25 height:25
button btn1 "1" pos:[0, 168] width:25 height:25
button btn2 "2" pos:[25, 168] width:25 height:25
button btn3 "3" pos:[50, 168] width:25 height:25
button btn0 "0" pos:[25, 193] width:25 height:25
button btnDecimal "." pos:[50, 193] width:25 height:25
button btnPlus "+" pos:[75, 168] width:25 height:25
button btnMinus "-" pos:[100, 168] width:25 height:25
button btnMultiply "*" pos:[75, 143] width:25 height:25
button btnDivide "/" pos:[100, 143] width:25 height:25
button btnEquals "=" pos:[100, 193] width:25 height:25
button btnClear "C" pos:[100, 118] width:25 height:25
hyperLink author "info" address:"https://github.com/markulie" color:( color 85 110 110 ) hovercolor:( color 255 255 255 ) visitedcolor:( color 85 110 110 ) pos:[4, 198] width:25 height:25
on storedData doubleClicked itm do
(
cs = storedData.selected as string
setClipBoardText cs
)
on btn1 pressed do
(
if btnDivide.enabled == false then
(
btnDecimal.enabled = true
btnPlus.enabled = true
btnMinus.enabled = true
btnMultiply.enabled = true
btnDivide.enabled = true
btnEquals.enabled = true
btnClear.enabled = true
)
else print "Buttons Already Active"
print "Button 1"
btnV1 = 1 as string
vT = iPr.text
iPr.text = append vT btnV1
comp_Array = #( )
cUpdate = append comp_Array vT
print cUpdate
)
on btn2 pressed do
(
if btnDivide.enabled == false then
(
btnDecimal.enabled = true
btnPlus.enabled = true
btnMinus.enabled = true
btnMultiply.enabled = true
btnDivide.enabled = true
btnEquals.enabled = true
btnClear.enabled = true
)
else print "Buttons Already Active"
print "Button 2"
btnV2 = 2 as string
vT = iPr.text
iPr.text = append vT btnV2
comp_Array = #( )
cUpdate = append comp_Array vT
print cUpdate
)
on btn3 pressed do
(
if btnDivide.enabled == false then
(
btnDecimal.enabled = true
btnPlus.enabled = true
btnMinus.enabled = true
btnMultiply.enabled = true
btnDivide.enabled = true
btnEquals.enabled = true
btnClear.enabled = true
)
else print "Buttons Already Active"
print "Button 3"
btnV3 = 3 as string
vT = iPr.text
iPr.text = append vT btnV3
comp_Array = #( )
cUpdate = append comp_Array vT
print cUpdate
)
on btn4 pressed do
(
if btnDivide.enabled == false then
(
btnDecimal.enabled = true
btnPlus.enabled = true
btnMinus.enabled = true
btnMultiply.enabled = true
btnDivide.enabled = true
btnEquals.enabled = true
btnClear.enabled = true
)
else print "Buttons Already Active"
print "Button 4"
btnV4 = 4 as string
vT = iPr.text
iPr.text = append vT btnV4
comp_Array = #( )
cUpdate = append comp_Array vT
print cUpdate
)
on btn5 pressed do
(
if btnDivide.enabled == false then
(
btnDecimal.enabled = true
btnPlus.enabled = true
btnMinus.enabled = true
btnMultiply.enabled = true
btnDivide.enabled = true
btnEquals.enabled = true
btnClear.enabled = true
)
else print "Buttons Already Active"
print "Button 5"
btnV5 = 5 as string
vT = iPr.text
iPr.text = append vT btnV5
comp_Array = #( )
cUpdate = append comp_Array vT
print cUpdate
)
on btn6 pressed do
(
if btnDivide.enabled == false then
(
btnDecimal.enabled = true
btnPlus.enabled = true
btnMinus.enabled = true
btnMultiply.enabled = true
btnDivide.enabled = true
btnEquals.enabled = true
btnClear.enabled = true
)
else print "Buttons Already Active"
print "Button 6"
btnV6 = 6 as string
vT = iPr.text
iPr.text = append vT btnV6
comp_Array = #( )
cUpdate = append comp_Array vT
print cUpdate
)
on btn7 pressed do
(
if btnDivide.enabled == false then
(
btnDecimal.enabled = true
btnPlus.enabled = true
btnMinus.enabled = true
btnMultiply.enabled = true
btnDivide.enabled = true
btnEquals.enabled = true
btnClear.enabled = true
)
else print "Buttons Already Active"
print "Button 7"
btnV7 = 7 as string
vT = iPr.text
iPr.text = append vT btnV7
comp_Array = #( )
cUpdate = append comp_Array vT
print cUpdate
)
on btn8 pressed do
(
if btnDivide.enabled == false then
(
btnDecimal.enabled = true
btnPlus.enabled = true
btnMinus.enabled = true
btnMultiply.enabled = true
btnDivide.enabled = true
btnEquals.enabled = true
btnClear.enabled = true
)
else print "Buttons Already Active"
print "Button 8"
btnV8 = 8 as string
vT = iPr.text
iPr.text = append vT btnV8
comp_Array = #( )
cUpdate = append comp_Array vT
print cUpdate
)
on btn9 pressed do
(
if btnDivide.enabled == false then
(
btnDecimal.enabled = true
btnPlus.enabled = true
btnMinus.enabled = true
btnMultiply.enabled = true
btnDivide.enabled = true
btnEquals.enabled = true
btnClear.enabled = true
)
else print "Buttons Already Active"
print "Button 9"
btnV9 = 9 as string
vT = iPr.text
iPr.text = append vT btnV9
comp_Array = #( )
cUpdate = append comp_Array vT
print cUpdate
)
on btn0 pressed do
(
if btnDivide.enabled == false then
(
btnDecimal.enabled = true
btnPlus.enabled = true
btnMinus.enabled = true
btnMultiply.enabled = true
btnDivide.enabled = true
btnEquals.enabled = true
btnClear.enabled = true
)
else print "Buttons Already Active"
print "Button 0"
btnV0 = 0 as string
vT = iPr.text
iPr.text = append vT btnV0
comp_Array = #( )
cUpdate = append comp_Array vT
print cUpdate
)
on btnDecimal pressed do
(
print "Button Decimal"
btnVD = "."
btnDecimal.enabled = false
vT = iPr.text
iPr.text = append vT btnVD
)
on btnPlus pressed do
(
print "Button Plus"
vT = iPr.text
vP = constructedString.text
vtCount = iPr.text.count
vpCount = constructedString.text.count
constructedString.text = append vP ( comp_Array[1] as string + "+" )
iPr.text = ""
btnDecimal.enabled = true
)
on btnMinus pressed do
(
print "Button Minus"
vT = iPr.text
vP = constructedString.text
vtCount = iPr.text.count
vpCount = constructedString.text.count
constructedString.text = append vP ( comp_Array[1] as string + "-" )
iPr.text = ""
btnDecimal.enabled = true
)
on btnMultiply pressed do
(
print "Button Multiply"
vT = iPr.text
vP = constructedString.text
vtCount = iPr.text.count
vpCount = constructedString.text.count
constructedString.text = append vP ( comp_Array[1] as string + "*" )
iPr.text = ""
btnDecimal.enabled = true
)
on btnDivide pressed do
(
print "Button Divide"
vT = iPr.text
vP = constructedString.text
vtCount = iPr.text.count
vpCount = constructedString.text.count
constructedString.text = append vP ( comp_Array[1] as string + "/" )
iPr.text = ""
btnDecimal.enabled = true
)
on btnEquals pressed do
(
print "Button Equals"
vT = iPr.text
vP = constructedString.text
vtCount = iPr.text.count
vpCount = constructedString.text.count
for q = vpCount to vpCount do
(
if iPr.text == "" then
(
if vP[q] == "+" or vP[q] == "-" or vP[q] == "*" or vP[q] == "/" then
(
rM = 1
strNew = substring vP 1 ( vpCount - rM )
vP = strNew
)
)
else constructedString.text = append vP vT
)
fS = execute vP
storedData.items = append storedData.items ( fS as string )
iPr.text = ""
constructedString.text = ""
btnDecimal.enabled = true
)
on btnClear pressed do
(
print "Button Clear All Data"
btnDecimal.enabled = false
btnPlus.enabled = false
btnMinus.enabled = false
btnMultiply.enabled = false
btnDivide.enabled = false
btnEquals.enabled = false
btnClear.enabled = false
iPr.text = ""
constructedString.text = ""
storedData.items = #( )
)
on rltxCalc open do
(
btnDecimal.enabled = false
btnPlus.enabled = false
btnMinus.enabled = false
btnMultiply.enabled = false
btnDivide.enabled = false
btnEquals.enabled = false
)
)
createDialog rltxCalc 125 218