Snippets

Wen Shi Some Scripts for Living, Dead

Created by Wen Shi last modified
  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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
// main global script file for Living Dead
// By me! Hello Bitbucket, who does not have as3 text highlighting. 

//Have some definitions for the sprites that will show the 
//selected state of actions. 

#define BTN_LOOK_UNSELECTED 16
#define BTN_LOOK_SELECTED 39
#define BTN_TALK_UNSELECTED 18
#define BTN_TALK_SELECTED 43 
#define BTN_PICKUP_UNSELECTED 17
#define BTN_PICKUP_SELECTED 41
#define BTN_USE_UNSELECTED 19
#define BTN_USE_SELECTED 45

#define BTN_LOOK_MOUSEOVER 31
#define BTN_TALK_MOUSEOVER 33
#define BTN_PICKUP_MOUSEOVER 32
#define BTN_USE_MOUSEOVER 32
#define BTN_WALK_MOUSEOVER 30

#define ATTACK1 35
#define ATTACK2 36
#define ATTACK3 37


//function for mouse

function UpdateMouseModeButtons()
{
  if (Mouse.Mode == eModeLookat)
  {
    btnLookAt.NormalGraphic = BTN_LOOK_SELECTED;
   
   //Mouse.UseModeGraphic(eModeWait); //make it the graphic of "WAIT"
      //aka the "eat", without making it actually eat. 
    
  }
  else
  {
    btnLookAt.NormalGraphic = BTN_LOOK_UNSELECTED;
    //btnLookAt.MouseOverGraphic = BTN_LOOK_MOUSEOVER;
  }
  
  if (Mouse.Mode == eModeInteract)
  {
    btnUse.NormalGraphic = BTN_USE_SELECTED;
    //btnUse.MouseOverGraphic = BTN_USE_SELECTED;
  }
  else
  {
    btnUse.NormalGraphic = BTN_USE_UNSELECTED;
    //btnUse.MouseOverGraphic = BTN_USE_MOUSEOVER;
  }
  
  if (Mouse.Mode == eModeTalkto)
  {
    btnTalkTo.NormalGraphic = BTN_TALK_SELECTED;

   // btnTalkTo.MouseOverGraphic = BTN_TALK_SELECTED;
  }
  else
  {
    btnTalkTo.NormalGraphic = BTN_TALK_UNSELECTED;
   // btnTalkTo.MouseOverGraphic = BTN_TALK_MOUSEOVER;
  }
  
   if (Mouse.Mode == eModePickup)
  {
    btnPickUp.NormalGraphic = BTN_PICKUP_SELECTED;
   // btnTalkTo.MouseOverGraphic = BTN_TALK_SELECTED;
  }
  else
  {
    btnPickUp.NormalGraphic = BTN_PICKUP_UNSELECTED;
   // btnTalkTo.MouseOverGraphic = BTN_TALK_MOUSEOVER;
  }
  
    if(player.Room == 12) //If on last one, they are all ATTACK/HUNGRY
  {
    btnPickUp.NormalGraphic = ATTACK2;
    btnPickUp.MouseOverGraphic = ATTACK3;
    btnPickUp.PushedGraphic = ATTACK3;
   
    btnLookAt.NormalGraphic = ATTACK2;
    btnLookAt.MouseOverGraphic = ATTACK3;
    btnLookAt.PushedGraphic = ATTACK1;
    
    btnUse.NormalGraphic = ATTACK2;
    btnUse.MouseOverGraphic = ATTACK3;
    btnUse.PushedGraphic = ATTACK1;
    
    btnTalkTo.NormalGraphic = ATTACK2;
    btnTalkTo.MouseOverGraphic = ATTACK3;
    btnTalkTo.PushedGraphic = ATTACK1;
    
    
    //change the mouse!
    Mouse.UseModeGraphic(eModePointer);
    
  }
}

// called when the game starts, before the first room is loaded
function game_start() {}

// put anything you want to happen every game cycle in here
function repeatedly_execute() {}

// put here anything you want to happen every game cycle, even when the game is blocked
function repeatedly_execute_always() {}

// 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) 
  {
    ProcessClick(mouse.x,mouse.y, mouse.Mode);
  }
  else // right-click, so cycle cursor
  {   
    mouse.SelectNextMode();
    UpdateMouseModeButtons();
  }
}


function dialog_request(int param) {}


//==========================================================================================
//
// GUI - OPENING AND CLOSING THE PANEL
//
//========================================================================================

