Faguss

WW4EXT 1.1.1 UserPreferences.sqs updated for Fwatch 1.15

Jun 10th, 2018
121
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Called from
  2. ; Uses fwatch to load/save certain user preferences
  3. ~0.02
  4. _nil = "scalar bool array string 0xfcffffef";
  5.  
  6. @alive player
  7. _action = _this select 0
  8. ? _action == "Save" : goto "Save"
  9. ? _action == "Load" : goto "Load"
  10. exit
  11.  
  12.  
  13. #Save
  14. ; Set global vars to default values if first time running FWATCH
  15. ? Format ["%1", WW4EXT_menukey] == _nil : WW4EXT_menukey = "C"; hintC "WW4 EXT MENU\n-----------------------\nThis seems to be first time using this menu while having FWATCH active\n\nTo open the menu just press the C key.\n\nYou can change the key to be used inside the personal menu, through OPTIONS and then FWATCH."
  16. ? Format ["%1", WW4EXT_zeroingkey] == _nil : WW4EXT_zeroingkey = "END";
  17. ? Format ["%1", WW4EXT_switchsightkey] == _nil : WW4EXT_switchsightkey = "DELETE";
  18. ? Format ["%1", WW4EXT_VD] == _nil : WW4EXT_VD = (call loadFile ":mem getgraphics") select 12;
  19.  
  20. call loadFile Format [{:file write WW4EXT.db WW4EXT_menukey "%1"} , WW4EXT_menukey]
  21. call loadFile Format [{:file write WW4EXT.db WW4EXT_zeroingkey "%1"} , WW4EXT_zeroingkey]
  22. call loadFile Format [{:file write WW4EXT.db WW4EXT_switchsightkey "%1"} , WW4EXT_switchsightkey]
  23. call loadFile Format [{:file write WW4EXT.db WW4EXT_VD %1} , WW4EXT_VD]
  24.  
  25. player globalChat Format ["Menu key: %1 Zeroing key: %2 Switch sight key: %3 View Distance: %4", WW4EXT_menukey, WW4EXT_zeroingkey, WW4EXT_switchsightkey, WW4EXT_VD]
  26. exit
  27.  
  28.  
  29.  
  30. #Load
  31. _fwatch_error = [true, 0, 0, ""]
  32.  
  33. WW4EXT_menukey = call loadFile ":file read WW4EXT.db WW4EXT_menukey"
  34. WW4EXT_zeroingkey = call loadFile ":file read WW4EXT.db WW4EXT_zeroingkey"
  35. WW4EXT_switchsightkey = call loadFile ":file read WW4EXT.db WW4EXT_switchsightkey"
  36. WW4EXT_VD = call loadFile ":file read WW4EXT.db WW4EXT_VD"
  37.  
  38. ? !(_fwatch_error select 0) : WW4EXT_menukey=nil; WW4EXT_zeroingkey=nil; WW4EXT_switchsightkey=nil; WW4EXT_VD=nil; goto "Save"
  39. ? WW4EXT_VD == 0 : WW4EXT_VD=900
  40.  
  41. setViewDistance WW4EXT_VD
  42. ;player globalChat "WW4 EXT menu preferences loaded:"
  43. player globalChat format ["[WW4EXT Prefs] Menu key: %1 Zeroing key: %2 Switch sight key: %3 View Distance: %4", WW4EXT_menukey, WW4EXT_zeroingkey, WW4EXT_switchsightkey, WW4EXT_VD]
  44. exit
RAW Paste Data