Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Expression 2 v
« Previous 1 … 4 5 6 7 8 Next »
HELP: EGP Buttons
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode
HELP: EGP Buttons
17-06-2014, 01:36 AM,
#1
Alanzote Offline
TSCM Member
***
Posts: 123
Threads: 40
Joined: Oct 2013
Question  HELP: EGP Buttons
I am trying to make EGP Buttons, I've based myself on BL4CKH4WK Ship Stats E2 Buttons but, It wasn't worked!
Can someone give a base code for me?

[Image: stargate_kawoosh_animation_HD_by_SergeyDruid.gif] [Image: kecepatan-cahaya-light-speed-warp-drive2....gif?w=640]
Find
Reply
17-06-2014, 08:45 AM,
#2
Cobra Offline
Moderator
*****
Posts: 306
Threads: 18
Joined: Oct 2013
RE: HELP: EGP Buttons
Show us what you have tried so far

  • ASUS R.O.G. Rampage IV Black Edition
  • 2x Fury X
  • Intel Core i7 4930K OC @ 4.4GHz
  • Corsair H100i
  • Samsung SSD 850 Series 1TB
  • Samsung SSD 830 Series 512GB
  • Western Digital 512GB HDD
  • 32GB DDR3 2400MHz RAM (G.Skill TridentX)
  • Corsair 900D
Website Find
Reply
17-06-2014, 01:27 PM, (This post was last modified: 17-06-2014, 01:33 PM by Alanzote.)
#3
Alanzote Offline
TSCM Member
***
Posts: 123
Threads: 40
Joined: Oct 2013
RE: HELP: EGP Buttons
(17-06-2014, 08:45 AM)Cobra Wrote: Show us what you have tried so far
Here is the codeSadIf you noticed, I've copied the function! But I'll not post this E2 on this forum!)

Code:
####FUNCTIONS##### function number wirelink:button(Cursor:vector2,ID:number) { local BPos = This:egpPos(ID) local BSize = This:egpSize(ID)/2 local Pressed = inrange(Cursor,BPos-BSize,BPos+BSize) return Pressed } function click() { E:entity():soundPlay(1,20,"(SOMETHING)") } ###BUTTON######### User = E["User",entity] Cursor = E:egpCursor(User) Use = User:keyUse() if(changed(Use) & Use) { click() if(E:button(Cursor,10)) { E:egpClear() } }

[Image: stargate_kawoosh_animation_HD_by_SergeyDruid.gif] [Image: kecepatan-cahaya-light-speed-warp-drive2....gif?w=640]
Find
Reply
17-06-2014, 03:37 PM,
#4
Blackhawk Offline
GMod Admin
Posts: 204
Threads: 9
Joined: Sep 2013
RE: HELP: EGP Buttons
Don't forget to put your button function into "if(first() | changed(EGP)){}"

Here's a small Touch Screen Tutorial, it should help you:

Code:
@name EGP Touchscreen Tutorial @inputs EGP:wirelink @outputs @persist User:entity Cursor:vector2 Use B @trigger ##How to use the button() function by Link320 ##(Actually it's more of a 'the cursor is over this object' function, it doesn't actually make buttons) #We need an interval, or runOnTick(1), so that the E2 runs without you changing an input. interval(100) if(first() | changed(EGP)){ EGP:egpClear() #Define the function. function number wirelink:button(Cursor:vector2,ID:number){ local BPos = This:egpPos(ID) local BSize = This:egpSize(ID)/2 local Pressed = inrange(Cursor,BPos-BSize,BPos+BSize) return Pressed } #Create the box. This is going to be my button. Its index is 1. We create this before running EGP:button() EGP:egpBox(1,vec2(256, 180),vec2(128)) EGP:egpBox(2,vec2(256, 350),vec2(128)) } #Get the person using the screen User = EGP["User",entity] #Get the position of their cursor on the screen Cursor = EGP:egpCursor(User) #Get whether the person is pressing use Use = User:keyUse() #If I press use on the screen... if(changed(Use) & Use){ if(EGP:button(Cursor,1)){ soundPlay(1,0,"/ancient_button1.wav") } elseif(EGP:button(Cursor,2)){ B = !B #Note that B is in persists Color = B ? vec(200,0,0) : vec(255) # ^If you haven't come across this before, this is short for "if(B){vec(200,0,0)} else{vec(255)}" EGP:egpColor(2,Color) } }
Find
Reply
17-06-2014, 04:56 PM,
#5
Alanzote Offline
TSCM Member
***
Posts: 123
Threads: 40
Joined: Oct 2013
RE: HELP: EGP Buttons
(17-06-2014, 03:37 PM)_BL4CKH4WK Wrote: Don't forget to put your button function into "if(first() | changed(EGP)){}"

Here's a small Touch Screen Tutorial, it should help you:

Code:
@name EGP Touchscreen Tutorial @inputs EGP:wirelink @outputs @persist User:entity Cursor:vector2 Use B @trigger ##How to use the button() function by Link320 ##(Actually it's more of a 'the cursor is over this object' function, it doesn't actually make buttons) #We need an interval, or runOnTick(1), so that the E2 runs without you changing an input. interval(100) if(first() | changed(EGP)){ EGP:egpClear() #Define the function. function number wirelink:button(Cursor:vector2,ID:number){ local BPos = This:egpPos(ID) local BSize = This:egpSize(ID)/2 local Pressed = inrange(Cursor,BPos-BSize,BPos+BSize) return Pressed } #Create the box. This is going to be my button. Its index is 1. We create this before running EGP:button() EGP:egpBox(1,vec2(256, 180),vec2(128)) EGP:egpBox(2,vec2(256, 350),vec2(128)) } #Get the person using the screen User = EGP["User",entity] #Get the position of their cursor on the screen Cursor = EGP:egpCursor(User) #Get whether the person is pressing use Use = User:keyUse() #If I press use on the screen... if(changed(Use) & Use){ if(EGP:button(Cursor,1)){ soundPlay(1,0,"/ancient_button1.wav") } elseif(EGP:button(Cursor,2)){ B = !B #Note that B is in persists Color = B ? vec(200,0,0) : vec(255) # ^If you haven't come across this before, this is short for "if(B){vec(200,0,0)} else{vec(255)}" EGP:egpColor(2,Color) } }
Thanks Bl4 It worked!

[Image: stargate_kawoosh_animation_HD_by_SergeyDruid.gif] [Image: kecepatan-cahaya-light-speed-warp-drive2....gif?w=640]
Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.