function gPanel_OnClick(GUI *theGui, MouseButton button)
{
    Mouse.Mode = eModeWalkto;
}

function ButtonOpenPanel()
{
  gPanel.Visible = true;  
  btnOpener.Visible = false;
  btnCloser.Visible = true;
  gPanelOpener.Visible = false;
  gPanelCloser.Visible = true;
  
  if(!isPanelFirstOpen) //if it's the first time opening the panel
  //get rid of the "click here" button!
  {
    isPanelFirstOpen = true;
   gClick.Visible = false;
  }
}

function ButtonClosePanel()
{
  gPanel.Visible = false;  
  btnOpener.Visible = true;
  btnCloser.Visible = false;
  gPanelOpener.Visible = true;
  gPanelCloser.Visible = false;
}

function btnOpener_OnClick(GUIControl *control, MouseButton button)
{
  ButtonOpenPanel();
}

function btnCloser_OnClick(GUIControl *control, MouseButton button)
{
   ButtonClosePanel();
}


//==========================================================================================
//
// GUI- QUIT MENU , YES/NO BUTTONS, HIDING AND SHOWING PANELS.
//
//========================================================================================

function btnQuit_OnClick(GUIControl *control, MouseButton button)
{
  gQuitPanel.Visible = true;
  mouse.Mode = eModeWalkto;
}

function btnYesQuit_OnClick(GUIControl *control, MouseButton button)
{
  QuitGame(false); //QuitGame(true) would prompt are you sure...etc. 
}

function btnNoQuit_OnClick(GUIControl *control, MouseButton button)
{
  gQuitPanel.Visible = false;
  mouse.Mode = eModeLookat;
  UpdateMouseModeButtons();
}


//==========================================================================================
//
// GUI- CHANGING THE CURSOR BUTTONS
//
//========================================================================================


//For buttons: Changing the cursors
function btnLookAt_OnClick(GUIControl *control, MouseButton button)
{
  Mouse.Mode = eModeLookat;
  UpdateMouseModeButtons();
  
  //change over time/on condition
  if(player.Room >= 7 && player.Room <= 11)
  {
    btnLookAt.PushedGraphic = ATTACK2;
  }
}

function btnUse_OnClick(GUIControl *control, MouseButton button)
{
  Mouse.Mode = eModeInteract;
  UpdateMouseModeButtons();
}

function btnTalkTo_OnClick(GUIControl *control, MouseButton button)
{
  Mouse.Mode = eModeTalkto;
  UpdateMouseModeButtons();
     if(player.Room >= 8 && player.Room <= 11)
    {
      //btnLookAt.MouseOverGraphic = 36;
      btnTalkTo.NormalGraphic = ATTACK1;
      btnTalkTo.MouseOverGraphic = ATTACK2;
      btnTalkTo.PushedGraphic = ATTACK2;
    }
}

function btnPickUp_OnClick(GUIControl *control, MouseButton button)
{
  Mouse.Mode = eModePickup;
  UpdateMouseModeButtons();
  
    if(player.Room >= 8 && player.Room <= 11)
    {
      //btnLookAt.MouseOverGraphic = 36;
      btnPickUp.MouseOverGraphic = ATTACK2;
      btnPickUp.PushedGraphic = ATTACK2;
    }
  
  //SET THE MOUSE GRAPHIC - DO THIS FOR ATTACKING
  //btnPickUp.MouseOverGraphic = 5;
}

//==========================================================================================
//
// GUI- < and > INVENTORY BUTTONS (no longer used) ;-;
// This was good for practice though!
//
//========================================================================================


//Code for stepping through left and right click
function btnInvRight_OnClick(GUIControl *control, MouseButton button)
{
  if ((invMainInventory.TopItem
      + (invMainInventory.ItemsPerRow * invMainInventory.RowCount)) < invMainInventory.ItemCount)
    {
      invMainInventory.TopItem = invMainInventory.TopItem + 1;
    }
}

function btnInvLeft_OnClick(GUIControl *control, MouseButton button)
{
if (invMainInventory.TopItem > 0)
  {
    invMainInventory.TopItem = invMainInventory.TopItem - 1;
  }
}

//==========================================================================================
//
// INVENTORY - SPECIFIC OBJECT ACTIONS
//
//========================================================================================


function iEnergyDrink_Look()
{
  //ActionLine.Text = "it's a can!";
  player.Say("Lorem Ipsum is simply dummy text of the printing and");
  //52 Chars in one line.
  //MyLabel.Text = "A can of drink";
}


