Advertisement
devonhg

scr_include

May 14th, 2015
359
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///scr_include(key_ring, key1, key2, ...)
  2. /*
  3.     You can use this script to add multiple controllers to a single room, or multiple
  4.     rooms can have a single controller. The key_ring value determines which.
  5.    
  6.     Must be put in the room start event!
  7. */
  8.  
  9. var keys, key_ring, i;
  10.  
  11. key_ring = argument[0];
  12. keys[0] = argument[1];
  13.  
  14. //Sort all listed keys into array, as well as allows for optional arguments.
  15.     if argument_count > 2{
  16.         for(i=1;i<argument_count;i++){
  17.             keys[i-1] = argument[i];  
  18.         }
  19.     }
  20.  
  21. //Check if key_ring is a room or an object, and act accordingly.
  22.     if room_exists( key_ring ){
  23.         if room = key_ring{
  24.             for(i=0;i<array_length_1d(keys);i++){
  25.                 if !instance_exists(keys[i]){
  26.                     instance_create(0,0, keys[i]);
  27.                 }        
  28.             }
  29.         }
  30.     }else{
  31.         for(i=0;i<array_length_1d(keys);i++){
  32.             if room = keys[i] and !instance_exists(key_ring){
  33.                 instance_create(0,0,key_ring)
  34.             }
  35.         }
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement