From 635f958abef136ec99d07045486a662ceae2903a Mon Sep 17 00:00:00 2001 From: CreatorADOfficial Date: Mon, 15 Jun 2026 19:44:56 +0000 Subject: [PATCH] Automated Extension submission for issue #2157 --- extensions/community/AdvancedText.json | 1126 ++++++++++++++++++++++++ 1 file changed, 1126 insertions(+) create mode 100644 extensions/community/AdvancedText.json diff --git a/extensions/community/AdvancedText.json b/extensions/community/AdvancedText.json new file mode 100644 index 000000000..24300faa0 --- /dev/null +++ b/extensions/community/AdvancedText.json @@ -0,0 +1,1126 @@ +{ + "author": "", + "category": "General", + "dimension": "", + "extensionNamespace": "", + "fullName": "Advanced Text", + "gdevelopVersion": "", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXNjcmlwdC10ZXh0LW91dGxpbmUiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTUsMjBBMSwxIDAgMCwwIDE2LDE5VjRIOEExLDEgMCAwLDAgNyw1VjE2SDVWNUEzLDMgMCAwLDEgOCwySDE5QTMsMyAwIDAsMSAyMiw1VjZIMjBWNUExLDEgMCAwLDAgMTksNEExLDEgMCAwLDAgMTgsNVY5TDE4LDE5QTMsMyAwIDAsMSAxNSwyMkg1QTMsMyAwIDAsMSAyLDE5VjE4SDEzQTIsMiAwIDAsMCAxNSwyME05LDZIMTRWOEg5VjZNOSwxMEgxNFYxMkg5VjEwTTksMTRIMTRWMTZIOVYxNFoiIC8+PC9zdmc+", + "name": "AdvancedText", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/d82927a45f231a9e240668ce0ff42da41bbb9b64fdb61be209e75fdb778e7988_script-text-outline.svg", + "shortDescription": "Adds More Text Detection.", + "version": "1.0.1", + "description": [ + "Version 1.0.0 Release:", + "- Similarity", + "- Replacing", + "- Generation", + "- Percentages And More." + ], + "tags": [ + "string", + "similarity" + ], + "authorIds": [ + "LmDPcZ5ey4WWF4VdoEQcmPVTmFu2" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [ + { + "name": "Dir", + "type": "string", + "value": "other such first many new more same own good different great long high social little much important small most large old political few general second possible public last american several human right early certain economic least common present next local best particular young various necessary whole only true able major full low free available real white similar total special less short specific single self national individual due clear black personal higher better third natural greater open non difficult current further main physical foreign lower strong private likely international significant late british basic hard modern simple normal sure military central poor religious original effective following direct final english cultural big recent complete german financial red positive primary appropriate french western legal european equal larger average historical critical wide traditional additional active complex former independent entire medical useful actual close moral relative bad deep constant previous easy serious negative potential fine industrial subject future internal initial well federal essential dead indian dark left popular successful standard year past ready sexual african professional wrong very proper separate heavy civil responsible considerable light cold above chinese older practical external one mental sufficient interesting upper scientific key christian annual domestic limited japanese smaller southern earlier commercial female impossible powerful green later like clinical jewish blue ancient educational typical rich technical environmental formal male top aware hot south beautiful in variable obvious secondary enough urban regular relevant greatest spiritual time double happy term latter democratic multiple soviet dependent correct northern middle rural official anti fundamental two immediate numerous overall half russian psychological usual native regional highest north agricultural literary broad perfect experimental fourth global net ordinary related apparent nuclear daily principal east contemporary severe reasonable subsequent dry worth longer emotional intellectual unique pure familiar solid brief famous fresh day corresponding characteristic maximum detailed outside theoretical fair to opposite capable visual interested joint ill e adequate based pre substantial west unable structural soft greek false largest inner divine mean extensive excellent rapid absolute consistent continuous spanish administrative strange willing wild alternative slow distinct safe permanent front corporate academic up thin nineteenth mere universal functional unknown careful eastern narrow evident sound classical minor weak suitable chief liberal extreme yellow parallel warm mixed flat so italian huge holy al contrary vast dangerous three stable chemical valuable rare worse visible criminal sensitive mechanical state radical extra superior conventional thick dominant post collective younger efficient roman a ethnic linear organic oral century creative colonial vertical dynamic empty minimum cognitive biological communist conscious logical afraid equivalent quick near concrete mass acute sharp easier quiet brown adult accurate ideal partial irish bright identical conservative magnetic frequent electronic fixed square fat cross clean back organizational constitutional genetic ultimate secret vital dramatic objective round alive straight unusual chronic rational electric mutual class competitive revolutionary statistical random musical crucial racial sudden acid de content temporary sick line remarkable exact valid empirical helpful nice comprehensive united level fifth nervous expensive prominent healthy liquid institutional of on silent sweet catholic strategic molecular comparative called electrical raw acceptable scale latin philosophical violent senior asian all desirable sacred tall steady wonderful canadian sub distant progressive enormous horizontal and ethical intense smooth applicable over animal abstract wise worst gold precise legislative remote technological outer arab uniform slight attractive evil tiny royal angry advanced friendly dear busy spatial rough primitive judicial systematic lateral sorry plain off comfortable definite massive firm widespread prior twentieth mathematical verbal marginal excessive stronger gross socialist terrible wet mexican fewer re world productive wider glad linguistic patient moderate symbolic far earliest plastic type prime eighteenth blind neutral guilty hand extraordinary metal surprising fellow york grand thermal artificial five lowest genuine armed dimensional gray optical unlikely developmental reliable executive comparable explicit satisfactory muslim golden diverse preliminary wooden noble part striking controlled cool classic elderly four temporal indirect romantic intermediate differential passive life voluntary out republican adjacent behavioral exclusive closed inherent inevitable complicated quantitative respective artistic australian medieval l probable inadequate anxious informal strict fiscal ideological profound extended eternal known infinite proud honest peculiar absent pleasant live optimal renal static imperial outstanding presidential digital integrated legitimate curious aggressive deeper elementary history surgical occasional flexible islamic convenient solar atomic isolated latest sad conceptual underlying everyday cost intensive odd tight subjective mid worthy pale meaningful therapeutic making dutch painful circular realistic multi unconscious child sophisticated inferior down monetary leading intelligent governmental numerical minimal diagnostic indigenous bottom illegal aesthetic distinctive polish operational sole posterior material fast bitter broader brilliant peripheral finite biblical rigid automatic lesser routine favorable cooperative cardiac arbitrary loose favorite subtle gay uncertain hostile monthly colored naval physiological historic developed skilled anterior pro man capitalist gentle loud pulmonary innocent provincial mild page specialized bare oriented excess terminal inter shaped theological sensory the stress novel working d shorter secular geographical intimate liable selective influential modest successive continued minute binding water regulatory grave occupational expert municipal marine thirty adverse closer virtual peaceful mobile sixth immune coastal representative lead forward faithful crystal protective semi family spontaneous elaborate tremendous mad welcome abnormal feminist grateful proportional dual operative precious sympathetic soc broken accessible pregnant lovely egyptian spinal even marked diplomatic observed point mature competent co residential impressive unexpected nearby test ecological unnecessary generous respiratory supreme cerebral unpublished delicate analytical tropical statutory cell weekly vulnerable par anglo end poetic written online beneficial cheap parliamentary aged turkish tough seventeenth integral korean eager ongoing silver persistent ray calm six territorial nearest hidden naked maternal seventh magic shallow implicit qualitative pretty gradual wealthy concerned tribal exciting decisive confident associated interior blank induced invisible protestant parental notable medium vague oldest periodic manual select thorough causal giant bigger pink improved psychiatric immense hour intact grey grade by dense reduced toxic hungry biggest abundant incomplete dirty civilian fatal handsome retail signal inch insufficient semantic irregular intrinsic residual follow offensive fluid prospective mysterious descriptive crazy elastic desperate foot destructive architectural synthetic war continental evolutionary le bacterial nominal shared endless defensive israeli resistant controversial customary crude vain cellular tragic made systemic lucky cent bold funny communal negro marital unfortunate exceptional secure t singular vascular longitudinal void bound underground instrumental overwhelming cut discrete air range autonomous compatible superficial electoral stupid feminine dull peak useless feasible abdominal vigorous harsh pressure profitable costly unhappy ever scottish smallest blood alien reluctant sociological simultaneous video sixteenth analogous sensible interpersonal aggregate portuguese congressional bloody closest preferred civic urgent neural generic seasonal counter deliberate cruel balanced homogeneous style dental infant trained magnificent b quarterly facial beloved side angular composite loyal printed focal steep authentic coronary graduate base age narrative cumulative prolonged rear lonely payable subordinate graphic fetal heroic eligible casual lasting constructive taxable run ambitious susceptible unstable sheer irrelevant tired bilateral socio distinguished hindu smart ignorant straightforward mighty atmospheric starting simplest comic coherent strongest body marxist brave opening atlantic median doubtful demographic elegant soluble faint home buddhist varied inappropriate adaptive victorian required v looking generalized keen finest step postwar glorious normative allied managerial problematic else rid school alternate splendid complementary humble coarse vocal viable drunk quasi incorrect wind overseas language awful conditional ambiguous obscure inconsistent informed date reproductive temperature transparent contradictory junior sized innovative ex defined expected harmful experienced promising earth scholarly vocational imaginary fortunate serial inflammatory swedish orange modified learned un favourable apt uncomfortable hungarian arterial stiff celebrated plate foolish minded dietary eighth interactive geographic muscular computer archaeological arabic substantive preceding juvenile cosmic urinary anonymous metropolitan unemployed uncommon ample vivid laser existing clever incapable risk ugly imperative recurrent enthusiastic unfair binary unified married supportive malignant fierce bourgeois transient scarce orthodox bureaucratic hierarchical reciprocal amazing length prepared absurd ok muscle instructional simpler compulsory cervical decision word sec increased worldwide month plausible measured polar reverse indispensable editorial face twenty lively fit fourteenth literal i metaphysical approximate fascinating structured mail miserable rectangular unchanged adolescent charming nazi o ninth distal persian unpleasant stationary being int quality prevalent compact port income inside sustainable alleged sincere fond psychic masculine conflicting congenital basal pertinent kinetic tax idle decent defective alert intestinal lengthy prone p analytic selected cuban suspicious purple olive refined imaginative at austrian neo fifty affected slower per unwilling medial sovereign incredible rat premature zero wicked heat forthcoming spectacular or solitary hazardous optimum hypothetical ocean rhetorical p. weaker infectious perceptual indifferent elevated convincing utter formidable dorsal fertile file geometric harder lost optional sea registered latent qualified restrictive planned respectable vietnamese potent factual prompt ecclesiastical definitive perpendicular oriental manifest mandatory unsuccessful set restricted conspicuous responsive coloured born heavenly passionate mystical finished expressive nonlinear shear null nasal cubic privileged reactive horrible for hollow fold une orderly overhead radial slightest scattered unaware helpless okay eminent gastric neat supernatural nearer sequential negligible ridiculous added parent deaf speaking deadly nine unclear twin feudal dim wave corrupt gothic magical pastoral socioeconomic no cautious solvent methodological aboriginal pragmatic undesirable still petty unlimited trivial fearful savage y lean sun copyright theatrical bit interval assistant countless seven resident silly concentrated die accidental unrelated geological hispanic skeletal stimulating outdoor seventy tangible site event explanatory infected hybrid metabolic affective traumatic bronze rigorous party consequent slender youngest client size homosexual naive charitable outward exotic affirmative procedural ashamed eventual click disabled biochemical venous intended order ineffective built laboratory metallic benign exempt brazilian nutritional challenging market earnest wing desired relational solemn palestinian weary hereditary terrorist sandy axial case awkward immigrant hepatic deficient grammatical myocardial sterile owned web mortal schematic summary wholesale curved insignificant rival lighter fantastic ten speculative unequal frozen library societal fifteenth value civilized cortical alcoholic excited tender predictable perpetual eyed swiss rate convinced optic introductory auditory frontal textual indicative worthwhile incompatible clerical continual unreasonable eight longest lived land encouraging spherical confidential proximal unprecedented understandable way decorative stage robust optimistic resulting surplus twelfth spectral cardiovascular delightful overt imperfect preferable photographic mediterranean contingent unfamiliar disastrous speed irrational established predominant audio energetic satellite enhanced norwegian authoritative cheaper microscopic prosperous covered clearer standardized transitional suburban earthly upward confederate newer neighboring instant equitable preventive consecutive power micro selfish poorer resultant noticeable questionable intravenous unacceptable cyclic timely be centralized intuitive express fragile polished missionary rule heterogeneous just polite sided attributable acoustic health moist hers depth disciplinary tentative deepest trade quantum agrarian brutal authoritarian turbulent indebted collaborative protected explosive hydraulic city ours ironic misleading volatile kind newborn mine jealous patriotic arithmetic diffuse aqueous pathological mother backward worldly reflective intentional pervasive computational electromagnetic utmost permissible heavier ionic viral fashionable shy swift radioactive furious vicious gifted ph improper volcanic stern fossil plural mainstream awake sectional sixty climatic meaningless blessed postoperative unjust tense fishing inclusive thoughtful tactical thirteenth morphological biographical unilateral righteous damp spare use metric supplementary brain dreadful danish weighted la lesbian gastrointestinal restless youthful cheerful recreational after crystalline court heart invalid item est uneasy relaxed innate tumor wartime held group portable ceremonial nerve irrigation erotic lexical paris suggestive ceramic educated contractual pious neighbouring law pagan athletic grim week aristocratic tenth partisan downward advantageous do depressed aortic rounded triple sic inward persuasive ripe notorious fig. priori innumerable fruitful work pelvic it noteworthy auxiliary maritime digit psychoanalytic driven injured wireless story hopeless drastic upright imminent elder labour may enlightened syntactic yearly epithelial cd belgian fuzzy richer god miscellaneous economical peer rocky fairy lawful foregoing invaluable night tidal fictional requisite advisable note orbital fitting oval inexpensive standing observable maximal proposed prophetic alkaline adrenal prescribed problem glass admirable interim terrestrial caribbean welfare implied favourite aerial harmonic rhythmic concurrent confusing eldest distributed headed abrupt vacant patriarchal forced cylindrical parish documentary iranian advisory agreeable living rude unsatisfactory oblique bent sore memorable intermittent grown mile interstate triangular delicious intracellular erroneous anal symmetrical vaginal devoid talented familial fashioned intricate interest noisy as safer fancy sober nation house southeast under derived colorful service und provisional troubled deceased martial dumb loving il unlawful sentimental unwanted chronological damn militant object eye astonishing endogenous enduring papal foul lemon rental diagonal forest exaggerated da field aquatic risky northwest humanitarian person undergraduate virtuous incidental retrieval amusing split repeated theory government prudent decimal unmarried impatient unpredictable salient fire eu vice multinational recorded tertiary applied calculated exponential r incremental cultured durable degree pointed lazy repetitive existential melancholy symmetric capillary faster celestial involuntary saturated byzantine inorganic neurological bizarre evangelical obsolete flower electron superb occupied uneven haired profit anthropological coming paramount needless spiral inefficient finnish receptive wretched topical threatening identifiable anatomical funeral tolerant graceful impersonal dried bilingual startling legendary lethal allergic sour miniature conceivable predictive diabetic retinal handed insane wall university sublime read acting space ancestral control akin graphical commonplace infrared indo immortal derivative exquisite gigantic harmless filled thematic futile ground easiest boston sustained oil iron coral baltic communicative indefinite indonesian connective incoming laden darker thyroid section gracious feeble syrian delayed interpretive cultivated energy lofty inactive suggested chaotic undue directed divergent care foster substrate reversible transcendental centre sunny finer bearing oppressive ruling plus somatic discriminatory troublesome purpose recognizable union machine corrective intelligible dubious bulk conditioned downtown harmonious winning informative postmodern unimportant accountable mammalian lifelong temperate extant frightening handicapped geometrical fuller paid ingenious knowledgeable heterosexual fascist heated gravitational unrealistic extracellular head symptomatic pictorial seismic devastating stubborn dialectical prehistoric tear digestive mediated nonprofit used ontological satisfied synonymous epic immature daring supervisory organ contextual conducive careless departmental ottoman instantaneous victorious unskilled porous reminiscent crowded unnatural exhaustive arid barren unfinished pleasing microbial cranial uterine paradoxical weird book industrialized measurable embryonic solving activated appreciable teenage eleventh czech saxon intriguing bony conclusive price reported transnational credible ibid street regulated monumental cf. unaffected father pancreatic habitual fibrous instructive racist archaic canonical perennial welsh confused homeless image nutrient smoke proprietary practicable behavioural nationwide vulgar ardent pituitary impending printing tubular elusive narrower stylistic inverted detrimental simulated associate atrial punitive unfavorable genital frightened ovarian unanimous collar monastic ranking member fragmented postal hourly hopeful ice happier your gloomy model picturesque subsidiary inaccurate organisational rotational rugged rewarding beta thoracic retired iraqi unavoidable additive faulty dielectric mystic endocrine cm humorous powerless super interstitial controlling utopian arch inductive damaging allowable intolerable respected southwest irreversible worthless honorable discursive retrospective con through eccentric formative antique table frank compare approved erect handy star nasty volume aids producing blond founding depressive dusty tedious modal amorphous humane mythical combined manufactured neonatal redundant country stark bipolar armenian pharmaceutical marvelous skeptical gas inhibitory slim migrant faced miraculous fiery reactionary hearted antibiotic opaque imperialist amateur unseen pediatric multilateral z money collateral glacial eloquent neurotic ultra fluorescent bird bed aromatic inert illustrative affectionate pronounced richest pop automated meta employment entrepreneurial tier preferential immoral foremost anticipated benevolent deductible cunning exogenous stringent shortest room macro louder autobiographical precarious would retarded lumbar underdeveloped consonant reaching pine stochastic insoluble cement anglican merry distance emergent unpaid unconditional rainy" + } + ], + "eventsFunctions": [ + { + "description": "Gives a percentage of similarity between two strings, good for small texts.", + "fullName": "Text Similarity Comparison", + "functionType": "Expression", + "name": "Text_Similarity_Comparison", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "function normalize(text) {", + "", + " text = text.toLowerCase().trim();", + "", + " //keep normals", + " text = text.replace(/(.)\\1{2,}/g, \"$1$1\");", + "", + " //remove extra spaces", + " text = text.replace(/\\s+/g, \" \");", + "", + " return text;", + " }", + "", + " function levenshtein(a, b) {", + "", + " const matrix = [];", + "", + " for (let i = 0; i <= b.length; i++) {", + " matrix[i] = [i];", + " }", + "", + " for (let j = 0; j <= a.length; j++) {", + " matrix[0][j] = j;", + " }", + "", + " for (let i = 1; i <= b.length; i++) {", + "", + " for (let j = 1; j <= a.length; j++) {", + "", + " if (b[i - 1] === a[j - 1]) {", + "", + " matrix[i][j] =", + " matrix[i - 1][j - 1];", + "", + " } else {", + "", + " matrix[i][j] = Math.min(", + " matrix[i - 1][j - 1] + 1,", + " matrix[i][j - 1] + 1,", + " matrix[i - 1][j] + 1", + " );", + "", + " }", + "", + " }", + "", + " }", + "", + " return matrix[b.length][a.length];", + " }", + "", + " function similarity(a, b) {", + "", + " a = normalize(a);", + " b = normalize(b);", + "", + " if (a === b) return 100;", + "", + " const distance =", + " levenshtein(a, b);", + "", + " const score =", + " (1 - distance / Math.max(a.length, b.length)) * 100;", + "", + " return Math.max(", + " 0,", + " Math.min(100, Math.round(score))", + " );", + " }", + "", + " const text1 =", + " eventsFunctionContext.getArgument(\"Text1\");", + "", + " const text2 =", + " eventsFunctionContext.getArgument(\"Text2\");", + "", + " eventsFunctionContext.returnValue =", + " similarity(text1, text2);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "String", + "name": "Text1", + "type": "string" + }, + { + "description": "String", + "name": "Text2", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Runs for each word and saves the largest percentage, best for moderation in large sentences.", + "fullName": "Word Detection In Sentence", + "functionType": "Expression", + "name": "Word_Detection", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "function normalize(text) {", + "", + " text = text.toLowerCase().trim();", + "", + " //remove spam letters", + " text = text.replace(/(.)\\1{2,}/g, \"$1$1\");", + "", + " //remove extra spaces", + " text = text.replace(/\\s+/g, \" \");", + "", + " return text;", + " }", + "", + " function levenshtein(a, b) {", + "", + " const matrix = [];", + "", + " for (let i = 0; i <= b.length; i++) {", + " matrix[i] = [i];", + " }", + "", + " for (let j = 0; j <= a.length; j++) {", + " matrix[0][j] = j;", + " }", + "", + " for (let i = 1; i <= b.length; i++) {", + "", + " for (let j = 1; j <= a.length; j++) {", + "", + " if (b[i - 1] === a[j - 1]) {", + "", + " matrix[i][j] =", + " matrix[i - 1][j - 1];", + "", + " } else {", + "", + " matrix[i][j] = Math.min(", + " matrix[i - 1][j - 1] + 1,", + " matrix[i][j - 1] + 1,", + " matrix[i - 1][j] + 1", + " );", + "", + " }", + "", + " }", + "", + " }", + "", + " return matrix[b.length][a.length];", + " }", + "", + " function similarity(a, b) {", + "", + " a = normalize(a);", + " b = normalize(b);", + "", + " if (a === b) return 100;", + "", + " const distance =", + " levenshtein(a, b);", + "", + " const score =", + " (1 - distance / Math.max(a.length, b.length)) * 100;", + "", + " return Math.max(", + " 0,", + " Math.min(100, Math.round(score))", + " );", + " }", + "", + " function bestWordSimilarity(text, target) {", + "", + " text = normalize(text);", + " target = normalize(target);", + "", + " const words = text.split(\" \");", + "", + " let highest = 0;", + "", + " for (const word of words) {", + "", + " const score =", + " similarity(word, target);", + "", + " if (score > highest) {", + " highest = score;", + " }", + "", + " }", + "", + " return highest;", + " }", + "", + " const text =", + " eventsFunctionContext.getArgument(\"Text\");", + "", + " const target =", + " eventsFunctionContext.getArgument(\"Target\");", + "", + " eventsFunctionContext.returnValue =", + " bestWordSimilarity(text, target);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Sentence", + "name": "Text", + "type": "string" + }, + { + "description": "Word", + "name": "Target", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Compare the similarity between two strings, good for small sentences.", + "fullName": "Text Similarity Comparison", + "functionType": "Condition", + "name": "Function", + "sentence": "Text Similarity Comparison _PARAM1_,_PARAM2_,_PARAM3_,_PARAM4_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Sign", + "=", + "\"=\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "AdvancedText::Text_Similarity_Comparison(String1, String2)", + "=", + "Percent" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Sign", + "=", + "\"≠\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "AdvancedText::Text_Similarity_Comparison(String1, String2)", + "!=", + "Percent" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Sign", + "=", + "\">\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "AdvancedText::Text_Similarity_Comparison(String1, String2)", + ">", + "Percent" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Sign", + "=", + "\"<\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "AdvancedText::Text_Similarity_Comparison(String1, String2)", + "<", + "Percent" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Sign", + "=", + "\"≥\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "AdvancedText::Text_Similarity_Comparison(String1, String2)", + ">=", + "Percent" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Sign", + "=", + "\"≤\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "AdvancedText::Text_Similarity_Comparison(String1, String2)", + "<=", + "Percent" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "String", + "name": "String1", + "type": "string" + }, + { + "description": "String", + "name": "String2", + "type": "string" + }, + { + "description": "Operator", + "name": "Sign", + "supplementaryInformation": "[\"=\",\">\",\"<\",\"≥\",\"≤\",\"≠\"]", + "type": "stringWithSelector" + }, + { + "description": "Percent (0-100%)", + "name": "Percent", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Replace Words In Sentence, Good For Moderating Bad Words.", + "fullName": "Replace Word In Text", + "functionType": "StringExpression", + "name": "ReplaceWordInText", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "function normalize(text) {", + " return text", + " .toLowerCase()", + " .trim()", + " .replace(/(.)\\1{2,}/g, \"$1$1\"); //remove spam repeats", + " }", + "", + " function levenshtein(a, b) {", + "", + " const matrix = [];", + "", + " for (let i = 0; i <= b.length; i++) {", + " matrix[i] = [i];", + " }", + "", + " for (let j = 0; j <= a.length; j++) {", + " matrix[0][j] = j;", + " }", + "", + " for (let i = 1; i <= b.length; i++) {", + "", + " for (let j = 1; j <= a.length; j++) {", + "", + " if (b[i - 1] === a[j - 1]) {", + " matrix[i][j] = matrix[i - 1][j - 1];", + " } else {", + " matrix[i][j] = Math.min(", + " matrix[i - 1][j - 1] + 1,", + " matrix[i][j - 1] + 1,", + " matrix[i - 1][j] + 1", + " );", + " }", + "", + " }", + "", + " }", + "", + " return matrix[b.length][a.length];", + " }", + "", + " function similarity(a, b) {", + "", + " if (!a || !b) return 0;", + "", + " const distance = levenshtein(a, b);", + "", + " return (", + " 1 - distance / Math.max(a.length, b.length)", + " ) * 100;", + " }", + "", + " function maskWord(word, char) {", + " return char.repeat(word.length);", + " }", + "", + " function replaceSimilarWords(text, target, maskChar, harshness) {", + "", + " text = normalize(text);", + " target = normalize(target);", + "", + " const words = text.split(\" \");", + "", + " ", + " //0 = light filtering", + "", + " const sensitivity =", + " 0.5 + (harshness / 100) * 0.5; ", + " ", + "", + " const threshold =", + " 70 * sensitivity; ", + " //range: 35-70", + "", + " for (let i = 0; i < words.length; i++) {", + "", + " const score =", + " similarity(words[i], target);", + "", + " if (score >= threshold) {", + " words[i] = maskWord(words[i], maskChar || \"*\");", + " }", + "", + " }", + "", + " return words.join(\" \");", + " }", + "", + " const text1 =", + " eventsFunctionContext.getArgument(\"Text1\");", + "", + " const text2 =", + " eventsFunctionContext.getArgument(\"Text2\");", + "", + " const maskChar =", + " eventsFunctionContext.getArgument(\"ReplaceWith\") || \"*\";", + "", + " const harshness =", + " Number(eventsFunctionContext.getArgument(\"Harshness\") || 50);", + "", + " eventsFunctionContext.returnValue =", + " replaceSimilarWords(text1, text2, maskChar, harshness);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Text To Replace", + "name": "Text1", + "type": "string" + }, + { + "description": "Word To Replace", + "name": "Text2", + "type": "string" + }, + { + "description": "Replace With", + "longDescription": "Use one letter or sign like \"#\" because it will replace all the letters and having \"##\" would make the replacement 2x longer. \"Hello\" → \"#####\" or with \"##\" \"Hello\" → \"###########\".", + "name": "ReplaceWith", + "type": "string" + }, + { + "description": "Harshness (0-100%)", + "longDescription": "Recommended 80%\n- 100% / Would replace everything.", + "name": "Harshness", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Informs if a password is too weak.", + "fullName": "Password Crackable Percent", + "functionType": "Expression", + "name": "PasswordCrackableTime", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const password =", + " eventsFunctionContext.getArgument(\"Password\") || \"\";", + "", + " let score = 100;", + "", + " if (password.length >= 8) score -= 20;", + " if (password.length >= 12) score -= 20;", + "", + " if (/[a-z]/.test(password)) score -= 15;", + " if (/[A-Z]/.test(password)) score -= 15;", + " if (/[0-9]/.test(password)) score -= 15;", + " if (/[^A-Za-z0-9]/.test(password)) score -= 15;", + "", + " if (score < 0) score = 0;", + " if (score > 100) score = 100;", + "", + " eventsFunctionContext.returnValue = score;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Text / Password", + "name": "Password", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Generates Random Strings, like (72hh*@#h72+xjza).", + "fullName": "Random String Generator", + "functionType": "StringExpression", + "name": "RandomStringGenerator", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const length =", + " Number(eventsFunctionContext.getArgument(\"Length\")) || 16;", + "", + " const chars =", + " \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=[]{}|;:',.<>?/`~\";", + "", + " let result = \"\";", + "", + " for (let i = 0; i < length; i++) {", + "", + " const index =", + " Math.floor(Math.random() * chars.length);", + "", + " result += chars[index];", + " }", + "", + " eventsFunctionContext.returnValue = result;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Length", + "name": "Length", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Generates Names For Players, Like (ShadowMan, DarkDuck, EpicPanda).", + "fullName": "Random Nickname Generator", + "functionType": "StringExpression", + "name": "Function2", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const first = [", + " \"Shadow\",", + " \"Pixel\",", + " \"Turbo\",", + " \"Dark\",", + " \"Blue\",", + " \"Fire\",", + " \"Epic\",", + " \"Mr\",", + " \"Dr\",", + " \"Sir\",", + " \"Master\",", + " \"Not\",", + " \"Its\",", + " \"Man\",", + " \"Girly\",", + " \"Old\",", + " \"Dusty\",", + " \"Tehno\",", + " \"Saint\",", + " \"Fred\"", + " ];", + "", + " const second = [", + " \"Fox\",", + " \"Ninja\",", + " \"Duck\",", + " \"Dragon\",", + " \"Tiger\",", + " \"Panda\",", + " \"Ghost\",", + " \"Crox\",", + " \"Kitty\",", + " \"Bannana\",", + " \"Coconut\",", + " \"Apple\",", + " \"Donut\",", + " \"Jake\",", + " \"Maria\",", + " \"Zoro\",", + " \"Detract\",", + " \"Mystery\",", + " \"Boy\",", + " \"Man\",", + " \"Wolfie\",", + " \"Glory\",", + " \"Christian\",", + " \"Adam\",", + " \"Maxiz\",", + " \"Unit\",", + " \"Tyan\",", + " \"Tommy\",", + " \"John\",", + " \"Kennedy\",", + " \"Chick\",", + " \"Edison\",", + " \"Forge\",", + " \"Victoria\",", + " \"Victor\",", + " \"Terminator\",", + " \"Galli\",", + " \"Farax\",", + " \"Eliah\",", + " \"Filx\",", + " \"Kratos\",", + " \"Quantom\",", + " \"Sammy\",", + " \"Pizza\",", + " \"Ryan\",", + " \"Truth\",", + " \"Polar\",", + " \"Simon\",", + " \"Jake\",", + " \"Lollipop\",", + " \"Zoot\",", + " \"Mushroom\",", + " \"Gerald\",", + " \"Rudy\",", + " \"Speed\",", + " \"Space\",", + " \"Star\",", + " \"Nature\",", + " \"Amused\",", + " \"Tesla\",", + " \"Shark\",", + " \"Sandra\"", + " ];", + "", + " const a =", + " first[Math.floor(Math.random() * first.length)];", + "", + " const b =", + " second[Math.floor(Math.random() * second.length)];", + "", + " const num =", + " Math.floor(Math.random() * 999);", + "", + " eventsFunctionContext.returnValue =", + " a + b + num;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Word Count In Sentence (Hello There) - 2 Words.", + "fullName": "Word Count In Sentence", + "functionType": "Expression", + "name": "Function3", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const text =", + " eventsFunctionContext.getArgument(\"Text\") || \"\";", + "", + " const words =", + " text.trim().split(/\\s+/)", + " .filter(w => w.length > 0);", + "", + " eventsFunctionContext.returnValue =", + " words.length;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Text", + "name": "Text", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Gets everything on that line.", + "fullName": "Get Line From Text", + "functionType": "StringExpression", + "name": "Function4", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const text =", + " eventsFunctionContext.getArgument(\"Text\") || \"\";", + "", + " const lineNumber =", + " Number(eventsFunctionContext.getArgument(\"Line\")) || 1;", + "", + " const lines =", + " text.split(/\\r?\\n/);", + "", + " const index = lineNumber - 1;", + "", + " let result = \"\";", + "", + " if (index >= 0 && index < lines.length) {", + " result = lines[index];", + " }", + "", + " eventsFunctionContext.returnValue = result;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Text", + "name": "Text", + "type": "string" + }, + { + "description": "Line (1,2,3...)", + "name": "Line", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Normalises Misspelled Text (Hella → Hello).", + "fullName": "Normalise Misspelled Text", + "functionType": "StringExpression", + "name": "Function5", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const text =", + " eventsFunctionContext.getArgument(\"Text\") || \"\";", + "", + " const dictRaw =", + " eventsFunctionContext.getArgument(\"Dictionary\") || \"\";", + "", + " const dict =", + " dictRaw", + " .toString()", + " .replace(/\\u00A0/g, \" \")", + " .replace(/\\r/g, \" \")", + " .trim()", + " .split(/\\s+/)", + " .filter(w => w.length > 0);", + "", + " function clean(w) {", + " return (w || \"\")", + " .toString()", + " .toLowerCase()", + " .replace(/[^a-z0-9]/g, \"\");", + " }", + "", + " function levenshtein(a, b) {", + " const dp = [];", + "", + " for (let i = 0; i <= b.length; i++) dp[i] = [i];", + " for (let j = 0; j <= a.length; j++) dp[0][j] = j;", + "", + " for (let i = 1; i <= b.length; i++) {", + " for (let j = 1; j <= a.length; j++) {", + "", + " const cost = a[j - 1] === b[i - 1] ? 0 : 1;", + "", + " dp[i][j] = Math.min(", + " dp[i - 1][j] + 1,", + " dp[i][j - 1] + 1,", + " dp[i - 1][j - 1] + cost", + " );", + " }", + " }", + "", + " return dp[b.length][a.length];", + " }", + "", + " function similarity(a, b) {", + " const maxLen = Math.max(a.length, b.length) || 1;", + " return 1 - levenshtein(a, b) / maxLen;", + " }", + "", + " function findBest(wordRaw) {", + "", + " const word = clean(wordRaw);", + "", + " if (!word) return wordRaw;", + "", + " let best = wordRaw;", + " let bestScore = 0;", + "", + " for (let i = 0; i < dict.length; i++) {", + "", + " const candidate = clean(dict[i]);", + " const score = similarity(word, candidate);", + "", + " if (score > bestScore) {", + " bestScore = score;", + " best = dict[i];", + " }", + " }", + "", + " if (bestScore >= 0.35) return best;", + "", + " return wordRaw;", + " }", + "", + " const words =", + " text.split(/\\s+/).filter(w => w.length > 0);", + "", + " let result = [];", + "", + " for (let i = 0; i < words.length; i++) {", + " result.push(findBest(words[i]));", + " }", + "", + " eventsFunctionContext.returnValue = result.join(\" \");" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Text", + "name": "Text", + "type": "string" + }, + { + "description": "Dictionary", + "name": "Dictionary", + "type": "variable" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "Text_Similarity_Comparison" + }, + { + "functionName": "Word_Detection" + }, + { + "functionName": "Function" + }, + { + "functionName": "ReplaceWordInText" + }, + { + "functionName": "PasswordCrackableTime" + }, + { + "functionName": "RandomStringGenerator" + }, + { + "functionName": "Function2" + }, + { + "functionName": "Function3" + }, + { + "functionName": "Function4" + }, + { + "functionName": "Function5" + } + ] + }, + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] +}