| Blockland Forums > Modification Help |
| [Source Code] Grammar Code [UPDATES ON NEW POST] |
| (1/8) > >> |
| Brian Smithers:
Gramamr Code by Brian Smith What It does some spelling mistakes and a few other grammar stuff Why Well while it does teach some horrid coding habits, it also has a bunch of things that can help out anyone. Credits Brian Smith 8437 Brian Smithers smith8437 block8437 ya' know. Code if(isPackage(grammar)) deactivatepackage(grammar); package grammar { function NMH_Type::send(%this) { if(strStr(NMH_Channel.getValue(),"SAY: ") == -1) { if(firstLetter(%this.getValue()) $= "/") return parent::send(%this); commandToServer('MessageSent',simpleGrammar(%this.getValue())); commandToSErver('stopTalking'); canvas.popDialog(newMessageHud); NMH_Type.setValue(""); } else if(strStr(NMH_Channel.getValue(),"TEAM: ") == -1) { if(firstLetter(%this.getValue()) $= "/") return parent::send(%this); commandToServer('TeamMessageSent',simpleGrammar(%this.getValue())); commandToSErver('stopTalking'); canvas.popDialog(newMessageHud); NMH_Type.setValue(""); } } }; ActivatePackage(grammar); function firstLevelWords(%str) { for(%i=0;%i<getWordCount(%str);%i++) { %word[%i] = getWord(%str,%i); switch$(%word[%i]) { case "dont": %word[%i] = "don't"; case "i": %word[%i] = "I"; case "ive": %word[%i] = "I've"; case "whatchya": %word[%i] = "what do you"; case "wat": %word[%i] = "what"; case "whats": %word[%i] = "what's"; case "isnt": %word[%i] = "isn't"; case "im": %word[%i] = "I'm"; case "its": %word[%i] = "it's"; case "wasnt": %word[%i] = "wasn't"; case "couldnt": %word[%i] = "couldn't"; case "wouldve": %word[%i] = "would've"; case "kik": %word[%i] = "lol"; case "id": %word[%i] = "I'd"; case "ill": %word[%i] = "I'll"; case "stil": %word[%i] = "still"; case "probaly": %word[%i] = "probably"; case "probs": %word[%i] = "probably"; case "intersting": %word[%i] = "intresting"; case "bord": %word[%i] = "bored"; case "se": %word[%i] = "see"; case "catually": %word[%i] = "actually"; case "actualy": %word[%i] = "actually"; case "lest": %word[%i] = "lets"; case "somthig": %word[%i] = "something"; case "poeple": %word[%i] = "people"; case "H,,": %word[%i] = "Hmm"; case "vant": %word[%i] = "can't"; case "wont": %word[%i] = "won't"; case "nothig": %word[%i] = "nothing"; case "siht": %word[%i] = "stuff"; case "letme": %word[%i] = "let me"; case "tht": %word[%i] = "that"; case "thta": %word[%i] = "that"; case "blokc": %word[%i] = "block"; case "cant": %word[%i] = "can't"; case "sylvandor": %word[%i] = "sylvanor"; case "hsot": %word[%i] = "host"; } if(%nstr $= "") { %nstr = %word[%i]; } else { %nstr = %nstr SPC %word[%i]; } } return %nstr; } function secondLevelWords(%str) { for(%i=0;%i<getWordCount(%str);%i++) { %word[%i] = getWord(%str,%i); if(getSubStr(%word[%i],0,3) $= "Hmm" && lastLetter(%word[%i]) !$= "f") %word[%i] = "Hmm..."; %word[%i] = nameCheck(%word[%i]); if(%nstr $= "") { %nstr = %word[%i]; } else { %nstr = %nstr SPC %word[%i]; } } return %nstr; } function firstLetter(%str) { return getSubStr(%str,0,1); } function restLetters(%str) { return getSubStr(%str,1,strLen(%str)); } function lastLetter(%str) { return getSubStr(%str,strlen(%str) - 1,strLen(%str)); } function capitols(%str) { return strUpr(firstLetter(%str)) @ restLetters(%str); } function nameCheck(%word) { for(%i = 0; %i < NPL_List.rowCount(); %i++) { %list = NPL_List.getRowText(%i); %name = getField(%list, 1); if(%name $= %word) %word = strUpr(getSubStr(%word,0,1)) @ getSubStr(%word,1,strLen(%word)); } return %word; } function butCheck(%str) { if(firstWord(%str) $= "but") return restWords(%str); else return %str; } function periods(%str) { if(strLen(%str) <= 3) return %str; %per = ". , ? ; \" ! * : ( )"; for(%i=0;%i<getWordCount(%per);%i++) { if(lastLetter(%str) $= getWord(%per,%i)) %y = 1; } %blacklist = ":D D: :( :C :) :( ;( ;) :-) 8) 8( >: <: :> :< C:"; for(%i=0;%i<getWordCount(%blacklist);%i++) { if(lastWord(%str) $= getWord(%blacklist,%i)) %y = 1; } if(%y == 0) { switch$(strlwr(firstWord(%str))) { case "what": %str = %str @ "?"; case "why": %str = %str @ "?"; case "where": %str = %str @ "?"; case "how": %str = %str @ "?"; case "who": %str = %str @ "?"; case "lol": %str = %str @ "!"; case "rofl": %str = %str @ "!"; default: %str = %str @ "."; } } return %str; } function simpleGrammar(%str) { %str = butCheck(%str); %str = firstLevelWords(%str); %str = secondLevelWords(%str); %str = periods(%str); %str = capitols(%str); return %str; } Check my post for the new source code. If you use this ever, please credit me. |
| Kalphiter:
I do not understand the point of this. |
| Brian Smithers:
--- Quote from: Kalphiter on May 11, 2012, 10:00:56 PM ---I do not understand the point of this. --- End quote --- i saw the punctation topic and it reminded me of this so i decided i'd release it in coding help because it has a few useful things in it. |
| Kalphiter:
Person: What is your Blockland I'd? Person: Sorry I meant Blockland I'd? Person: wtf? Person: Is this guy I'll? Person: wtf, I'll as in sick Person: The robot cannot see it's feet Person: wtf I said it's Person: see is my favorite country Person: SWEDEN Person: What heeft hij gedaan? Person: Stupid filter replaced "wat". Stupid Brian hates Dutch people. |
| Lugnut:
I bet you had fun dreaming those up ^ |
| Navigation |
| Message Index |
| Next page |