Coding Help.
by Caleb Stewart · in Torque Game Engine · 06/19/2014 (9:08 am) · 6 replies
Hey, I have been working on a Ai or Chatbot as you can call it, but I can't seem to stop people from spamming it so I need alittle help to try to keep that from happening.
If you think you can improve the code in any other way please let me know, I just started coding.
Did I mention this is a Add-on for the game Blockland.
The problem:
Code:
If you think you can improve the code in any other way please let me know, I just started coding.
Did I mention this is a Add-on for the game Blockland.
The problem:
if (%msg $= "Hello")
{
commandToServer('messageSent',"Hi!");
}Code:
package Excella_3.0_WakeUp
{
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
if (%msg $= "Wake Up E3")
{
if(%name $= "§gt. õïlÃêx")
commandToServer('messageSent',"Excella: I'm awake! I'm awake! I was just resting my Powercells...");
ActivatePackage(Excella_3.0);
}
if (%msg $= "Shutdown E3")
{
if(%name $= "§gt. õïlÃêx")
commandToServer('messageSent',"Excella: But? Ah, ok.");
DeactivatePackage(Excella_3.0);
}
}
};
ActivatePackage(Excella_3.0_WakeUp);
//Main Package Is Below...
package Excella_3.0
{
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
if (%msg $= "You Awake?")
{
if(%name $= "§gt. õïlÃêx")
commandToServer('messageSent',"Excella: Yeah.");
}
//NOTE: It does not matter how many spaces or tabs you put inbetween, infront, or behind the code. It's just a factor of being neater, cleaner, and easier to read.
if (%msg $= "Hello")
{
commandToServer('messageSent',"Hi!");
}
if (%msg $= "ClearAllBricks")
{
if(%name $= "§gt. õïlÃêx")
commandToServer('messageSent',"Excella: Please Hold.");
commandToServer('ClearAllBricks')
commandToServer('messageSent',"Excella: Done!")
}
if (%msg $= "ClearSpamBricks")
{
if(%name $= "§gt. õïlÃêx")
commandToServer('messageSent',"Excella: Please Hold.");
commandToServer('ClearSpamBricks')
commandToServer('messageSent',"Excella: Done!")
}
if (%msg $= "ClearBricks")
{
if(%name $= "§gt. õïlÃêx")
commandToServer('messageSent',"Excella: Please Hold.");
commandToServer('ClearBricks')
commandToServer('messageSent',"Excella: Done!")
}
if (%msg $= "ClearFloatingBricks")
{
if(%name $= "§gt. õïlÃêx")
commandToServer('messageSent',"Excella: Please Hold.");
commandToServer('ClearFloatingBricks')
commandToServer('messageSent',"Excella: Done!")
}
}
};
//Keybind to turn Excella(Chatbot) On/Off.
ActivatePackage(Excella_3.0);
if (!$Excella_3.0Bindings)
{
$remapDivision[$remapCount] = "Excella_3.0";
$remapName[$remapCount] = "Activate/Deacticate";
$remapCmd[$remapCount] = "Excella_3.0Toggle";
$remapCount++;
$Excella_3.0Bindings=true;
}
$Excella_3.0Flag=0;
function Excella_3.0Toggle(%notdepressed)
{
if (!%notdepressed) return;
if($Excella 3.0Flag==0)
{
$Excella_3.0Flag=1;
deactivatePackage(Excella 3.0);
echo("Excella: Goodnight...");
commandToServer('messageSent',"Excalla: Powercells are De-activating. ")
} else
if($Excella_3.0Flag==1)
{
activatePackage(Excella_3.0);
$Excella_3.0Flag=0;
exec("Add-ons/Client_Excella_3.0/Client.cs");
echo("Excella: Why The Hell Did You Wake Me?!");
commandToServer('messageSent',"Excella: Powercells are booting up!")
}
}About the author
My Birthday is 06/20/98... Thats about it! Oh an uh, I am beginner at coding, so help is needed.
Recent Threads
#2
06/20/2014 (8:31 pm)
Thanks for the input, but There is no Core/scripts/messages.cs in Blockland, or atleast there isn't anymore. You are talking about Blockland, eh?
#3
06/20/2014 (11:41 pm)
No, wasn't talking about Blockland, but I forgot that this is the TGE forum - I'll try to find this in the old file system when I get home. I'm sure there is a message.cs somewhere there, but the path I gave you is for T3D.
#4
06/21/2014 (1:49 am)
Ok, Thank you.
#5
06/21/2014 (10:31 pm)
Ok, if the Blockland hierarchy is anything like TGE's default then it is in common/server/message.cs.
#6
which I can't open...
06/22/2014 (12:32 pm)
Hey I found it under Blockland/base/client, but my problem is Badspot or Eric Hartman (Creator) took steps to protect Blockland and made the Message.cs into Message.cs.dsowhich I can't open...
Torque Owner Richard Ranft
Roostertail Games