| Blockland Forums > Modification Help |
| Client_Punctuation Help |
| << < (4/6) > >> |
| adam savage:
--- Code: ---package Punctuation { function NMH_Type::send(%this) { %txt = %this.GetValue(); %txt = StrReplace(%txt,"cant","can't"); %txt = StrReplace(%txt,"dont","don't"); %txt = GivePeriod(%txt); %this.SetValue(%txt); } }; ActivatePackage(Punctuation); function GivePeriod(%txt) { %word = GetWord(%txt,GetWordCount(%txt)); %asdf = StrLen(%word) =- 1; %asd = StrLen(%word); %end = GetSubStr(%txt,%asdf,%asd); if(%end != ".") { return %txt @ "."; } } --- End code --- Untested. But pretty sure it will work. |
| Greek2me:
You guys might find this useful. It adds punctuation to the end of a string of text, assuming the string is only one sentence. --- Code: ---function addMissingEndPunctuation(%flag) { %endingPunct = ".?!:;"; %questionWords = " who what where when why how "; %len = strLen(%flag); if(%len > 1) { %lastChar = getSubStr(%flag,%len-1,1); if(strPos(%endingPunct,%lastChar) < 0) { %firstWord = firstWord(%flag); if(striPos(%questionWords," " @ %firstWord @ " ") >= 0) { %flag = %flag @ "?"; } else { %flag = %flag @ "."; } } } return %flag; } --- End code --- |
| Ipquarx:
--- Quote from: PurpleMetro on May 11, 2012, 09:21:33 PM ---T_T. Is it really that bad? If it is then my friend sucks at scripting T_T --- End quote --- Your friend sucks at scripting |
| Treynolds416:
--- Quote from: adam savage on May 20, 2012, 09:27:52 PM ---Untested. But pretty sure it will work. --- End quote --- "I'm going to an orthodon'tist to get braces" "Acrodon'ts make horrible pets!" "I'm going to a prosthodon'tist to get a new arm" Similarly; "He's uttering an incan'tation!" "Make that horse can'ter" "Make sure you use desiccan't in that package" "Mercan'tilism is an economic system developing during the decay of feudalism to unify and increase the power and especially the monetary wealth of a nation by a strict governmental regulation of the entire national economy usually through policies designed to secure an accumulation of bullion, a favorable balance of trade, the development of agriculture and manufactures, and the establishment of foreign trading monopolies" |
| Kalphiter:
--- Quote from: Treynolds416 on May 20, 2012, 10:22:34 PM ---"I'm going to an orthodon'tist to get braces" "Acrodon'ts make horrible pets!" "I'm going to a prosthodon'tist to get a new arm" Similarly; "He's uttering an incan'tation!" "Make that horse can'ter" "Make sure you use desiccan't in that package" "Mercan'tilism is an economic system developing during the decay of feudalism to unify and increase the power and especially the monetary wealth of a nation by a strict governmental regulation of the entire national economy usually through policies designed to secure an accumulation of bullion, a favorable balance of trade, the development of agriculture and manufactures, and the establishment of foreign trading monopolies" --- End quote --- --- Quote from: Kalphiter on May 11, 2012, 10:17:36 PM ---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 --- End quote --- |
| Navigation |
| Message Index |
| Next page |
| Previous page |