Skip to content

Commit 90b3552

Browse files
authored
.pressed deprecation
1 parent 24b5d01 commit 90b3552

File tree

19 files changed

+106
-1570
lines changed

19 files changed

+106
-1570
lines changed

Catalogue/oki/Versions/OkiV1.osl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ def "run_movement"
4646
prevx = playerx
4747
prevy = playery
4848

49-
if up.pressed "playeryvel += speed"
50-
if down.pressed "playeryvel -= speed"
51-
if left.pressed "playerxvel -= speed"
52-
if right.pressed "playerxvel += speed"
49+
if up.isKeyDown() "playeryvel += speed"
50+
if down.isKeyDown() "playeryvel -= speed"
51+
if left.isKeyDown() "playerxvel -= speed"
52+
if right.isKeyDown() "playerxvel += speed"
5353
// changes the player velocity based on keys pressed
5454

5555
playerxvel *= 0.6
@@ -71,7 +71,7 @@ def "run_movement"
7171
endef
7272

7373
def "run_interactions"
74-
if "e".pressed.not "can = true"
74+
if "e".isKeyDown().not "can = true"
7575
// makes sure that you cannot interact again until you finish the current interaction
7676

7777
current_interactables = interactables.key(map_location)
@@ -94,34 +94,34 @@ def "run_interactions"
9494
endef
9595

