Author Topic: Hydrobot v. 1.1  (Read 2468 times)

I am working on my first actual script and this is what I have so far:

/////////////////////////////////
/////////hydrobot v.1////////////
/////////////////////////////////
package EnterGame
{

      function gameConnection::onClientEnterGame(%this)
        {
                parent::onClientEnterGame(%this);
                messageClient(%this, '', "\c3Server is running Hydraulic's chatbot Mod Version 2.5");
         }

};

activatepackage(EnterGame);

package woot
{
   function servercmdmessagesent(%client,%message)
   {
                parent::serverCmdMessageSent(%client,%message);
      if(strlwr(getSubStr(%message,0,2)) $= "hi")
      {
         messageall('',"\c3Hydrobot\c6: Hey there.");
      }
      //moved
   }
};
activatepackage(woot);

Package hydroBot
 {
function servercmdmessagesent(%client,%text){
  if(strlwr(%text)$="i hate hydrobot"){
   announce("\c3Hydrobot\c6:I hate you more" SPC %client.name @ ".");
##}##
parent::servercmdmessagesent(%client,%text);
}
};
activatepackage("hydroBot");


Areas with Red are problems causing it not to work
Please post anything I did wrong
New error:
Loading Add-On: hydro_chatBot
Add-Ons/hydro_chatBot/server.cs Line: 25 - Syntax error.
>>> Some error context, with ## on sides of error halt:
   function servercmdmessagesent(%client,%message)
   {
                parent::serverCmdMessageSent(%client,%message);
      if(strlwr(getSubStr(%message,0,2)) $= "hi")
      {
         messageall('',"\c3Hydrobot\c6: Hey there.");
      } elseif(strlwr(%text)$="i hate hydrobot") {##
##   messageall('',"\c3Hydrobot\c6: I hate you more" SPC %client.name @ ".");
      }
   }
};
activatepackage(hydro);
« Last Edit: October 31, 2010, 09:22:31 PM by FOX TAIL »


add a return in the if statement
why are you not just using the same package and same function for servercmdmessagesent

~Reserved~
for what...?

also, aparently there's some error in the function servercmdmessagesent thing, as that's what the ## mean, there's an error above it somewhere

  announce("\c3Hydrobot\c6:I hate you more" SPC %client.name @ ".");
Wouldn't this be
Code: [Select]
messageall('',"\c3Hydrobot\c6: I hate you more, "@%client.name@".");?

Wouldn't this be
Code: [Select]
messageall('',"\c3Hydrobot\c6: I hate you more, "@%client.name@".");?
It'll work either way.


I never learned how to fix that could you guys post the code for putting it into one?
« Last Edit: October 30, 2010, 10:06:50 PM by FOX TAIL »

What do you mean "fixing it into one"? Do you mean one package and function?


I'm not sure, but doesn't
Code: [Select]
parent::servercmdmessagesent(%client,%text);Need to be right after
Code: [Select]
function servercmdmessagesent(%client,%text){in
Code: [Select]
Package hydroBot?

Add more messages; people will find a way around Hydrobot's counter-insult.


Add more messages; people will find a way around Hydrobot's counter-insult.
Such as:
Quote
forget you, Hydrobot!
?

How would I combine all the packages into one?
Could you post the code if you know?