+ Reply to Thread
Results 1 to 7 of 7

Thread: Chatcontrolled Holocreator

  1. #1
    Alopex Lagopus DanKing's Avatar
    Join Date
    Aug 2009
    Location
    Bergen, Norway
    Posts
    632

    Lightbulb Chatcontrolled Holocreator

    Well, this is my holocreator that uses chat commands to make holograms.
    I made this to learn how to use the holograms, arrays, tables and to get better with strings in expression 2.
    Don't come here and arse about that this has already been made and that a painter would be much faster. Now with that being said, let's tell you how this thing works.

    If anyone of you have used the Entity Command Suite (old Gmod 9 addon), or ECS for short, you will notice that this will work in a similar manner with a few differences. All holograms that are created have an index you specify, it can be anything, like 42 or Charlie, so if you want to create a hqtorus with the name charlie, just type "-create charlie hqtorus" (without the quotes) in chat!
    If you don't type in the model name, it will just default to the cube. You can change the model later with the -model command if you need that. All commands are not case sensitive, that means that the commands "-move bob 10 5 20" and "-MOVE BOB 10 5 20" is the same.
    A little watning, if you make a new holo with an index thats already been used, the index for the old holo is deleted and the holo is stuck there until you clean up your holograms.

    <imaginary video here>

    I hope you will enjoy my little creation and possibly learn something from it if you are not that good with E2, I know that I did! ^_^

    Code:
    Syntax:
    I = Index (can be anything)
    T = Model
    N = Number
    S = String
    
    Example: -create charlie hqtorus
    Commands are not case sensitive
    
    Create a holo:        -create I T (creates a holo where you look)
    Change model of holo: -model  I T
    Move a holo:          -move   I N N N (X,Y,Z, relative to itself)
    Scale a holo:         -scale  I N N N (X,Y,Z)
    Rotate a holo:        -setrot I N N N (Pitch,Yaw,Roll)
    Color a holo:         -color  I N N N (Red,Green,Blue)
    Set alpha of holo:    -alpha  I N
    Set skin of holo:     -skin   I N
    Set material of holo: -setmat I S (S is materialpath)
    Change holo renderFX: -holofx I N
    Make holo play sound: -splay  I S (S is soundpath)
    Stop holo play sound: -sstop  I
    Stop all holo sound:  -spurge
    Remove a holo:        -remove I
    Remove all holos:     -clean
    Show holo indexes:    -index (Bugged)
    (The attached file contains the syntax, so use that if you don't want to memorize all the commands)

    [highlight=e2]
    @name Dankings Holocreator
    @persist Index HI ID:table

    runOnChat(1)

    if(first())
    {
    Index = 1
    }

    if(chatClk(owner())){

    #Makes stuff cleaner
    LS = lastSpoke()wner():lastSaid():lower() #LS: LastSaid
    AR = LS:explode(" ") #AR: Array
    HI = ID[AR[2,string],normal] #HI: HoloIndex
    HN = AR[2,string] #HN: HoloName
    HS = AR[3,string] #HS: HoloString
    HE = holoEntity(HI) #HE: HoloEntity
    HX = AR[3,string]:toNumber() #HX: HoloX
    HY = AR[4,string]:toNumber() #HY: HoloY
    HZ = AR[5,string]:toNumber() #HZ: HoloZ
    HV = vec(HX,HY,HZ) #HV: HoloVector
    HA = ang(HV) #HA: HoloAngle

    #Creats a holo
    if(LS:sub(1,7):find("-create")){
    hideChat(1)
    holoCreate(Index,owner():aimPos())
    holoModel(Index,HS)
    holoAng(Index,ang(0,0,0))
    ID[AR[2,string],normal]=Index
    print("Holo '"+HN+"' with model '"+HS+"' has been created!")
    Index++
    }

    #Change model of holo
    if(LS:sub(1,6):find("-model")){
    hideChat(1)
    holoModel(HI,HS)
    print("Changed model of holo '"+HN+"' to '"+HS+"'!")
    }

    #Moves a holo
    if(LS:sub(1,5):find("-move")){
    hideChat(1)
    holoPos(HI,HEos()+HV)
    print("Moved holo '"+HN+"' with "+HX+"X "+HY+"Y "+HZ+"Z!")
    }

    #Scales a holo
    if(LS:sub(1,6):find("-scale")){
    hideChat(1)
    holoScale(HI,HV)
    print("Scaled holo '"+HN+"' to "+HX+"X "+HY+"Y "+HZ+"Z!")
    }

    #Rotates a holo
    if(LS:sub(1,7):find("-setrot")){
    hideChat(1)
    holoAng(HI,HA)
    print("Rotated holo '"+HN+"' to "+HX+"Pitch "+HY+"Yaw "+HZ+"Roll!")
    }

    #Colors a holo
    if(LS:sub(1,6):find("-color")){
    hideChat(1)
    holoColor(HI,HV)
    print("Colored holo '"+HN+"' to "+HX+"Red "+HY+"Green "+HZ+"Blue!")
    }

    #Sets alpha of holo
    if(LS:sub(1,6):find("-alpha")){
    hideChat(1)
    holoAlpha(HI,HX)
    print("Set alpha of holo '"+HN+"' to "+HX+"!")
    }

    #Set skin of holo
    if(LS:sub(1,5):find("-skin")){
    hideChat(1)
    holoSkin(HI,HX)
    print("Set skin of holo '"+HN+"' to '"+HS+"'!")
    }

    #Set material of holo
    if(LS:sub(1,7):find("-setmat")){
    hideChat(1)
    holoMaterial(HI,HS)
    print("Set material of holo '"+HN+"' to '"+HS+"'!")
    }

    #Change holo renderFX
    if(LS:sub(1,7):find("-holofx")){
    hideChat(1)
    holoRenderFX(HI,HX)
    print("Set renderFX of holo '"+HN+"' to '"+HS+"'!")
    }

    #Make holo play sound
    if(LS:sub(1,6):find("-splay")){
    hideChat(1)
    HE:soundPlay(HI,0,HS)
    print("Made holo '"+HN+"' play sound '"+HS+"'!")
    }

    #Make holo stop sound
    if(LS:sub(1,6):find("-sstop")){
    hideChat(1)
    soundStop(HI)
    print("Stopped sound of holo '"+HN+"'!")
    }

    #Stop all holo sound
    if(LS == ("-spurge")){
    hideChat(1)
    soundPurge()
    print("Stopped sound of all holos!")
    }

    #Removes a holo
    if(LS:sub(1,7):find("-remove")){
    hideChat(1)
    holoDelete(HI)
    print("Deleted holo '"+HN+"'!")
    }

    #Removes all holos and resets tables
    if(LS == "-clean"){
    hideChat(1)
    holoDeleteAll()
    ID = table()
    Index = 1
    print("Cleaned up holos!")
    }

    #Display indexes
    if(LS == "-index"){
    hideChat(1)
    printTable(ID)
    }
    }
    [/highlight]
    ^Cleanest code ever!

    Put the attachment in: steam\steamapps\your username\garrysmod\garrysmod\data\Expression2\
    Attached Files Attached Files

  2. #2
    Wirererer adeeda's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    135

    Default Re: Chatcontrolled Holocreator

    Wow, very nice. I assume this would be very useful in testing hologram sizing/placement for later use.
    Anne drew Andrew and Drew, and Druanne drew Anne, Drew, Andrew, and Ru.
    AnDrEw in-game.

  3. #3
    Wire Sofaking feha's Avatar
    Join Date
    Sep 2009
    Location
    Here
    Posts
    1,156

    Default Re: Chatcontrolled Holocreator

    when you got sub, why do find, instead of ==?

    Also, painters are better...

    ...jk XD. Well they are better for some stuff, but tbh, I belive your thing is easyer to manipulate well, while painters easily get quite... messy. And I say this judging by how it looked like when you used it, next to me painting a 3d 4 in row game :P.

    I ecpesially like how you can place its position relative to itself!.


    Now add the -c stack cmd, or how it now was written in ecs (I liked it alot XD) :P.

  4. #4
    Wire Amateur TJ3003's Avatar
    Join Date
    May 2009
    Location
    In This Little Box
    Posts
    57

    Default Re: Chatcontrolled Holocreator

    the vid dident come though

  5. #5
    Wiremod Helper Lyinginbedmon's Avatar
    Join Date
    Mar 2009
    Location
    England
    Posts
    2,659

    Default Re: Chatcontrolled Holocreator

    Quote Originally Posted by TJ3003 View Post
    the vid dident come though
    "<imaginary video here>"

    There isn't a vid to come through.

    The Olympus Technologies drones, totally not SkyNet in Gmod form.
    Cronus: The Ultimate Drone, definitely SkyNet in Gmod form.
    The gBrain Project, the drone controls system that thinks it's better than you

  6. #6
    Wire Amateur TJ3003's Avatar
    Join Date
    May 2009
    Location
    In This Little Box
    Posts
    57

    Default Re: Chatcontrolled Holocreator

    :dots: what

  7. #7
    Wire Sofaking Unsmart's Avatar
    Join Date
    Dec 2008
    Location
    Belgium OR BANland
    Posts
    1,965

    Default Re: Chatcontrolled Holocreator

    Nice, I saw you build this on my server.
    New server IP: 89.238.160.17:27018
    Hologram contraptions 1 Holo contraptions 2 EGP stuff Holo minigun Holo javelin rocket launcher
    Unsmart: I doubt the intelligence of some people.
    Drunkie: Nobody could have said that any better than Unsmart.

    Unsmart: Solece, I totally did your mom yesterday
    Solece: Who hasnt

    Divran: there are more retarded people than there are clever people in this world

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots