Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - kevinminion

Pages: 1 ... 6 7 [8] 9
106
Expression 2 (E2) Code / Space Combat 2 - Scoreboard e2
« on: September 16, 2015, 01:07:19 am »
Space Combat 2 - Scoreboard e2

Special thanks to Zombie who created the e2 extensions for getting the Ship Core Stats.  I made this as a sample e2 on how to use the new functions.  I think I have included them all in this example.
 
Setup:
Place an EGP v3 screen, hud, or emitter
Place the E2 chip
 
Wiring:
Wire the EGP[wirelink] from the e2 chip to the wirelink of the EGP v3
 
I think you will probably have to reload the chip (update) once wiring is complete to clear the screen.  If you are using a EGPv3 HUD or Emitter, you will need to press your Use key on it to activate it.
 
Chat Commands:
!1 <playername> to set player 1   also accepts !player1
!2 <playername> to set player 2   also accepts !player2
!battle or !engage to set the chip to auto-update every second.  !battle or !engage again to stop auto-update.  The EGPv3 will be black if not auto-updating, red if it is.
 
Code: [Select]
@name SC2_Scoreboard
@inputs EGP:wirelink
@outputs
@persist [Player1 Player2]:table Engage
@trigger

if (first()) {
    Engage = 0
    EGP:egpClear()
    EGP:egpBox(2,vec2(250,250),vec2(510,510))
    EGP:egpColor(2,vec(0,0,0))
    EGP:egpResolution(vec2(0,0), vec2(500,500))
       
    EGP:egpText(200,"PLAYER 1",vec2(50,20))
    EGP:egpText(225,"PLAYER 2",vec2(300,20))
   
    EGP:egpLine(275,vec2(250,0),vec2(250,500))
    EGP:egpLine(276,vec2(0,40),vec2(500,40))   
   
    runOnChat(1)   
    interval(500)
    function entity getPlayerCore(Player:entity) {
       
        # print(Player:name())
       
        # find ship core(s) of Player
        findClearWhiteList()
        findIncludePlayerProps(Player)
        ShipCores = findByClass("ship_core*")
        # print("# Ship Cores after find: " + ShipCores)
               
        if (ShipCores > 0) {
            Player["ShipCore",entity] = findResult(1)
            return Player["ShipCore",entity]
        }
    }
   
    function getPlayerCoreInfo(Ply:table) {
        if (Ply["PlayerNumber",number] == 1 | Ply["PlayerNumber",number] == 2) {
            if (!Ply["ShipCore",entity]:isValid()) {
                ShipCore = getPlayerCore(Ply["Entity",entity])
            } else {
                ShipCore = Ply["ShipCore",entity]
            }
       
            K=201 + (25 * (Ply["PlayerNumber",number]-1))
            X=20 + (250 * (Ply["PlayerNumber",number]-1))
            Y=60
            EGP:egpText(K, "Type: " + ShipCore:getCoreType(),vec2(X,Y))
            K++
            EGP:egpText(K, "Name: " + ShipCore:getCoreName(),vec2(X,Y+25))
            K++
            EGP:egpText(K, "Shield: " + floor(ShipCore:getCoreShield()*100/ShipCore:getCoreMaxShield())+"%", vec2(X,Y+75))
            K++
            EGP:egpText(K,  floor(ShipCore:getCoreShield()) + " of " + ShipCore:getCoreMaxShield() ,vec2(X,Y+100))
            K++
            EGP:egpText(K, "Armor: "  + floor(ShipCore:getCoreArmor() *100/ShipCore:getCoreMaxArmor() )+"%",vec2(X,Y+150))
            K++
            EGP:egpText(K,  floor(ShipCore:getCoreArmor())  + " of " + ShipCore:getCoreMaxArmor()  ,vec2(X,Y+175))
            K++
            EGP:egpText(K, "Hull: "   + floor(ShipCore:getCoreHull()  *100/ShipCore:getCoreMaxHull()  )+"%",vec2(X,Y+225))
            K++
            EGP:egpText(K,  floor(ShipCore:getCoreHull())   + " of " + ShipCore:getCoreMaxHull()   ,vec2(X,Y+250))
            K++
            EGP:egpText(K, "Cap: "    + floor(ShipCore:getCoreCap()   *100/ShipCore:getCoreMaxCap()   )+"%",vec2(X,Y+300))
            K++
            EGP:egpText(K,  floor(ShipCore:getCoreCap())    + " of " + ShipCore:getCoreMaxCap()    ,vec2(X,Y+325))
           
        } else {
            hint("[Fn: getPlayerCoreInfo] Invalid", 15)
        }
    }
   
}
if (chatClk(owner())) {
    LastSaid = owner():lastSaid():lower():explode(" ")
    #LastSaid = owner():lastSaid():explode(" ")
    Arg1 = LastSaid[1,string]
    Arg2 = LastSaid[2,string]
   
    if (Arg1[1] == "!") {
        hideChat(1)   
    }
    # Chat commands
   
    if (Arg1 == "!player1" | Arg1 == "!1") {
        Ply1 = findPlayerByName(Arg2)
       
        hint("Player 1: " + Ply1:name(), 5)
       
        if (Ply1) {
            Player1["Entity", entity] = Ply1
            Player1["PlayerNumber", number] = 1
            Player1["ShipCore",entity] = noentity()
           
            EGP:egpText(200,Ply1:name(), vec2(50,20))
        }
       
        getPlayerCoreInfo(Player1)
       
    }
    if (Arg1 == "!player2" | Arg1 == "!2") {
        Ply2 = findPlayerByName(Arg2)
           
        hint("Player 2: " + Ply2:name(), 5)
               
        if (Ply2) {
            Player2["Entity", entity] = Ply2
            Player2["PlayerNumber", number] = 2
            Player2["ShipCore",entity] = noentity()           
           
            EGP:egpText(225,Ply2:name(), vec2(300,20))
        }
       
        getPlayerCoreInfo(Player2)
    }
    if (Arg1 == "!engage" | Arg1 == "!battle") {
        Engage = !Engage
               
        if(Engage) {
            EGP:egpColor(2,vec4(255,0,0,128))
            timer("AutoUpdate",100)
        } else {
            EGP:egpColor(2,vec4(0,0,0,255))
        }
    }
}
if(clk("AutoUpdate")) {
    if (Engage) {
        getPlayerCoreInfo(Player1)
        getPlayerCoreInfo(Player2)
        timer("AutoUpdate",500)
    } else {
        stoptimer("AutoUpddate")
    }
}

 

