-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGlobalScript.asc
128 lines (110 loc) · 3.42 KB
/
GlobalScript.asc
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
// main global script file
int room_to_go_back;
bool resetRoom;
// called when the game starts, before the first room is loaded
function game_start()
{
SetGameSpeed(60);
cDog.z = -10;
cDog.SetIdleView(DOGIDDLE1, 1);
KeyboardMovement.SetMode(eKMModePressing);
KeyboardMovement.Enable();
KeyboardMovement.SetMovementKeys(eKMMovementArrowKeys);
cBone1.ChangeRoom(TRASH);
cBone2.ChangeRoom(TRASH);
cBone3.ChangeRoom(TRASH);
cLetter1.ChangeRoom(TRASH);
cLetter2.ChangeRoom(TRASH);
cLetter3.ChangeRoom(TRASH);
cLetter4.ChangeRoom(TRASH);
cLetter5.ChangeRoom(TRASH);
cLetter6.ChangeRoom(TRASH);
cLetter7.ChangeRoom(TRASH);
cLetter8.ChangeRoom(TRASH);
cLetter9.ChangeRoom(TRASH);
cLetter10.ChangeRoom(TRASH);
cLetter11.ChangeRoom(TRASH);
gBottomGui.Transparency = 30;
}
// put anything you want to happen every game cycle in here
function repeatedly_execute()
{
if(room_to_go_back>0){
room_to_go_back = 0;
//player.ChangeRoom(room_to_go_back);
}
if(resetRoom){
resetRoom = false;
ResetRoom(1);
ResetRoom(2);
ResetRoom(3);
ResetRoom(4);
ResetRoom(5);
player.x = 21;
player.y = 284;
}
}
// put here anything you want to happen every game cycle, even when the game is blocked
function repeatedly_execute_always()
{
if(FakeSprite != null && FakeScreen.isEnabled()){
gGameScr.BackgroundGraphic = FakeSprite.Graphic;
}
if(KeyboardMovement.Moving()) {
if(button_left.NormalGraphic!= 156) {
button_left.NormalGraphic = 156;
button_right.NormalGraphic = 157;
}
} else {
if(button_left.NormalGraphic != 154){
button_left.NormalGraphic = 154;
button_right.NormalGraphic = 155;
}
}
}
// called when a key is pressed. keycode holds the key's ASCII code
function on_key_press(eKeyCode keycode)
{
if (IsGamePaused()) keycode = 0; // game paused, so don't react to keypresses
if (keycode == eKeyCtrlQ) QuitGame(1); // Ctrl-Q
if (keycode == eKeyF9) RestartGame(); // F9
if (keycode == eKeyF12) SaveScreenShot("scrnshot.pcx"); // F12
if (keycode == eKeyCtrlS) Debug(0,0); // Ctrl-S, give all inventory
if (keycode == eKeyCtrlV) Debug(1,0); // Ctrl-V, version
if (keycode == eKeyCtrlA) Debug(2,0); // Ctrl-A, show walkable areas
if (keycode == eKeyCtrlX) Debug(3,0); // Ctrl-X, teleport to room
}
function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
{
if (IsGamePaused() == 1) // Game is paused, so do nothing (ie. don't allow mouse click)
{
}
else if (button == eMouseLeft)
{
Room.ProcessClick(mouse.x,mouse.y, mouse.Mode);
}
else // right-click, so cycle cursor
{
mouse.SelectNextMode();
}
}
function dialog_request(int param) {
}
function ResetRoomButton_OnClick(GUIControl *control, MouseButton button)
{
RestoreGameSlot(2);
}
function button_left_OnClick(GUIControl *control, MouseButton button)
{
if(KeyboardMovement.GetMode() == eKMModePressing){
KeyboardMovement.SetMode(eKeyboardMovement_Tapping);
}
KeyboardMovement.FakeKeyPres(eKeyLeftArrow);
}
function button_right_OnClick(GUIControl *control, MouseButton button)
{
if(KeyboardMovement.GetMode() == eKMModePressing){
KeyboardMovement.SetMode(eKeyboardMovement_Tapping);
}
KeyboardMovement.FakeKeyPres(eKeyRightArrow);
}