function iDrink2_Look()
{
 // player.Say("test");
  gExamine.Visible = true;
  
}

//==========================================================================================
//
// ROOMS- DEFAULT OBJECT ACTIONS
// Having functions to cycle between 3 choices, with selection at random
// What do 
//
//========================================================================================


// GENERIC RESPONSES

//looking at an inanimate object.
function Default_LookAt_Inanimate()
{
  int choice = Random(2);
  if (choice == 0)
  {
    player.Say("Grrr (not food)");
  }
  else if (choice == 1)
  {
    player.Say("Grrr (a thing)");
  }
  else if (choice == 2)
  {
    player.Say("Grrr (not living thing).");
  }
}

function Default_LookAt_Person()
{
 int choice = Random(2);
  if (choice == 0)
  {
    player.Say("Grrr (a person)");
  }
  else if (choice == 1)
  {
    player.Say("Grrr (a person?)");
  }
  else if (choice == 2)
  {
    player.Say("Grrr (food).");
  }
}

function Default_Interact_Inanimate()
{
  int choice = Random(2);
  if (choice == 0)
  {
    player.Say("grr (...no...)");
  }
  else if (choice == 1)
  {
    player.Say("grr (no point)");
  }
  else if (choice == 2)
  {
    player.Say("grr (no move thing)");
  }
}

function Default_Interact_Person()
{
  int choice = Random(2);
  if (choice == 0)
  {
    player.Say("grr (food?)");
  }
  else if (choice == 1)
  {
    player.Say("grr (living food?)");
  }
  else if (choice == 2)
  {
    player.Say("grr (eat food?)");
  }
}

function Default_TalkTo_Inanimate()
{
  int choice = Random(2);
  if (choice == 0)
  {
    player.Say("grr (not food)");
  }
  else if (choice == 1)
  {
    player.Say("grr (hi, thing)");
  }
  else if (choice == 2)
  {
    player.Say("grr (grrr?)");
  }
}

function Default_TalkTo_Person()
{
  int choice = Random(2);
  if (choice == 0)
  {
    player.Say("grr (what say)");
  }
  else if (choice == 1)
  {
    player.Say("grr (living thing)");
  }
  else if (choice == 2)
  {
    player.Say("grr (food)");
  }
}

function Default_UseInventory_Inanimate()
{
  int choice = Random(2);
  if (choice == 0)
  {
    player.Say("grr (what do)");
  }
  else if (choice == 1)
  {
    player.Say("grr (not working)");
  }
  else if (choice == 2)
  {
    player.Say("grr (more things)");
  }
}

function Default_UseInventory_Person()
{
  int choice = Random(2);
  if (choice == 0)
  {
    player.Say("grr (mine)");
  }
  else if (choice == 1)
  {
    player.Say("grr (why)");
  }
  else if (choice == 2)
  {
    player.Say("grr (boring).");
  }
}

function Default_PickUp_Inanimate()
{
  int choice = Random(2);
  if (choice == 0)
  {
    player.Say("grr (grrr?)");
  }
  else if (choice == 1)
  {
    player.Say("grr (don't need)");
  }
  else if (choice == 2)
  {
    player.Say("grr (...nah)");
  }
}

function Default_PickUp_Person()
{
   int choice = Random(2);
  if (choice == 0)
  {
    player.Say("grr (what do)");
  }
  else if (choice == 1)
  {
    player.Say("grr (too heavy)");
  }
  else if (choice == 2)
  {
    player.Say("grr (...food...)");
  }
}

//Events that happen
function unhandled_event(int what, int type)
{
  if (what == 1)
  {
    // hotspot
    if (type == 1) Default_LookAt_Inanimate();
    if (type == 2) Default_Interact_Inanimate();
    if (type == 3) Default_UseInventory_Inanimate();
    if (type == 4) Default_TalkTo_Inanimate();
  }
  if (what == 2)
  {
    // room object
    if (type == 0) Default_LookAt_Inanimate();
    if (type == 1) Default_Interact_Inanimate();
    if (type == 2) Default_TalkTo_Inanimate();
    if (type == 3) Default_UseInventory_Inanimate();
    if(type == 5) Default_PickUp_Inanimate();
  }
  if (what == 3)
  {
    // character
    if (type == 0) Default_LookAt_Person();
    if (type == 1) Default_Interact_Person();
    if (type == 2) Default_TalkTo_Person();
    if (type == 3) Default_UseInventory_Person();
  }
  if (what == 5)
  {
    // inventory item
    if (type == 0) Default_LookAt_Inanimate();
    if (type == 1) Default_Interact_Inanimate();
    if (type == 2) Default_TalkTo_Inanimate();
    if (type == 3) Default_UseInventory_Inanimate();
  }
}