As a HUD element:

 
As a screen:

107
Announcements / Re: Hype Levels to Maximum
« on: September 15, 2015, 09:09:32 pm »
Some Hype pics for SC2

108
Player/Staff Report / Re: Ban request for damsig
« on: September 09, 2015, 10:39:15 pm »
Your Name: KevinMinion

Your SteamID: STEAM_0:0:69169624

Your Rank: Moderator

Player You are Reporting: damsig11

Their SteamID:
STEAM_0:1:39086403   
76561198038438535

Reason: Stargate shenanigans, minging on spawn, prop-pushing, trying to prop-kill,

Evidence:
https://youtu.be/npaw_o1Pcpg
https://youtu.be/EdifGoucRv4
https://youtu.be/UR-Pk3b5ZYA
 

109
Expression 2 (E2) Code / Re: An e2 request from Catalyst :D
« on: September 07, 2015, 09:09:57 pm »
I got this pic a grob was destoryed, the ship was turning to target the barely-visible one.  So grobtarget is working too :)

My crosshair (white) and the chip crosshair (red) are not aligned because my res is slightly higher than yours.


110
Expression 2 (E2) Code / Re: An e2 request from Catalyst :D
« on: September 06, 2015, 10:14:20 pm »
Okay, I've got something for you. 
 
Sorry, there are still some bugs to work out at the moment, so I haven't made the code public yet.

111
Expression 2 (E2) Code / Re: An e2 request from Catalyst :D
« on: September 06, 2015, 05:16:23 pm »
The map in the bottom left is very CPU intense, since you are technically tracking all of the map elements like you would a single target. 

Are you looking for a view from the back of the ship, or top of the ship? 

What information are you trying to gather from that element?

If I get a chance to squash in the gyropod code this evening, you should have something to test tonight.

112
Expression 2 (E2) Code / Re: An e2 request from Catalyst :D
« on: September 05, 2015, 09:09:26 pm »
Starting work on this now...

113
Expression 2 (E2) Code / Re: An e2 request from Catalyst :D
« on: September 04, 2015, 09:46:54 pm »
This is what I love to do.
 
Post a sketch of what you would like the HUD to look like.
 

114
Expression 2 (E2) Code / Re: Change a non-toggled control to a toggled one
« on: September 03, 2015, 09:47:26 pm »
So after I posted the message above, I thought it might be good to post code for those learning E2 since it's fairly simple.
 
Code: [Select]
@name example_e2_Toggle
@inputs OnValue OffValue Clk
@outputs Out
@persist IsOn
@trigger Clk
if (first()) {
    IsOn = 0    # start off
}
if (~Clk & Clk)   {   # Toggle on rising edge
   
    IsOn = !IsOn    # Toggle the state of the variable IsOn
   
    if (IsOn) {
        Out = OnValue
    } else {
        Out = OffValue
    }
}

Wire with Advanced Wiring Tool as described in the post above.

115
Expression 2 (E2) Code / Change a non-toggled control to a toggled one
« on: September 03, 2015, 09:42:59 pm »
I was asked if I could make an e2 chip that would take a non-toggled input, like MOUSE1 from the Pod Controller, and make it so that MOUSE1 only needed to be clicked once to turn on, and then once again to turn off.
 
I came up with what I think is a good solution, but it does not involve an e2 chip, I just used a toggle gate and a constant value of 1:
 
Constant Value location: Wire Tab > Inputs, Outptus > Constant Value                   * I suggest that you make this one a favorite
Toggle Gate location:   Wire tab > Chips, Gates > Gates      MEMORY folder > Toggle (Edge Triggered)
 
Using the Advanced Wiring Tool,
  • Wire the input OnValue of the Toggle gate to the constant value output of 1.
  • Wire the input Clk of the Toggle gate to the MOUSE1 output on the Pod Controller.
  • Wire the input FIRE of the weapon to Out output of the Toggle gate.
That's it!

116
Approved Applications / Re: Koch Bro, Ultra-Trusted App
« on: August 31, 2015, 10:54:25 pm »
Yes, +1 from me

117
Expression 2 (E2) Code / Re: Bloxgate's Holographic Radar!
« on: August 30, 2015, 08:14:12 pm »
Request for getPlanetModel() function

118
Player Creations / Simple Spaceship 1
« on: August 14, 2015, 11:36:11 pm »
Seems easy enough...

119
Expression 2 (E2) Code / Re: E2 chip Request
« on: August 14, 2015, 10:40:12 pm »
Okay, here's my first attempt.
Didn't know what to do when Start = 0, so I made that up
 

120
Expression 2 (E2) Code / Re: Question Regarding this childboard
« on: July 30, 2015, 08:51:50 pm »
Requests accepted.. I like to work on things while stuck on my own code.

Pages: 1 ... 6 7 [8] 9