compatibility.cfg 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // Makes very old cubescripts compatible with newer versions of the game
  2. // (write "load_compatibility" into your autoexec.cfg to load)
  3. const alive [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 alive) ] [ result (player1 alive) ] ]
  4. const currole [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 role) ] [ result (player1 role) ] ]
  5. const curmode [ result $gamemode ]
  6. const getclientmode [ result $gamemode ]
  7. const curteam [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 team) ] [ result (player1 team) ] ]
  8. const findpn [ if (isclient $arg1) [ result (player $arg1 name) ] [ result [] ] ]
  9. const isSpect [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 spect) ] [ result (player1 spect) ] ]
  10. const pstat_score [
  11. if (isclient $arg1) [
  12. result (concat (player $arg1 flags) (player $arg1 frags) (player $arg1 deaths) (player $arg1 points) (player $arg1 team) (player $arg1 tks) (player $arg1 name))
  13. ] [ result (concat [0 0 0 0 -1 0] (addpunct)) ]
  14. ]
  15. const orderscorecolumns [
  16. if (= $arg1 1) [
  17. sc_clientnum 0;
  18. sc_name 1;
  19. sc_flags 2;
  20. sc_frags 3;
  21. sc_deaths 4;
  22. sc_score 5;
  23. sc_lag 6;
  24. sc_ratio -1;
  25. ] [
  26. sc_flags 0;
  27. sc_frags 1;
  28. sc_deaths 2;
  29. sc_ratio -1;
  30. sc_score 4;
  31. sc_lag 5;
  32. sc_clientnum 6;
  33. sc_name 7;
  34. ]
  35. ]
  36. // deprecated functions
  37. // Helper aliases for easy color insertion. (e.g. echo (red)Hello (blue)world! (white)My fov today is: (orange) $fov)
  38. loop k 10 [ const (at [green blue yellow red gray white dbrown dred purple orange] $k) (format [if (= $arg1 -1) [ result %1 ] [ result %2 ]] $k (concatword "\f" $k)) ]
  39. // makeshift "?" operator for cubescript
  40. // ex: /? (> $maxroll 0) [voicecom negative D:] [voicecom yes :D]
  41. // /echo I am (? (>= (player1 health) 50) [result healthy] [result weak]) atm
  42. ? = [
  43. if (> $numargs 1) [
  44. if (> $numargs 2) [
  45. if $arg1 $arg2 $arg3
  46. ] [
  47. if $arg1 $arg2
  48. ]
  49. ]
  50. ]
  51. const showedithide [
  52. if $edithideentmask [
  53. push n "Hidden entities:"
  54. push m 1
  55. looplist (listoptions ents) e [
  56. if (&b $edithideentmask $m) [
  57. n = (concat $n $e)
  58. ]
  59. += m $m
  60. ]
  61. echo (pop n m)
  62. ] [
  63. echo "all entities are visible"
  64. ]
  65. ]
  66. const setedithide [
  67. edithideentmask 0
  68. looplist $arg1 e [
  69. push n (findlist (listoptions ents) $e)
  70. if (< $n 0) [
  71. echo "\f3" $e is not an entity type
  72. ] [
  73. edithideentmask (|b $edithideentmask (powf 2 $n))
  74. ]
  75. pop n
  76. ]
  77. ]
  78. const seteditshow [
  79. push n (findlist (listoptions ents) $arg1)
  80. if (< $n 0) [
  81. echo "\f3" $arg1 is not an entity type
  82. ] [
  83. edithideentmask (- (- (powf 2 (listlen (listoptions ents))) 1) (powf 2 $n))
  84. ]
  85. pop n
  86. ]
  87. // commands to increment/decrement an alias - or to fail silently, if the alias doesn't exist
  88. const ++ [ if (checkalias $arg1) [ += $arg1 1 ] ]
  89. const -- [ if (checkalias $arg1) [ -= $arg1 1 ] ]
  90. const ++f [ if (checkalias $arg1) [ +=f $arg1 1 ] ]
  91. const --f [ if (checkalias $arg1) [ -=f $arg1 1 ] ]