January 28, 2020, 11:22 pm

Author Topic: [REQUEST]E2 EGP HELP  (Read 1059 times)

Offline EmekPCgame

  • ByB Rookie
  • **
  • Posts: 96
    • View Profile
[REQUEST]E2 EGP HELP
« on: August 06, 2015, 08:20 pm »
so i want to make a button from egp and i don't know how, please teach me how to do it

Code: [Select]
@name EGP BUTTON
@inputs S:wirelink     
 

S:egpRoundedBox(1, vec2(256,100),vec2(100,50))
S:egpRoundedBox(2, vec2(256,256), vec2(256,256))
S:egpColor(2, vec(200,100,10))


i want to make from:     S:egpRoundedBox(1, vec2(256,100),vec2(100,50))

thx for helpers :)

Offline andreblue

  • Supporter
  • ByB Fanatic
  • *
  • Posts: 783
  • I got my zombie plan. Now do you have yours?
    • View Profile
    • Random ness here
Re: [REQUEST]E2 EGP HELP
« Reply #1 on: August 06, 2015, 11:51 pm »
Code: [Select]
function number wirelink:button(ID:number,Cursor:vector2){
    local BPos = This:egpPos(ID)
    local BSize = This:egpSize(ID)/2
    local Pressed = inrange(Cursor,BPos-BSize,BPos+BSize)
    return Pressed
}
This is one way of doing it which you can find in http://www.bybservers.co.uk/index.php?topic=15360.0 EGPLib file. You can look at his e2 on how to use it. His egplib also has some nice functions for egp screens

Offline EmekPCgame

  • ByB Rookie
  • **
  • Posts: 96
    • View Profile
Re: [REQUEST]E2 EGP HELP
« Reply #2 on: August 07, 2015, 03:08 pm »
Code: [Select]
@name
@inputs S:wirelink

function number wirelink:button(S:2,Cursor:vec2(256,256)){
    local BPos = This:egpPos(S)
    local BSize = This:egpSize(S)/2
    local Pressed = inrange(Cursor,BPos-BSize,BPos+BSize)
    return Pressed
}

S:egpClear()
S:egpRoundedBox(1, vec2(256,256), vec2(506,506))
S:egpRoundedBox(2, vec2(256,256),vec2(50,30))
S:egpColor(2, vec(200,100,0))



i cant understand this code what i need to put and where i tried this

Offline Donald Trump

  • Supporter
  • ByB Rookie
  • *
  • Posts: 53
    • View Profile
Re: [REQUEST]E2 EGP HELP
« Reply #3 on: August 07, 2015, 05:05 pm »
Here is the example Ivef used
Code: [Select]
@name egplib button test
@inputs EGP:wirelink
@persist EGPInt Use User:entity Cursor:vector2
@trigger all
interval(50)

if(duped()){
    reset()
}
if(first()){
    #include "egplib"
    EGPInt = 1
}
if(EGP & EGPInt == 1){
    EGPInt = 0
    EGP:egpClear()
    EGP:box( 1,vec2(256,100),vec2(100,100),vec4(255,0,0,200) )
    EGP:box( 2,vec2(256,300),vec2(100,100),vec4(0,0,255,200) )
}

User = EGP["User",entity]
Cursor = EGP:egpCursor(User)
Use = User:keyUse()
if(changed(Use) & Use){
    if( EGP:button( 1, Cursor ) ){
        print( "pressed the button #1" )
    }
    elseif( EGP:button( 2, Cursor ) ){
        print( "pressed the button #2" )
    }
}

http://www.bybservers.co.uk/index.php?topic=15344.msg128261#msg128261