9696
def "run_animator"
97-
if anim_start != 1 and up.pressed.not and left.pressed.not and right.pressed.not and down.pressed.not (
97+
if anim_start != 1 and up.isKeyDown().not and left.isKeyDown().not and right.isKeyDown().not and down.isKeyDown().not (
9898
anim_start = 1
9999
anim_frame = 1
100100
anim_length = 4
101101
)
102102

103-
if current_anim != "up" and up.pressed (
103+
if current_anim != "up" and up.isKeyDown() (
104104
anim_start = 5
105105
anim_frame = 5
106106
anim_length = 10
107107
current_anim = "up"
108108
)
109109

110-
if current_anim != "left" and left.pressed (
110+
if current_anim != "left" and left.isKeyDown() (
111111
anim_start = 5
112112
anim_frame = 5
113113
anim_length = 10
114114
current_anim = "left"
115115
)
116116

117-
if current_anim != "down" and down.pressed (
117+
if current_anim != "down" and down.isKeyDown() (
118118
anim_start = 5
119119
anim_frame = 5
120120
anim_length = 10
121121
current_anim = "down"
122122
)
123123

124-
if current_anim != "right" and right.pressed (
124+
if current_anim != "right" and right.isKeyDown() (
125125
anim_start = 5
126126
anim_frame = 5
127127
anim_length = 10
@@ -299,20 +299,20 @@ if anim_frame > anim_length "anim_frame = anim_start"
299299
// animator, loops through frames of current player animation
300300

301301
speed = 4
302-
if "shift".pressed "speed += 3"
302+
if "shift".isKeyDown() "speed += 3"
303303
// sprint and speed system
304304

305305
if load_animate.not (
306306
image current_room game_scale
307307
// draws the room background
308308
)
309309

310-
if anim_start != 1 or up.pressed or left.pressed or right.pressed or down.pressed (
310+
if anim_start != 1 or up.isKeyDown() or left.isKeyDown() or right.isKeyDown() or down.isKeyDown() (
311311
run_animator
312312
// controls the movement animations of the player
313313
)
314314

315-
if "any".pressed and load_animate.not (
315+
if "any".isKeyDown() and load_animate.not (
316316
// This is a very good optimisation, these files are laggy
317317

318318
run_movement

Modules/character_controller.osl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@ def "setup"
66
endef
77

88
def "main" "this.speed"
9-
if "w".pressed (
9+
if "w".isKeyDown() (
1010
cam_pos[1] += cam_rotation[1].sin * this.speed
1111
cam_pos[3] += cam_rotation[1].cos * this.speed
1212
)
13-
if "s".pressed (
13+
if "s".isKeyDown() (
1414
cam_pos[1] -= cam_rotation[1].sin * this.speed
1515
cam_pos[3] -= cam_rotation[1].cos * this.speed
1616
)
17-
if "d".pressed (
17+
if "d".isKeyDown() (
1818
cam_pos[1] += (cam_rotation[1] + 90).sin * this.speed
1919
cam_pos[3] += (cam_rotation[1] + 90).cos * this.speed
2020
)
21-
if "a".pressed (
21+
if "a".isKeyDown() (
2222
cam_pos[1] -= (cam_rotation[1] + 90).sin * this.speed
2323
cam_pos[3] -= (cam_rotation[1] + 90).cos * this.speed
2424
)
25-
if "left arrow".pressed (
25+
if "left arrow".isKeyDown() (
2626
cam_rotation[1] -= 100 * delta_time
2727
)
28-
if "right arrow".pressed (
28+
if "right arrow".isKeyDown() (
2929
cam_rotation[1] += 100 * delta_time
3030
)
31-
if "up arrow".pressed (
31+
if "up arrow".isKeyDown() (
3232
cam_rotation[2] += 100 * delta_time
3333
)
34-
if "down arrow".pressed (
34+
if "down arrow".isKeyDown() (
3535
cam_rotation[2] -= 100 * delta_time
3636
)
3737

Modules/console.osl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def run_ui() (
5151
)
5252

5353
def mainloop(this.callback) (
54-
if "shift".pressed and "control".pressed and "c".onpress (
54+
if "shift".isKeyDown() and "control".isKeyDown() and "c".onKeyDown() (
5555
self.width = 300 - self.width
5656
)
5757
frame window.left window.top window.right - self.width window.bottom

OSL Programs/apps/Autoclicker Process.osl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ window "responsive" true
22
window "dimensions" 0 0
33
permission "request" "simulate inputs"
44
mainloop:
5-
if "space".pressed (
5+
if "space".isKeyDown() (
66
simulate "leftclick" mouse_x mouse_y
7-
)
7+
)
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dock = [
1616

1717
def "open_app" "app_data"
1818
current_app = app_data
19-
app_code = app_data."code".split(newline)
19+
app_code = app_data.code.split(newline)
2020
endef
2121

2222
def "home"
@@ -28,7 +28,7 @@ def "home"
2828
text hour ++ ":" ++ minute 8 : c#fff
2929
loc -2 2 -15 -15
3030
icon "w 3 cutcircle 0 -6 14 0 50 cutcircle 0 -6 7 0 50 w 4 dot 0 -6" 0.7
31-
if network."connected".not (
31+
if network.connected.not() (
3232
icon "w 3 line 10 10 -10 -10" 0.7
3333
)
3434
btry = battery_percent
@@ -45,8 +45,8 @@ def "home"
4545
loc -2 -2 30 30
4646
pen "up"
4747
loc 2 -2 45 30
48-
each "i" "app" dock.trim(1,4) (
49-
icon app."icon" 2 : cursor#pointer
48+
each i app dock.trim(1,4) (
49+
icon app.icon 2 : cursor#pointer
5050
if onclick (
5151
open_app app
5252
)
@@ -55,6 +55,7 @@ def "home"
5555
endef
5656

5757
mainloop:
58+
5859
if current_app == "" (
5960
home
6061
) else (

OSL Programs/apps/Console_Triangle.osl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ for i amt (
1010
console "log" g
1111
)
1212
mainloop:
13-
console "run_ui"
13+
console "run_ui"
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
import "win-buttons"
22
get = 0
33
mainloop:
4+
45
loc 2 2 100 -30
56
c #333
67
input 100 25 "search"
7-
if "enter".pressed (
8+
9+
if "enter".isKeyDown() (
810
get = "https://api.dictionaryapi.dev/api/v2/entries/en/" ++ input_search
911
)
12+
1013
if get != 0 (
11-
network "get" get
12-
data = data.[1]."meanings".replace(".","")
14+
network "get" get
15+
data = data[1].meanings.replace(".","")
1316
)
17+
1418
loc 2 2 20 -50
1519
count = 0
1620
loop data.len (
1721
count += 1
18-
loc 2 2 20 -50 - ( count * 20 )
19-
text data.[count]."definitions".[1] 10 : c#fff
20-
)
22+
loc 2 2 20 -50 - (count * 20)
23+
text data[count].definitions[1] 10 : c#fff
24+
)

OSL Programs/apps/Google_maps.osl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ camy = 3143
33
window "show"
44
zoom = 200
55
mainloop:
6-
if "q".pressed "zoom -= 10"
7-
if "e".pressed "zoom += 10"
8-
if "w".pressed "camy -= 0.2"
9-
if "a".pressed "camx -= 0.2"
10-
if "s".pressed "camy += 0.2"
11-
if "d".pressed "camx += 0.2"
6+
if "q".isKeyDown() "zoom -= 10"
7+
if "e".isKeyDown() "zoom += 10"
8+
if "w".isKeyDown() "camy -= 0.2"
9+
if "a".isKeyDown() "camx -= 0.2"
10+
if "s".isKeyDown() "camy += 0.2"
11+
if "d".isKeyDown() "camx += 0.2"
1212
displx = camx.floor
1313
disply = camy.floor
1414
loc 2 2 20 -20

0 commit comments

Comments
 (0)