Magus

(Wiremod Expression 2) Lodkagan Scoreboard

Jan 28th, 2012
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.41 KB | None | 0 0
  1. @name Magus Scorebord Example
  2. @inputs S:wirelink
  3. @outputs PlayerStatus ServerStatus
  4. @persist ServerName:string Players:array
  5. @persist Time Interval SBC:vector
  6. @trigger
  7. # Scorebord with Server and Player Status
  8. # Expression 2 Chip by Magus / Lodkagan
  9.  
  10. # Config
  11. Time = 15000       # Time to switch between Player and Server Status. (in milliseconds)
  12. Interval = 500     # How fast should this chip run? (lower is faster, Default = 500)
  13. SBC = vec(255,0,0) # Scorebord Color. (Red,Green,Blue) (Min = 0, Max = 255)
  14.  
  15.  
  16.  
  17. interval(Interval)
  18.  
  19. S:egpText(11,"SCOREBORD",vec2(260/2,5))
  20. S:egpColor(11,SBC)
  21. S:egpSize(11,50)
  22.    
  23. S:egpLine(12,vec2(0,55),vec2(515,55))
  24. S:egpColor(12,vec4(255,255,255,255))
  25. S:egpSize(12,2)
  26.  
  27. if(first())
  28. {
  29.    
  30.     S:egpClear()
  31.     PlayerStatus = 0
  32.     ServerStatus = 0
  33.     timer("ServerStatus",500)
  34.    
  35. }
  36.  
  37. if(clk("PlayerStatus"))
  38. {
  39.    
  40.     S:egpClear()
  41.     PlayerStatus = 1
  42.     ServerStatus = 0
  43.     timer("ServerStatus",Time)
  44.    
  45. }
  46.  
  47. if(clk("ServerStatus"))
  48. {
  49.    
  50.     S:egpClear()
  51.     PlayerStatus = 0
  52.     ServerStatus = 1
  53.     timer("PlayerStatus",Time)
  54.    
  55. }
  56.  
  57.  
  58. if(PlayerStatus == 1)
  59. {
  60.    
  61.     I = 0
  62.    
  63.     Players = players()
  64.    
  65.     S:egpLine(13,vec2(0,105),vec2(515,105))
  66.     S:egpColor(13,vec4(255,255,255,255))
  67.     S:egpSize(13,2)
  68.    
  69.     # NAME ROW
  70.    
  71.     S:egpText(14,"NAME",vec2(15,50))
  72.     S:egpColor(14,vec4(255,255,255,255))
  73.     S:egpSize(14,50)
  74.    
  75.     S:egpLine(15,vec2(150,55),vec2(150,500))
  76.     S:egpColor(15,vec4(255,255,255,255))
  77.     S:egpSize(15,2)
  78.    
  79.     # HEALTH ROW
  80.    
  81.     S:egpText(16,"HP",vec2(150,60))
  82.     S:egpColor(16,vec4(255,255,255,255))
  83.     S:egpSize(16,30)
  84.    
  85.     S:egpLine(17,vec2(190,55),vec2(190,500))
  86.     S:egpColor(17,vec4(255,255,255,255))
  87.     S:egpSize(17,2)
  88.    
  89.     # KILLS ROW
  90.    
  91.     S:egpText(18,"KILL",vec2(190,60))
  92.     S:egpColor(18,vec4(255,255,255,255))
  93.     S:egpSize(18,30)
  94.    
  95.     S:egpLine(19,vec2(250,55),vec2(250,500))
  96.     S:egpColor(19,vec4(255,255,255,255))
  97.     S:egpSize(19,2)
  98.    
  99.     # DEATHS ROW
  100.    
  101.     S:egpText(20,"DEATH",vec2(250,60))
  102.     S:egpColor(20,vec4(255,255,255,255))
  103.     S:egpSize(20,30)
  104.    
  105.     S:egpLine(21,vec2(336,55),vec2(336,500))
  106.     S:egpColor(21,vec4(255,255,255,255))
  107.     S:egpSize(21,2)
  108.    
  109.     # PING ROW
  110.    
  111.     S:egpText(22,"PING",vec2(336,60))
  112.     S:egpColor(22,vec4(255,255,255,255))
  113.     S:egpSize(22,30)
  114.    
  115.     S:egpLine(24,vec2(403,55),vec2(403,500))
  116.     S:egpColor(24,vec4(255,255,255,255))
  117.     S:egpSize(24,2)
  118.    
  119.     # Alive ROW
  120.    
  121.     S:egpText(25,"ALIVE",vec2(410,60))
  122.     S:egpColor(25,vec4(255,255,255,255))
  123.     S:egpSize(25,30)
  124.    
  125.    
  126.    
  127.     # While for the PlayerStats
  128.     while(I < numPlayers())
  129.     {
  130.        
  131.         S:egpBox(I,vec2(250,140+(I*30)),vec2(550,30))
  132.         S:egpColor(I,vec4(255,255,255,50))
  133.        
  134.         S:egpText(30+I,Players[I+1,entity]:name(),vec2(5,125+(I*30)))
  135.         S:egpColor(30+I,vec4(255,255,255,255))
  136.         S:egpSize(30+I,30)
  137.        
  138.         S:egpText(40+I,toString(Players[I+1,entity]:health()),vec2(155,130+(I*30)))
  139.         S:egpColor(40+I,vec4(255,255,255,255))
  140.         S:egpSize(40+I,20)
  141.        
  142.         S:egpText(50+I,toString(Players[I+1,entity]:frags()),vec2(195,130+(I*30)))
  143.         S:egpColor(50+I,vec4(255,255,255,255))
  144.         S:egpSize(50+I,20)
  145.        
  146.         S:egpText(60+I,toString(Players[I+1,entity]:deaths()),vec2(255,130+(I*30)))
  147.         S:egpColor(60+I,vec4(255,255,255,255))
  148.         S:egpSize(60+I,20)
  149.        
  150.         S:egpText(70+I,toString(Players[I+1,entity]:ping()),vec2(341,130+(I*30)))
  151.         S:egpColor(70+I,vec4(255,255,255,255))
  152.         S:egpSize(70+I,20)
  153.        
  154.         S:egpText(80+I,toString(Players[I+1,entity]:isAlive()),vec2(430,130+(I*30)))
  155.         S:egpColor(80+I,vec4(255,255,255,255))
  156.         S:egpSize(80+I,20)
  157.        
  158.         I++
  159.        
  160.     }
  161.    
  162. }
  163.  
  164. if(ServerStatus == 1)
  165. {
  166.    
  167.     S:egpText(14,hostname(),vec2(250/2,75))
  168.     S:egpColor(14,vec4(255,255,255,255))
  169.     S:egpSize(14,50)
  170.    
  171.    
  172.     # 1. Row
  173.    
  174.     S:egpText(15,"GameMode: " + gamemode(),vec2(5,150))
  175.     S:egpColor(15,vec4(255,255,255,255))
  176.     S:egpSize(15,25)
  177.    
  178.     S:egpText(16,"Map Name: " + map(),vec2(250,150))
  179.     S:egpColor(16,vec4(255,255,255,255))
  180.     S:egpSize(16,25)
  181.    
  182.    
  183.     # 2. Row
  184.     S:egpText(17,"Gravity: " + gravity(),vec2(5,175))
  185.     S:egpColor(17,vec4(255,255,255,255))
  186.     S:egpSize(17,25)
  187.    
  188.     S:egpText(18,"Max. Players: " + maxPlayers(),vec2(250,175))
  189.     S:egpColor(18,vec4(255,255,255,255))
  190.     S:egpSize(18,25)
  191.    
  192.    
  193.     # 3. Row
  194.     S:egpText(19,"Lan Server: " + isLan(),vec2(5,200))
  195.     S:egpColor(19,vec4(255,255,255,255))
  196.     S:egpSize(19,25)
  197.    
  198.     S:egpText(20,"Players: " + numPlayers(),vec2(250,200))
  199.     S:egpColor(20,vec4(255,255,255,255))
  200.     S:egpSize(20,25)
  201.    
  202.    
  203.     # 4. Row
  204.     S:egpText(21,"SpeedLimit: " + speedLimit(),vec2(5,225))
  205.     S:egpColor(21,vec4(255,255,255,255))
  206.     S:egpSize(21,25)
  207.    
  208.     S:egpText(22,"SinglePlayer: " + isSinglePlayer(),vec2(250,225))
  209.     S:egpColor(22,vec4(255,255,255,255))
  210.     S:egpSize(22,25)
  211.    
  212.    
  213.     # 5. Row
  214.     S:egpText(23,"Time: " + time("hour")+":"+time("min"),vec2(5,325))
  215.     S:egpColor(23,vec4(255,255,255,255))
  216.     S:egpSize(23,50)
  217.    
  218.     S:egpText(24,"Date: " + time("year")+":"+time("month")+":"+time("day"),vec2(5,375))
  219.     S:egpColor(24,vec4(255,255,255,255))
  220.     S:egpSize(24,50)
  221.    
  222. }
Advertisement
Add Comment
Please, Sign In to add comment