//==========================================================================================
//
// INVENTORY - More stuff! Interactions between inv and action buttons that are specia
// (So not using the default generic ones if they play an important role). 
//
//========================================================================================


function iAxe_Look()
{
  player.Say("grr (sharp)");
}

function iAxe_Talk()
{
  player.Say("grr! (no response...)");
}

function iAxe_UseInv()
{
  player.Say("grr? (what do)");
}

function iSuitcase_Look()
{
  player.Say("grr (work?)");
  gExamine.Visible = true;
  gExamine.BackgroundGraphic = 79;
}

function iSuitcase_Talk()
{
  player.Say("grr! (no response...)");
}

function iSuitcase_UseInv()
{
  player.Say("grr? (what do)");
}

function iPhoto_Talk()
{
  player.Say("grr! (no response...)");
}

function iPhoto_UseInv()
{
   player.Say("grr? (what do)");
}

function gExamine_OnClick(GUI *theGui, MouseButton button)
{
  gExamine.Visible = false;
  gExamine.BackgroundGraphic = 38;
}

function iPhoto_Look()
{
   gExamine.BackgroundGraphic = 78;
   gExamine.Visible = true;
}

function iKeys_Look()
{
  player.Say("... (to home)");
}
  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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
// room script file for the first room

//attributes! Define some Objects
#define ID_AXE 0
#define ID_SUITCASE 1
#define ID_PHOTO 2
#define ID_PHOTO_GLOW 3
#define ID_SUITCASE_GLOW 4
#define ID_AXE_GLOW 5
#define ID_DOOR_GLOW 6
#define ID_LAMP_GLOW 7
#define ID_PAINTING_GLOW 8
#define ID_FLOWER_GLOW 9
#define ID_SHIRT_GLOW 10
#define ID_WINDOW_GLOW 11
#define ID_LAMP 12
#define ID_DOOR 13
#define ID_PAINTING 14
#define ID_FLOWERS 15
#define ID_SHIRT 16
#define ID_WINDOW 17
#define ID_FRIDGE 18
#define ID_FRIDGE_GLOW 19
#define ID_DOOR_SMASH 21

//Define some hotspots

#define HS_DOOR 1
#define HS_LAMP 2
#define HS_PAINTING 3
#define HS_FLOWERS 4
#define HS_SHIRT 5
#define HS_WINDOW 6


//==========================================================================================
//
// Interacting with the non-pickup objects
// Aka hotspots.
//
//========================================================================================

function hDoorknob_AnyClick()
{
  player.Say("Grrrr (locked)");
}

function hLamp_AnyClick()
{
  player.Say("It's a lamp.");
}

function hPainting_AnyClick()
{
  player.Say("A painting.");
}

function hFlowers_AnyClick()
{
  player.Say("Pretty flowers.");
}

function hFlowers_MouseMove()
{
  //player.Say("(flowers)");
}
function hShirt_AnyClick()
{
  player.Say("Shirt.");
}

function hWindow_AnyClick()
{
  player.Say("Window.");
}


//==========================================================================================
//
//PLAY SOME MUSIC
//
//========================================================================================


//play some music
function room_FirstLoad()
{
  if(aBackMusic != null)
  {
    chan = aBackMusic.Play();
    chan.Volume = 60;

  }

 // player.Say("is play music");
}


//==========================================================================================
//
// INVENTORY STUFF AND OBJECTS
// remove anyclick once excel is updated and swap with look at/use/etc.
//========================================================================================


function hWindow_UseInv()
{
  
  if(player.ActiveInventory == iAxe) //if using the axe
  {
    //If player has suitcase in inventory
    if(player.HasInventory(iSuitcase))
    {
      player.Say("grr (to work)");
      player.ChangeRoom(4);
      player.ActiveInventory = null;
    }
    else
    {
      player.Say("grr (to place)");
      player.ChangeRoom(4);
      player.ActiveInventory = null;
    }
  }
  else
  {
    player.Say("grr (square glass door)");
  }
 
}


