home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 August / GSSH0804.iso / Geschicklichkeit / Enigma / Enigma-081.exe / data / levels / ss_esp24.lua < prev    next >
Text File  |  2003-07-30  |  5KB  |  101 lines

  1. -- Smutty Smurf 2003
  2. -- ESPRIT #024
  3. -- problem: how can you change the magnet strength?
  4.  
  5. levelw = 20
  6. levelh = 13
  7. create_world(levelw, levelh)
  8. oxyd_default_flavor = "b"
  9. set_actor("ac-blackball", 10,6.5, {player=0})
  10. fill_floor( "fl-red", 0, 0,levelw,levelh)
  11.  
  12. function renderLine( line, pattern)
  13.     for i=1, strlen(pattern) do
  14.       local c = strsub( pattern, i, i)
  15.       if c ==   "#" then
  16.          set_stone("st-blue-sand", i-1,line)
  17.       elseif c=="M" then
  18.          set_item("it-magnet",i-1,line,{name="magnet", on=1})
  19.       elseif c=="D" then                                                                
  20.          set_stone("st-death", i-1,  line)
  21.       elseif c=="1" then                                                                
  22.          set_stone("st-switch",i-1,line, {action="callback", target="s1",on=1})
  23.      set_item("it-magnet",i-1,line-12,{name="magnet1", on=1})
  24.       elseif c=="2" then                                                                
  25.          set_stone("st-switch",i-1,line, {action="callback", target="s2",on=1})    
  26.          set_item("it-magnet",i-1,line-12,{name="magnet2", on=1})
  27.       elseif c=="3" then                                                                
  28.          set_stone("st-switch",i-1,line, {action="callback", target="s3",on=1})
  29.          set_item("it-magnet",i-1,line-12,{name="magnet3", on=1})
  30.       elseif c=="4" then                                                                
  31.          set_stone("st-switch",i-1,line, {action="callback", target="s4",on=1})
  32.          set_item("it-magnet",i-1,line-12,{name="magnet4", on=1})
  33.       elseif c=="5" then                                                                
  34.          set_stone("st-switch",i-1,line, {action="callback", target="s5",on=1})
  35.          set_item("it-magnet",i-1,line-12,{name="magnet5", on=1})
  36.       elseif c=="6" then                                                                
  37.          set_stone("st-switch",i-1,line, {action="callback", target="s6",on=1})
  38.          set_item("it-magnet",i-1,line-12,{name="magnet6", on=1})
  39.       elseif c=="7" then                                                                
  40.          set_stone("st-switch",i-1,line, {action="callback", target="s7",on=1})
  41.          set_item("it-magnet",i-1,line-12,{name="magnet7", on=1})
  42.       elseif c=="8" then                                                                
  43.          set_stone("st-switch",i-1,line, {action="callback", target="s8",on=1})
  44.          set_item("it-magnet",i-1,line-12,{name="magnet8", on=1})
  45.       elseif c=="9" then                                                                
  46.          set_stone("st-switch",i-1,line, {action="callback", target="s9",on=1})
  47.          set_item("it-magnet",i-1,line-12,{name="magnet9", on=1})
  48.       elseif c=="F" then                                                                
  49.          fakeoxyd( i-1,  line)
  50.       elseif c=="O" then
  51.      oxyd(i-1,line)
  52.         end
  53.     end  
  54. end
  55. --               01234567890123456789
  56. renderLine(00 , "#DDDDDDDDDDDDDDDDDD#")
  57. renderLine(01 , "#        M         #")
  58. renderLine(02 , "#                  #")
  59. renderLine(03 , "#                  #")
  60. renderLine(04 , "#                  #")  
  61. renderLine(05 , "#                  #")
  62. renderLine(06 , "#                  #")
  63. renderLine(07 , "#                  #")
  64. renderLine(08 , "#                  #")
  65. renderLine(09 , "#                  #")
  66. renderLine(10 , "#                  #")
  67. renderLine(11 , "#                  #")
  68. renderLine(12 , "#1O2O3O4O5O6O7O8O9F#")
  69. --               01234567890123456789
  70.  
  71. local num = {1,1,1,1,1,1,1,1,1}
  72. power = 27
  73.  
  74. function s1() sx(1) end
  75. function s2() sx(2) end
  76. function s3() sx(3) end
  77. function s4() sx(4) end
  78. function s5() sx(5) end
  79. function s6() sx(6) end
  80. function s7() sx(7) end
  81. function s8() sx(8) end
  82. function s9() sx(9) end
  83.  
  84. function sx(x)
  85. %num[x] = 1-%num[x]
  86. power = 3*(%num[1] + %num[2] + %num[3] + %num[4] + %num[5] + %num[6] + %num[7] + %num[8] + %num[9])
  87. if %num[x] == 0 then
  88.     enigma.SendMessage(enigma.GetNamedObject("magnet"..x), "off", nil)
  89.       else
  90.         enigma.SendMessage(enigma.GetNamedObject("magnet"..x), "on", nil)
  91.       end
  92. if power == 0 then 
  93.     enigma.SendMessage(enigma.GetNamedObject("magnet"), "off", nil)    
  94.       else
  95.     enigma.SendMessage(enigma.GetNamedObject("magnet"), "on", nil)
  96.       end
  97. enigma.SendMessage(enigma.GetNamedObject("magnet"), "strength", power)   -- does this work?
  98. end
  99.  
  100. oxyd_shuffle()
  101.