![]() |
|
Release Public Chat AI - Printable Version +- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk) +-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html) +--- Forum: Expression 2 (https://teamscm.co.uk/forum-6.html) +--- Thread: Release Public Chat AI (/thread-164.html) |
Public Chat AI - Knight - 28-12-2013 Here's a Public Chat AI i created for a Friend also it only works on TSCM servers. Code: Code: @name Public AI
@inputs
@outputs Shield Cloak Door Lock
@persist Shield Cloak Door Lock
@trigger
O = owner()
E = entity()
owner():lastSaid()
runOnChat(1)
if(first())
{
botSay("TSCM", "Public", vec(203,65,84) , "Hal9000 Up and Running, Hello Burn")
}
if(chatClk(O))
{
if(owner():lastSaid()=="Hal9000 who am i?")
{
botSay("TSCM", "Public", vec(203,65,84) , "Your Burn, Are you stupid?")
}
}
if(chatClk(O))
{
if(owner():lastSaid() == "Hal9000?")
{
botSay("TSCM", "Public", vec(203,65,84) , "Yes Sir how may i help you?")
}
}
if(chatClk(O))
{
if(owner():lastSaid() == "Hal9000 raise shield")
{
botSay("TSCM", "Public", vec(203,65,84) , "Raising Shield Now , Sir!")
Shield = 1
}
}
if(chatClk(O))
{
if(owner():lastSaid() == "Hal9000 lower shield")
{
botSay("TSCM", "Public", vec(203,65,84) , "Lowering Shield Now , Sir!")
Shield = 0
}
}
if(chatClk(O))
{
if(owner():lastSaid() == "Hal9000 enable cloak")
{
botSay("TSCM", "Public", vec(203,65,84) , "Cloaking Enabled, Sir!")
Cloak = 1
}
}
if(chatClk(O))
{
if(owner():lastSaid() == "Hal9000 disable cloak")
{
botSay("TSCM", "Public", vec(203,65,84) , "Cloaking Disabled, Sir!")
Cloak = 0
}
}
if(chatClk(O))
{
if(owner():lastSaid() == "Hal9000 open doors")
{
botSay("TSCM", "Public", vec(203,65,84) , "Opening All Doors, Sir!")
Door = 1
}
}
if(chatClk(O))
{
if(owner():lastSaid() == "Hal9000 close doors")
{
botSay("TSCM", "Public", vec(203,65,84) , "Closing All Doors, Sir!")
Door = 0
}
}
if(chatClk(O))
{
if(owner():lastSaid() == "Hal9000 enable lockdown")
{
botSay("TSCM", "Public", vec(203,65,84) , "Lockdown enabled RED ALERT!!! LOCKING DOWN, Sir!")
Lock = 1
}
}
if(chatClk(O))
{
if(owner():lastSaid() == "Hal9000 disable lockdown")
{
botSay("TSCM", "Public", vec(203,65,84) , "Lockdown Disabled, Sir!")
Lock = 0
}
}Wiring up: [Shield] Activate > Shield [Cloak] Activate > Cloak [SBEP Door] Lock_1 > Lock [As many as you want for doors] [SBEP Door] Open > Door [ As Many as you want ] Any questions? Feel free to contact me on the server or over steam RE: Public Chat AI - Packge - 29-12-2013 Gj nice and sample
RE: Public Chat AI - Person8880 - 30-12-2013 Have you not considered how to condense it at all? Rather than doing loads of the same copy-paste code with a bit changed, you can condense it into one large statement. Also, you misunderstand what @persist means. @persist is for variables you want to store between executions, it has nothing to do with inputs or outputs. Code: @name Public AI
@outputs Shield Cloak Door Lock
@persist Owner Chip
runOnChat(1)
if(first())
{
botSay("TSCM", "Public", vec(203,65,84) , "Hal9000 Up and Running, Hello Burn")
Owner = owner()
Chip = entity()
}
elseif(chatClk(Owner))
{
LastSaid = Owner:lastSaid()
if(LastSaid=="Hal9000 who am i?")
{
botSay("TSCM", "Public", vec(203,65,84) , "Your Burn, Are you stupid?")
}
elseif(LastSaid == "Hal9000?")
{
botSay("TSCM", "Public", vec(203,65,84) , "Yes Sir how may i help you?")
}
elseif(LastSaid == "Hal9000 raise shield")
{
botSay("TSCM", "Public", vec(203,65,84) , "Raising Shield Now , Sir!")
Shield = 1
}
elseif(LastSaid == "Hal9000 lower shield")
{
botSay("TSCM", "Public", vec(203,65,84) , "Lowering Shield Now , Sir!")
Shield = 0
}
elseif(LastSaid == "Hal9000 enable cloak")
{
botSay("TSCM", "Public", vec(203,65,84) , "Cloaking Enabled, Sir!")
Cloak = 1
}
elseif(LastSaid == "Hal9000 disable cloak")
{
botSay("TSCM", "Public", vec(203,65,84) , "Cloaking Disabled, Sir!")
Cloak = 0
}
elseif(LastSaid == "Hal9000 open doors")
{
botSay("TSCM", "Public", vec(203,65,84) , "Opening All Doors, Sir!")
Door = 1
}
elseif(LastSaid == "Hal9000 close doors")
{
botSay("TSCM", "Public", vec(203,65,84) , "Closing All Doors, Sir!")
Door = 0
}
elseif(LastSaid == "Hal9000 enable lockdown")
{
botSay("TSCM", "Public", vec(203,65,84) , "Lockdown enabled RED ALERT!!! LOCKING DOWN, Sir!")
Lock = 1
}
elseif(LastSaid == "Hal9000 disable lockdown")
{
botSay("TSCM", "Public", vec(203,65,84) , "Lockdown Disabled, Sir!")
Lock = 0
}
}There's still more that can be done to it to improve it, such as making it case insensitive, delaying the response so it appears after what you say and avoiding copy-pasting the same botSay() line every time you want it to speak. I'll leave you to figure out how to do that. RE: Public Chat AI - Knight - 31-12-2013 Thank you for that ille try and use that when i can and will still improve this E2. Also Person can yo do me 2 favors 1. Change my Forum name to <ITG>Firestorm and give me forum member group. thanx also its my Birthday RE: Public Chat AI - bovb902 - 02-01-2014 Putting this to good use. I am also modifying it for some Selfdestruct functions and armor deployation so far so good RE: Public Chat AI - bovb902 - 08-01-2014 Can i use this as an Faction Controlled something? i would like that script command for it please. my faction wants access to my ship fully RE: Public Chat AI - Knight - 24-09-2014 Sure. |