//==========================================================================================
//
// INVENTORY STUFF: FAKE OBJECTS
// Basically getting a highlight around them when mouseover. 
//========================================================================================

function hDoorknob_MouseMove()
{
 // gOverHotSpot.Visible = true;
 // gOverHotSpot.SetPosition(mouse.x-2,  mouse.y-2);
  //Instead of this, set the Object's visibolity to true/false!!!
 
}

function hDoorknob_UseInv()
{
 if(player.ActiveInventory == iAxe)
 {
   player.Say("Grr... (no working)");
 }
 else
 {
   player.Say("Grr? (what do)");
 }
}

function oPhoto_Interact()
{
  player.Say("test this");
}

function SetGlowOff() 
{
  oGlowPhoto.Visible = false;
  oGlowAxe.Visible = false;
  oGlowSuitcase.Visible = false;
  oGlowShirt.Visible= false;
  oGlowDoor.Visible = false;
  oGlowPainting.Visible = false;
  oGlowFlower.Visible = false;
  oGlowWindow.Visible = false;
  oGlowLamp.Visible = false;
  oGlowFridge.Visible = false;
  oGlowDoorSmash.Visible = false;
}

//When you hover over something, you want it to glow
//And make sure nothing else is glowing. 
function SetGlowOffExceptThis(Object *obj)
{
  SetGlowOff();
  obj.Visible = true;
  
}


//==========================================================================================
//
// INVENTORY STUFF: HIGHLIGHT
// Use RepExec to check hotspot and obj
// based on mouse position
// When not on a hs or obj, set all glows off.
//
//========================================================================================

function room_RepExec()
{
  
  //Better way of finding objects instead of testing each individual one. 
  Object *obj = Object.GetAtScreenXY(mouse.x, mouse.y);
  
  //check object first
  if (obj != null)
  {
    //Oh no, AGS doesn't support switch statements!
    //Time to do this the old fashioned cringe-worthy way. 
      
      if(obj.ID == ID_PHOTO) 
      {
       SetGlowOffExceptThis(oGlowPhoto);
      }
      else if(obj.ID == ID_AXE)
      {
        SetGlowOffExceptThis(oGlowAxe);
      }
      else if(obj.ID == ID_SUITCASE)
      {
        SetGlowOffExceptThis(oGlowSuitcase);
      }
      else if(obj.ID == ID_LAMP)
      {
        SetGlowOffExceptThis(oGlowLamp);
      }
       else if(obj.ID == ID_DOOR)
      {
        SetGlowOffExceptThis(oGlowDoor);
      }
       else if(obj.ID == ID_PAINTING)
      {
        SetGlowOffExceptThis(oGlowPainting);
      }
      else if(obj.ID == ID_FLOWERS)
      {
        SetGlowOffExceptThis(oGlowFlower);
      }
      else if(obj.ID == ID_SHIRT)
      {
        SetGlowOffExceptThis(oGlowShirt);
      }
      else if(obj.ID == ID_WINDOW)
      {
        SetGlowOffExceptThis(oGlowWindow);
      }
      else if(obj.ID == ID_FRIDGE)
      {
        SetGlowOffExceptThis(oGlowFridge);
      }
      else if(obj.ID == ID_DOOR_SMASH)
      {
        SetGlowOffExceptThis(oGlowDoorSmash);
      }
  } 
  else //if not touching anything, turn off the glow. 
  {
    //Don't need to worry about overlapping objects as there's mouse space
    //between each obj/hs.
    SetGlowOff();
  }
  
  
}

//==========================================================================================
//
// INTERACTING WITH GLOWING OBJECTS/HOTSPOTS/WHATEVER 
// REMEMBER TO SET VISIBLE FALSE FOR PICKUPABLE
// FOR BOTH GLOW AND NON-GLOW, AND ADD IN INV.
//
//========================================================================================


function oGlowAxe_PickUp()
{
   player.Say("Grrr (taken)");
    oAxe.Visible = false;
    oGlowAxe.Visible = false;
    player.AddInventory(iAxe);
}

function oDoor_Look()
{
    player.Say("grrr? (this lead out)");
}

function oGlowDoor_Look()
{
 player.Say("grrr? (go out?)");
}

//WINDOW

function oGlowWindow_Look()
{
 player.Say("grr (go out?)");
}

