Advertisement
Jopo2010

Untitled

Mar 10th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. @name Basic EGP
  2. @inputs EGP:wirelink
  3. @outputs
  4. @persist
  5. @trigger
  6. interval(100)
  7. #[ Centred drawing EGPs use this ]#
  8. function number entity:touching(EGP:wirelink#[The screen it'll read from]#,I#[The index of the object it's checking]#){
  9. local Y1 = EGP:egpPos(I):y()-(EGP:egpSize(I):y()/2)
  10. local X1 = EGP:egpPos(I):x()-(EGP:egpSize(I):x()/2)
  11. local Y2 = EGP:egpPos(I):y()+(EGP:egpSize(I):y()/2)
  12. local X2 = EGP:egpPos(I):x()+(EGP:egpSize(I):x()/2)
  13. local Vpos = EGP:egpCursor(This)
  14. if(inrange(Vpos,vec2(X1,Y1),vec2(X2,Y2))){
  15. return 1
  16. }else{
  17. return 0
  18. }
  19. }
  20. #include "egp"
  21. EGP:egpText(6,"Option 3",vec2(430,20))
  22. EGP:egpText(5,"Option 2",vec2(220,20))
  23. EGP:egpText(4,"Option 1",vec2(20,20))
  24. ###############BOXES###################
  25. EGP:egpBox(3,vec2(460,50),vec2(100,20))
  26. EGP:egpBox(2,vec2(250,50),vec2(100,20))
  27. EGP:egpBox(1,vec2(50,50),vec2(100,20))
  28. if(owner():touching(EGP, 3)){
  29. EGP:egpText(10,"Option 3 selected",vec2(200,200))
  30. timer("egpclear",10000)
  31. }
  32. if(owner():touching(EGP, 2)){
  33. EGP:egpText(10,"Option 2 selected",vec2(200,200))
  34. timer("egpclear",10000)
  35. }
  36. if(owner():touching(EGP, 1)){
  37. EGP:egpText(10,"Option 1 Selected",vec2(200,200))
  38. timer("egpclear",10000)
  39. }
  40. if(clk("egpclear")==1){
  41. EGP:egpClear()
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement