Difference in LUA and regular eA

By Aeromas, 1 Month ago, written in cpp.
  1. Different in LUA scripting:
  2.  
  3. Functions for scripts are completely different, you add npcs in a script with "addnpc"(etc)
  4. And you can include all the txt documents of npcs in a folder like this
  5.  
  6. require "script/npc/folder" All npcs in FOLDER will be executed! Makes it less messy!
  7.  
  8. Example of script in LUA: /*NOTE THESE 2 SCRIPTS IN TRUNK/STABLE EA SCRIPTING DOES THE SAME THINGS AS LUA SCRIPTING
  9. */
  10.  
  11. addnpc("Thisnpc","2ndNAME","izlude.gat",170,180,1,122,"talktonpc")
  12.  
  13. function talktonpc()
  14. npcmes "whatever"
  15. npcmes "Choose menu yes or no"
  16. npcnext() // next button
  17.  local r = npcmenu("Yes",1,"No",2)
  18. if r == 1 then yesfunction;
  19. elseif r == 2 then nofunction;
  20. else
  21. npcclose()
  22. end
  23. end
  24.  
  25. function yesfunction()
  26. npcmes "hi"
  27. npcclose()
  28. end
  29.  
  30. function nofunction()
  31. npcmes "oh okay, bye"
  32. end
  33. end
  34.  
  35.  
  36. Example of script in regular ea trunk/stable (Note there the same)
  37.  
  38. izlude.gat,170,180,1   script  Thisnpc   122,{
  39.  
  40. mes "whatever";
  41. mes "Choose menu yes or no";
  42. next;
  43. menu "Yes",yes,"No",no;
  44. yes:
  45. mes "hi";
  46. close;
  47. no:
  48. mes "oh okay, bye";
  49. close;
  50. }
  51.