home *** CD-ROM | disk | FTP | other *** search
/ Singles (French) / Singles-FrenchVersion-Win95.iso / data1.cab / Statemachine / testmission.lua < prev    next >
Text File  |  2004-03-05  |  2KB  |  125 lines

  1. -- Shakehands Testmission
  2. --
  3. -- used mission objects:
  4. -- trigger1 - triggers hello in initial state
  5.  
  6. beginStateMachine()
  7.  
  8.     onMsg("unpacked", function(msg)
  9.         --getParent().getCharacter(ELAINE).setEnable(true);
  10. print("testMisssion - unpacked");
  11.         
  12.         getStateObjectFromID(tonumber(msg.data)).deleteGameObject();
  13.         
  14.         local ausgepackt = getParent().getEditor().getPrototypeByName("SofaOldschool");
  15.         if (ausgepackt) then
  16.             getParent().getEditor().setMode(Editor.BUY_MODE);
  17.             getParent().getEditor().selectPrototype(ausgepackt,true);
  18.         end
  19.         
  20.         setState("placeme");
  21.     end )
  22.                 
  23.     state("placeme")
  24.         onMsg("placed", function(msg)            
  25.             getParent().getEditor().setMode(Editor.LIFE_MODE);
  26.             setState("_GLOBAL");
  27.         end )
  28.  
  29.     onDefault( function(msg)
  30.         print("DEFAAAAAAAULT: "..msg.name.." "..msg.data);
  31.     end )
  32.  
  33.  
  34.     onMsg("enterTrigger", function(msg)
  35.         getParent().getCharacter(ELAINE).walkSO.walkToActionPoint(
  36.             getParent().getCharacter(MIKE).getActionPoint("talk")
  37.         );
  38.         setState("conversation");
  39.     end )
  40.     
  41.  
  42.     state("conversation")
  43.         onMsg("arrived", function(msg)        
  44.             popupConversation(
  45.                 "Elaine:angry:hehe ich bin elaine und probiere gerade was:ok;"..
  46.                 "Mike:angry:muahahaaa das macht mich wuetend:ok;" );
  47.             setState("_GLOBAL");
  48.         end )
  49.     
  50.         
  51.     
  52.         
  53.     
  54. endStateMachine()
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. function bla() 
  74.  
  75.     onMsg("arrived", function(msg)
  76.         if ( getStateObjectFromID(msg.sender).isMale() ) then
  77.             print("mike is angekommen");
  78.         else
  79.             print("linda is angekommen");
  80.         end
  81.     end )
  82.  
  83.     onMsg("sat", function(msg)
  84.         if ( getStateObjectFromID(msg.sender).isMale() ) then
  85.             print("mike is sitting now");
  86.         else
  87.             print("linda is sitting now");
  88.         end
  89.     end )
  90.     
  91.     
  92.     onMsg("repaired", function(msg)
  93.         print("somethin got repaired");
  94.     end )
  95.     
  96.     onMsg("on", function(msg)
  97.         print("somethin got switched on");
  98.         getStateObjectFromID(tonumber(msg.data)).setBroken(true);
  99.     end )
  100.     
  101.     onMsg("off", function(msg)
  102.         print("somethin got switched off");
  103.     end )
  104.     
  105.     onMsg("unpacked", function(msg)
  106.         --getParent().getCharacter(ELAINE).setEnable(true);
  107.         
  108.         getStateObjectFromID(tonumber(msg.data)).deleteGameObject();
  109.         
  110.         local ausgepackt = getParent().getEditor().getPrototypeByName("SofaOldschool");
  111.         if (ausgepackt) then
  112.             getParent().getEditor().setMode(Editor.BUY_MODE);
  113.             getParent().getEditor().selectPrototype(ausgepackt,true);
  114.         end
  115.         
  116.         setState("placeme");
  117.     end )
  118.  
  119.  
  120.  
  121. end
  122.  
  123.  
  124.  
  125.