Advertisement
Guest User

genka

a guest
Nov 15th, 2009
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.44 KB | None | 0 0
  1. Game.chain = {}
  2.  
  3. Game.chain.ui = {}
  4. Game.chain.ui.numWepLabel = iup.label{title = "Num of weapon groups:"}
  5. Game.chain.ui.numWepField = iup.text{}
  6.  
  7. Game.chain.ui.delayLabel = iup.label{title = "Delay:"}
  8. Game.chain.ui.delayField = iup.text{}
  9.  
  10. Game.chain.ui.closeButton = iup.button{title = "Close"}
  11. Game.chain.ui.bindsButton = iup.button{title = "Make Binds"}
  12. Game.chain.ui.helpButton = iup.button{title = "?"}
  13.  
  14. Game.chain.ui.controls = iup.hbox{Game.chain.ui.helpButton, iup.fill{}, Game.chain.ui.closeButton, Game.chain.ui.bindsButton} --one line up to previous empty line.
  15.  
  16. Game.chain.ui.delayBox = iup.hbox{iup.fill{}, Game.chain.ui.delayLabel, Game.chain.ui.delayField} --also one line
  17.  
  18. Game.chain.ui.numBox = iup.hbox{iup.fill{}, Game.chain.ui.numWepLabel, Game.chain.ui.numWepField} --one line as well
  19.  
  20. Game.chain.ui.mainBox = iup.vbox{Game.chain.ui.numBox, Game.chain.ui.delayBox, Game.chain.ui.controls} --one line, wee.
  21.  
  22. Game.chain.ui.dlg = iup.dialog{Game.chain.ui.mainBox; title = "chainfire control", topmost = "YES"}
  23.  
  24. Game.chain.helpmsgp1 = "Hello, and welcome to the exciting world of chainfire control!\n\tWhat you are looking at is a system for autamating the creating of chainfire binds for any number of weapon groups with any delay."
  25. Game.chain.helpmsgp2 = "\n\n\tThe fist field asks for the number of weapon groups you want to chain. Each of these groups should be set-up in the station to have the desired weapons in the primary fire group. The weapon groups should also be consecutive ones, starting at 1 and moving to the right along the buttons."
  26. Game.chain.helpmsgp3 = "\n\tThe delay field asks for how long the bind should wait before moving on to the next weapon group. Works best if the delay times the number of weapon groups is the delay of the slowest of the weapons used."
  27. Game.chain.helpmsgp4 = "\n\n\tNow then, on to using the resulting binds! The main of these are \"+crazyChain\" and \"crazyLoopDoctor\". The first is the alias you should bind to your fire key, and the second is one you should either remember or bind to some other close-at-hand key, in case the loop breaks for some reason. Most of the time, the bind will start working again after a visit from the crazyLoopDoctor."
  28. Game.chain.helpmsgp5 = "\n\n\tThat\'s all the help you're getting from me. Now, go out there and kill some damn miners!"
  29.  
  30. Game.chain.helpmsg = Game.chain.helpmsgp1 .. Game.chain.helpmsgp2 .. Game.chain.helpmsgp3 .. Game.chain.helpmsgp4 .. Game.chain.helpmsgp5
  31. Game.chain.ui.omghelp = iup.multiline{value = Game.chain.helpmsg, size="HALFxHALF", readonly = "YES"}
  32. Game.chain.ui.helpdlg = iup.dialog{Game.chain.ui.omghelp; title = "help!", size="HALFxHALF", topmost = "YES"}
  33.  
  34. function Game.chain.ui.helpButton:action()
  35.     Game.chain.ui.helpdlg:show()
  36. end
  37.  
  38. function Game.chain.ui.closeButton:action()
  39.     Game.chain.ui.dlg:close_cb()
  40.     Game.chain.ui.dlg:hide()
  41. end
  42.  
  43. function Game.chain.ui.bindsButton:action()
  44.     local num = tonumber(iup.GetAttribute(Game.chain.ui.numWepField, "value"))
  45.     local delay = tonumber(iup.GetAttribute(Game.chain.ui.delayField, "value"))
  46.     Game.chain.makeBinds(num, delay)
  47. end
  48.  
  49. function Game.chain.ui.dlg:show_cb()
  50.     gkinterface.GKProcessCommand("hudtoggle")
  51. end
  52.  
  53. function Game.chain.ui.dlg:close_cb()
  54.     gkinterface.GKProcessCommand("hudtoggle")
  55. end
  56.  
  57. function Game.chain.display()
  58.     Game.chain.ui.dlg:show()
  59. end
  60.  
  61. function Game.chain.makeBinds(num, delay)
  62.     local i = 1
  63.     local next = 0
  64.  
  65.     gkinterface.GKProcessCommand("alias crazyWepSwitch \"crazyWepSwitch1\"")
  66. --  gkinterface.GKProcessCommand("alias crazyChainer \"+crazyChain\"")
  67.     gkinterface.GKProcessCommand("alias -crazyChain \"+shoot2 0; alias crazyLoop crazyLoopDoctor; alias crazyBuffer crazyBufferMeds\"")
  68.     gkinterface.GKProcessCommand("alias crazyLoopDoctor \"alias crazyLoop crazyLoopMeds\"")
  69.     gkinterface.GKProcessCommand("alias crazyLoop \"crazyLoopDoctor\"")
  70.     gkinterface.GKProcessCommand("alias crazyBufferMeds \"crazyLoop; alias crazyBuffer none\"")
  71.     gkinterface.GKProcessCommand("alias crazyBuffer \"crazyBufferMeds\"")
  72.     gkinterface.GKProcessCommand("alias +crazyChain \"+shoot2 ; crazyBuffer\"")
  73.  
  74.     gkinterface.GKProcessCommand("alias crazyLoopMeds \"crazyWepSwitch; wait " .. delay .." crazyLoop\"")
  75.  
  76.     while (i <= num) do
  77.         next = math.mod(i,num)+1
  78.         gkinterface.GKProcessCommand("alias crazyWepSwitch"..i.." \"Weapon"..i.."; alias crazyWepSwitch crazyWepSwitch"..next.."\"")
  79.         i = i+1
  80.     end
  81.     print("Binds made for "..num.." weapon groups with a delay of "..delay.."s.")
  82. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement