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

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
« Previous 1 2 3 4 5 … 18 Next »
Release Chat Warp (Chat Driven Warp Chip)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Mode
Release Chat Warp (Chat Driven Warp Chip)
17-11-2021, 12:42 AM, (This post was last modified: 17-11-2021, 12:46 AM by Avorius. Edited 3 times in total.)
#1
Avorius Offline
Valued donator and member
****
Posts: 128
Threads: 47
Joined: Dec 2015
Chat Warp (Chat Driven Warp Chip)
Hello all, 

I made this Starfall chip donkey's years ago for myself mainly under the purpose of not having to go to a warp screen, or having a mainframe on board (Could be a Drive Core/Gyroscope shuttle or something similar) and to instead do it all from my chatbox.

After a while I decided to update the chip with what I call my Modular Chat System (Or M.C.S. for short), improve some functions around the place and fix a bunch of general bugs.

I've pasted the code below, enjoy and happy warping!

-George

P.S. I've also uploaded this to my Starfall Shared folder under: George > public > chatwarp.txt 

--@name Chat Warp
--@author George
--@class processor
--@dependency STEAM_0:0:145101342 libs/mcs.txt


require("libs/mcs.txt") -- This just tells the chip to use the Modular Chat System I made.

-- This section is the chat system configuration, each are customisable
----------------------------------------------------
MCSVars["ChatTag"] = "C.W."    --
MCSVars["TagColour"] = ents.owner():getTeamColor()--
MCSVars["ChatColour"] = Color(255,255,255)        --
MCSVars["ChatPrefix"] = "/"                      --
----------------------------------------------------

broadcast("Type ",MCSVars["ChatPrefix"],"help in chat to receieve the list of commands for this chip") -- 'Broadcast' is the function I made in the chat system to print messages, using your custom variables

function autoWirelink(x) -- This function facilitates the automatic wirelinking of each warp drive, itll default to the first drive in the list that you have on your ship (ill add a function to change that on tuesday)

    local driveTypes = {"bsg_drive", "quantum_slipstream_drive", "spore_drive", "st_warp_drive", "sg_hyperdrive"}
    local add2WL = {}
    for i=1,#driveTypes do
        local Table = find.byClass(driveTypes[i],function(Ent) if Ent:owner() == ents.owner() then add2WL[#add2WL+1] = Ent end end)
    end

    BSGDrive = nil
    QSDrive = nil
    SPDrive = nil
    STDrive = nil
    SGDrive = nil

    ValidDrives = {}

    for i = 1,#add2WL do
        if add2WL[i]:class() == "bsg_drive" then
            BSGDrive = add2WL[i]:getWirelink()
            ValidDrives[#ValidDrives + 1] = BSGDrive
        elseif add2WL[i]:class() == "quantum_slipstream_drive" then
            QADrive = add2WL[i]:getWirelink()
            ValidDrives[#ValidDrives + 1] = QADrive
        elseif add2WL[i]:class() == "spore_drive" then
            SPDrive = add2WL[i]:getWirelink()
            ValidDrives[#ValidDrives + 1] = SPDrive
        elseif add2WL[i]:class() == "st_warp_drive" then
            STDrive = add2WL[i]:getWirelink()
            ValidDrives[#ValidDrives + 1] = STDrive
        elseif add2WL[i]:class() == "sg_hyperdrive" then
            SGDrive = add2WL[i]:getWirelink()
            ValidDrives[#ValidDrives + 1] = SGDrive
        end
    end
end

timer.create("UpdateWL", 1, 0, autoWirelink) -- This just updates the wirelink every second forever

WarpVecs = {}
WarpNames = {}
prevLoc = Vector(0,0,0)

--[[Universe Co-Ords]]--
WarpVecs["hiigara"] = Vector( 7233.18, 8624.72, -5006.35 )
WarpVecs["desert"] = Vector( 9854.70, -10693.44, -8444.55 )
WarpVecs["lava"] = Vector( -9754.43, -105.95, -3562.54 )
WarpVecs["universe"] = Vector( 7385.85, -2656.28, -6099.56 )
WarpVecs["asteroids"] = Vector( -847.53, -2208.65, -3274.53 )

--[[Pegasus Co-Ords]]--
WarpVecs["shakuras"] = Vector( -7507.86, -7344.48, 8284.30 )
WarpVecs["pegasus"] = Vector( 2046.19, -8507.82, 9335.28 )
WarpVecs["station"] = Vector( 8492.68, -9132.07, 9554.00 )

--[[Milkyway Co-Ords]]--
WarpVecs["earth"] = Vector( -505.55, 8090.60, 8921.81 )
WarpVecs["moon"] = Vector( -4463.02, 13613.67, 10532.53 )
WarpVecs["milkyway"] = Vector( -8357.80, 6864.69, 9980.18 )

--[[Misc Co-Ords]]--
WarpVecs["build1"] = Vector( 10097.53, 12261.29, -15329.73 )
WarpVecs["build2"] = Vector( 10097.53, 4027.18, -15329.73 )
WarpVecs["build3"] = Vector( 10097.53, -4094.64, -15329.73 )
WarpVecs["build4"] = Vector( 10097.53, -12318.82, -15329.73 )

--[[Universe Names]]--
WarpNames["hiigara"] = "Hiigara | Chat Name: hiigara"
WarpNames["desert"] = "Desert | Chat Name: desert"
WarpNames["lava"] = "Lava | Chat Name: lava"
WarpNames["universe"] = "Universe Space | Chat Name: universe"
WarpNames["asteroids"] = "Asteroids | Chat Name: asteroids"

--[[Pegasus Names]]--
WarpNames["shakuras"] = "Shakuras | Chat Name: shakuras"
WarpNames["pegasus"] = "Pegasus Space | Chat Name: pegasus"
WarpNames["station"] = "Pegasus Station Hangar | Chat Name: station"

--[[Milkyway Names]]--
WarpNames["earth"] = "Earth | Chat Name: earth"
WarpNames["moon"] = "The Moon | Chat Name: moon"
WarpNames["milkyway"] = "Milkyway Space | Chat Name: milkyway"

--[[Misc Names]]--
WarpNames["build1"] = "Build Room 1 | Chat Name: build1"
WarpNames["build2"] = "Build Room 2 | Chat Name: build2"
WarpNames["build3"] = "Build Room 3 | Chat Name: build3"
WarpNames["build4"] = "Build Room 4 | Chat Name: build4"

function warpDInfo(index)
    local WV = WarpVecs[index]
    local WN = WarpNames[index]

    if WV ~= nil and WN ~= nil then
        return WarpVecs[index],WarpNames[index]
    else
        return
    end
end

function destName( value )
    if value ~= nil then
        return WarpNames[value]
    end
end

createCMD("warp", function(PLC, loc)
--PLC: Player Command (Just means any word after the command function, in this case being 'warp'
--loc: The location to grab from the table of co-ordinates above

    if PLC == nil then
        broadcast("Please enter a location to warp to ",ents.owner():name())
    elseif PLC == "to" then
        local dest = warpDInfo(loc)
        if dest ~= nil then
            prevLoc = ValidDrives[1]:entity():pos()
            ValidDrives[1]["Destination"] = dest
            ValidDrives[1]["Activate"] = 1
            broadcast("Warping to ", destName(loc))
        else
            broadcast("Please enter a valid location ",ents.owner():name())
        end
    else--this makes sure if someone doesnt use 'warp to *loc*', itll still register
        local loc = PLC
        local dest = warpDInfo(loc)
        if dest ~= nil then
            prevLoc = ValidDrives[1]:entity():pos()
            ValidDrives[1]["Destination"] = dest
            ValidDrives[1]["Activate"] = 1
            broadcast("Warping to ", destName(loc))
        else
            broadcast("Please enter a valid location ",ents.owner():name())
        end
    end
end, "w") --To add additional aliases to each command, add a comma, then your desired alias inside two "

createCMD("locations",function()
    for k,v in pairs(WarpNames) do
        printConsole(v)
    end
    broadcast("Printed all stored locations in the console ",ents.owner():name())
end,"loc","locs")

createCMD("back",function()
    if ValidDrives[1] ~= nil then
        ValidDrives[1]["Destination"] = prevLoc
        ValidDrives[1]["Activate"] = 1
        broadcast("Warping to the ship's previous location ",ents.owner():name())
end
end)

createCMD("here",function()
    if ValidDrives[1] ~= nil then
        prevLoc = ValidDrives[1]:entity():pos()
        ValidDrives[1]["Destination"] = ents.owner():pos()
        broadcast("Warping the ship to you ",ents.owner():name())
    end
end)

createCMD("help", function()
    broadcast("All the commands for this chip have been posted in the console!")
    printConsole("Chat Warp Chip Commands:\nwarp or w \nlocations, loc or locs \nhere\nhelp")
end)

autoWirelink(1)


Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
Chat Warp (Chat Driven Warp Chip) - by Avorius - 17-11-2021, 12:42 AM
RE: Chat Warp (Chat Driven Warp Chip) - by The17thDoctor - 17-11-2021, 01:45 AM
RE: Chat Warp (Chat Driven Warp Chip) - by Avorius - 17-11-2021, 11:11 PM
RE: Chat Warp (Chat Driven Warp Chip) - by Avorius - 18-11-2021, 03:15 AM

  • 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.