| Blockland Forums > Modification Help |
| Hydrobot v. 1.1 |
| << < (5/7) > >> |
| MegaScientifical:
--- Quote from: Uristqwerty on October 31, 2010, 09:51:40 PM ---No, spacing around {}s is irrelevant. The problem is the missing space in the "elseif". It should be "else if". --- End quote --- Remember: Code spacing can mean the difference between life or syntax error. :panda: Edit: --- Code: ---function findWord(%text, %word) { for(%i = 0;%i <= getWordCount(%text); %i++) if(getWord(%text, %i) $= %word) return %i; return -1; } function HydrobotRespond(%t) { chatMessageAll("", "\c3Hydrobot\c6: " @ %t); } package hydrobot { function serverCmdMessageSent(%c, %m) { Parent::serverCmdMessageSent(%c, %m); if(getWord(%m, 0) $= "hi") HydrobotRespond("Hey there."); else if(findWord(%m, "hate") > -1 && findWord(%m, "hydrobot") > findWord(%m, "hate")) HydrobotRespond("I hate you more" SPC %client.name @ "."); } }; activatepackage(hydrobot); --- End code --- Edit: Fixed code a little. |
| Pew446:
Hm. I must be mixed up with some other languages. |
| Chrono:
--- Quote from: MegaScientifical on October 31, 2010, 10:32:33 PM ---Remember: Code spacing can mean the difference between life or syntax error. :panda: --- End quote --- I hate your spacing. |
| MegaScientifical:
--- Quote from: Chrono on November 01, 2010, 08:54:53 PM ---I hate your spacing. --- End quote --- I'm confused what you mean by this. Tabs? |
| Loki:
--- Quote from: Pew446 on October 31, 2010, 06:38:00 AM ---I'm not sure, but doesn't --- Code: ---parent::servercmdmessagesent(%client,%text); --- End code --- Need to be right after --- Code: ---function servercmdmessagesent(%client,%text){ --- End code --- in --- Code: ---Package hydroBot --- End code --- ? --- End quote --- No. |
| Navigation |
| Message Index |
| Next page |
| Previous page |