-
Notifications
You must be signed in to change notification settings - Fork 2
/
scraps.rb
128 lines (98 loc) · 4.53 KB
/
scraps.rb
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
10.times do
print "\r#{ msg }"
sleep 0.5
print "\r#{ ' ' * msg.size }" # Send return and however many spaces are needed.
sleep 0.5
end
# Bring the object back into Ruby
> my_saved_hash = JSON.parse(File.read("saved_hash.txt"))
# => {"name"=>"Dolph", "age"=>21}
10.times do
clr
flasher += 1
pa "\r#{text1}", :red if flasher.even?
pa "\r#{text1}", :red, :bright if flasher.odd?
pa "\n"
pa "\r#{text2}", :red if flasher.odd?
pa "\r#{text2}", :red, :bright if flasher.even?
sleep 0.01
pa "\r#{ ' ' *text2.size}"
sleep 0.01
end
h = { "a" => 100, "b" => 200 }
h.each {|key, value| puts "#{key} is #{value}" }
h = { "a" => 100, "b" => 200 }
h.each_key {|key| puts key }
%w[ant bear cat].all? { |word| word.length >= 3 } #=> true
%w[ant bear cat].all? { |word| word.length >= 4 } #=> false
%w[ant bear cat].all?(/t/) #=> false
[1, 2i, 3.14].all?(Numeric) #=> true
[nil, true, 99].all? #=> false
[].all? #=> true
return if @submenu.all? { |v| v == false}
bag.each {|id, amt| pa " (#{id}) #{Game_DB.weapons_array(id, 0)} x #{amt}"}
require 'logger'
logger = Logger.new(STDOUT)
logger.level = Logger::WARN
logger.debug("Created logger")
logger.info("Program started")
logger.warn("Nothing to do!")
path = "a_non_existent_file"
begin
File.foreach(path) do |line|
unless line =~ /^(\w+) = (.*)$/
logger.error("Line in wrong format: #{line.chomp}")
end
end
rescue => err
logger.fatal("Caught exception; exiting")
logger.fatal(err)
end
logger = Logger.new('logfile.log')
Paint%['Yellow string with a %{blue_text} in it', :yellow,
blue_text: ["blue text", :blue]
]
if id != 0
pa "(#{id}): #{value[0]} ATTACK: #{value[1]} SPEED: #{value[2]} TWO-HANDED", :green if value[3]
pa "(#{id}): #{value[0]}"; pa "\033[1A ATTACK: #{value[2]}", :red, :bright; pa "\033[1A SPEED: #{value[2]}", :green, :bright if !value[3]
pa "> COST: #{value[4]}", :green, :bright
end
if id != 0
pa "(#{id}): #{value[0]} ATTACK: #{value[1]} SPEED: #{value[2]} TWO-HANDED", :green if value[3]
pa "(#{id}): #{value[0]} ATTACK: #{value[1]} SPEED: #{value[2]}", :green if !value[3]
pa "> COST: #{value[4]}", :green, :bright
end
pa "(#{id}): #{value[0]}"; pa "\033[1A ATTACK: #{value[2]}", :red, :bright; pa "\033[1A SPEED: #{value[2]}", :green, :bright if !value[3]
pa "(#{id}): #{value[0]}"; pa "^H ATTACK: #{value[1]}", :red, :bright; pa "^H SPEED: #{value[2]}", :green, :bright
string1 = "(#{id}): #{value[0]}"; str1 = string1.size
string2 = "ATTACK: #{value[1]}"; str2 = string2.size
string3 = "SPEED: #{value[2]}"; str3 = string3.size
pa string1; pa "\033[1A \033[#{str1}C #{string2}", :red, :bright; pa "\033[1A \033[#{str2}C #{string3}", :green, :bright
- Move the cursor forward N columns:
\033[<N>C
10) Broad-L
#level reqs:
# Quest 0 -- level 4+
# Quest 1 -- level 1 to 3
3 == talk to tiny
4 == talk to rosco
" ██▀███ █ ██ ▄▄▄▄ ▓██ ██▓
▓██ ▒ ██▒ ██ ▓██▒▓█████▄▒██ ██▒
▓██ ░▄█ ▒▓██ ▒██░▒██▒ ▄██▒██ ██░
▒██▀▀█▄ ▓▓█ ░██░▒██░█▀ ░ ▐██▓░
░██▓ ▒██▒▒▒█████▓ ░▓█ ▀█▓░ ██▒▓░
░ ▒▓ ░▒▓░░▒▓▒ ▒ ▒ ░▒▓███▀▒ ██▒▒▒
░▒ ░ ▒░░░▒░ ░ ░ ▒░▒ ░▓██ ░▒░
░░ ░ ░░░ ░ ░ ░ ░▒ ▒ ░░
░ ░ ░ ░ ░
░░ ░ "
" ▄▄▄ ██▀███ ▓█████ ███▄ █ ▄▄▄
▒████▄ ▓██ ▒ ██▒▓█ ▀ ██ ▀█ █ ▒████▄
▒██ ▀█▄ ▓██ ░▄█ ▒▒███ ▓██ ▀█ ██▒▒██ ▀█▄
░██▄▄▄▄██ ▒██▀▀█▄ ▒▓█ ▄ ▓██▒ ▐▌██▒░██▄▄▄▄██
▓█ ▓██▒░██▓ ▒██▒░▒████▒▒██░ ▓██░ ▓█ ▓██▒
▒▒ ▓▒█░░ ▒▓ ░▒▓░░░ ▒░ ░░ ▒░ ▒ ▒ ▒▒ ▓▒█░
▒ ▒▒ ░ ░▒ ░ ▒░ ░ ░ ░░ ░░ ░ ▒░ ▒ ▒▒ ░
░ ▒ ░░ ░ ░ ░ ░ ░ ░ ▒
░ ░ ░ ░ ░ ░ ░ ░
"