//Go out the window if the player hits it with an axe,
//But only if the player has a suitcase to get to work. 
function oGlowWindow_UseInv()
{

  if(player.ActiveInventory == iAxe) //if using the axe
  {
    //If player has suitcase in inventory
    if(player.HasInventory(iSuitcase))
    {
      oGlowWindow.Visible = false;
      Wait(10);
      aBreakglass.Play();
      oWindow.Visible = false;
      oBrokenWindow.Visible = true;
      player.Say("grr (maybe there...)");
      player.ChangeRoom(4);
      player.ActiveInventory = null;
    }
    else
    {
      oGlowWindow.Visible = false;
      Wait(10);
      aBreakglass.Play();
      oWindow.Visible = false;
      oBrokenWindow.Visible = true;
      
      player.Say("grr (keep search...)");
      player.ChangeRoom(4);
      player.ActiveInventory = null;
    }
  }
  else
  {
    player.Say("grr (square glass door)");
  }
}

function oGlowWindow_PickUp()
{
  player.Say("grr ( how to?)");
}

function oGlowWindow_Talk()
{
  player.Say("grr (out... )");
}

function oGlowWindow_Interact()
{
  player.Say("grr (no open)");
}

//door

function oGlowDoor_UseInv()
{
  if(player.ActiveInventory == iAxe)
  {
    player.Say("grrr (try this)");
    aDoorBreak.Play();
    Wait(70);
    player.Say("grrr (..not move)");
    Wait(50);
    player.Say("grrr (..too weak)");
    oGlowDoor.Visible = false;
    oDoor.Visible = false;
    oDoorSmash.Visible = true;
  }
}

function oGlowDoor_PickUp()
{
  player.Say("grr (too heavy)");
}

function oGlowSuitcase_PickUp()
{
  player.Say("... (go...work..)");
  oSuitcase.Visible = false;
  oGlowSuitcase.Visible = false;
  player.AddInventory(iSuitcase);
}

function oGlowSuitcase_Look()
{
  player.Say("... (BRAINSSS here?)");
}

function oGlowPhoto_Look()
{
  player.Say("...(me...?)");
}

function oGlowPhoto_PickUp()
{
 player.Say("... (familiar...)");
  oPhoto.Visible = false;
  oGlowPhoto.Visible = false;
  player.AddInventory(iPhoto);
}


function oAxe_PickUp()
{
  player.Say("Grrr (taken)");
  oAxe.Visible = false;
  player.AddInventory(iAxe);
}

function oSuitcase_PickUp()
{
  player.Say("Grrr (taken)");
  oSuitcase.Visible = false;
  player.AddInventory(iSuitcase);
}

function oPhoto_Look()
{
  player.Say("A picture");
}

function oPhoto_PickUp()
{
  player.Say("Grrr (taken)");
  oPhoto.Visible = false;
  player.AddInventory(iPhoto);
}

function oAxe_Interact()
{
  player.Say("grr (no break this..)");
}

function oAxe_Look()
{
 player.Say("grr (it break thing..)");
}

function oGlowAxe_Interact()
{
player.Say("grr (break what?)");
}

function oGlowAxe_Look()
{
 player.Say("grr (can break thing..)");
}

function oGlowPhoto_Talk()
{
 player.Say("... (gone)");
}

function oGlowAxe_Talk()
{
  player.Say("grr (hi pointy thing)");
}

function oGlowSuitcase_Talk()
{
  player.Say("... (work)");
}

function oGlowSuitcase_Interact()
{
  player.Say(" ... (for...work?)");
}

function oGlowFridge_Look()
{
 player.Say("grr (food?)");
}

function oGlowFridge_PickUp()
{
 player.Say("grr (too heavy)");
}

function oGlowFridge_Talk()
{
 player.Say("grr (...)");
}

function oGlowFridge_Interact()
{
 player.Say("grr (empty)");
}

function oGlowPhoto_Interact()
{
  player.Say("... (cant do)");
}

function room_Load()
{
 gClick.Visible = true;
}
// room script for the title screen.
// Controls music fading in and disables the GUI panel. 
// Audio channel must be created first in the settings. 

function room_AfterFadeIn()
{
  WaitMouseKey(12000); //Wait a really long time unless the player clicks play.
  player.ChangeRoom(6); //"fake cutscene"
}

function room_Load()
{
  gPanelOpener.Visible = false;
  chan = aTitleMusic.Play();
}

function room_Leave()
{
    int trans = chan.Volume;
    while (trans > 0) {
      trans--;
      chan.Volume = trans;
      Wait(1);
    }
    
   Game.StopAudio(eAudioTypeMusic);
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.