-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconsole-script.red
87 lines (71 loc) · 2.13 KB
/
console-script.red
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
Red [
Title: ""
.links: [
]
Builds: [
0.0.0.1.1 [
6 {counter}
]
]
]
unless value? 'do-trace [
do http://redlang.red/do-trace
]
unless value? '.console [
.console: context [
set-background: function [
param>background-color
/local static>counter
/_build
/_debug
][
static>counter: []
either empty? static>counter [
append static>counter 1
][
static>counter/1: static>counter/1 + 1
]
param>font-color: white
palette>colors: [
100.99.143 ; https://htmlcolors.com/hex/64638F mauve
62.88.75 ; https://htmlcolors.com/hex/3E584B kaki
124.25.13 ; https://htmlcolors.com/hex/7C190D sang
21.12.20 ; https://htmlcolors.com/hex/150C14 marron-noir
]
n: length? (palette>colors)
;random/seed form now/precise ; 0.0.0.1.1.10 STILL BUG
random/seed now/precise ; 0.0.0.1.1.11 WORKS ***
;random/seed n ; 0.0.0.1.1.7: BUG !!!
;p: random/only n ; 0.0.0.1.1.8: STILL BUG !!!
p: random n ; 0.0.0.1.1.9: STILL BUG !!!
if _debug [
do-trace 44 [
?? n
?? p ; BUG ???? always 1
] %console-script.11.red
]
if param>background-color = 'random [
param>background-color: pick palette>colors (p)
]
gui-console-ctx/set-background (param>background-color)
gui-console-ctx/set-font-color (param>font-color)
]
]
]
unless value? 'console [
console: .console
]
.console-ctx: context [
block-args: system/options/args
args: system/script/args
.console/set-background 'random
..do-script-arg: function [][
unless none? block-args [
if find script: block-args/1 "http" [
script: to-url script
do script
]
]
]
..do-script-arg
]