Blockland Forums > Modification Help
Hydrobot v. 1.1
(1/7) > >>
FOX TAIL:
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);
FOX TAIL:
~Reserved~
otto-san:
add a return in the if statement
why are you not just using the same package and same function for servercmdmessagesent
phflack:

--- Quote from: FOX TAIL on October 30, 2010, 08:00:41 PM ---~Reserved~

--- End quote ---
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
Julius The 1st:

--- Quote from: FOX TAIL on October 30, 2010, 07:55:50 PM ---   announce("\c3Hydrobot\c6:I hate you more" SPC %client.name @ ".");

--- End quote ---
Wouldn't this be
--- Code: ---messageall('',"\c3Hydrobot\c6: I hate you more, "@%client.name@".");
--- End code ---
?
Navigation
Message Index
Next page

Go to full version