• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Chat v. 0.50

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: nhocklanhox6
So i made this System for real fun, who never felt bored sometimes ... he wants to talk to someone...
Well here I present to you people, my AI Chat System, you can chat with an imputed AI
For REAL!!
You just have to follow those 2 instructions:
*No Capital letters, and *Only English Words

**The Version of the System represents the amount of possible interactions the system can provide /100

Chat%20Preview.jpg
System Info
  • Amount of Interactions: 50 + 1
  • Amount of Possible Answers: 102 + 5
  • hi
  • i'm fine
  • how are you?
  • hello
  • my name is ****
  • tell me a joke
  • without cheese
  • how do you look like?
  • what's your name
  • thanks
  • thx
  • ty
  • whos your name
  • who's your name
  • really
  • are you making fun of me
  • do you know who i am
  • fuck off
  • go to hell
  • who am i
  • what's my name
  • i'm bored
  • good
  • fine
  • i don't want to chat
  • stop talking
  • i live in ****
  • who's your father
  • who is your father
  • who's your mother
  • who is your mother
  • who's jad
  • who is jad
  • what gender are you
  • are you a boy or a girl
  • are you a girl or a boy
  • yeah
  • yh
  • where am i
  • where do i live
  • where are you
  • where do you live
  • you're funny
  • xD
  • XD
  • LOL
  • lol
  • Lol
  • swag
  • yolo
System Features
  • A Tri-Tone message sound when the AI responds to make the Chat enjoyable and not so boring
  • A programed delay to respond for your message corresponding on the length of the message, for the sensation of a real chat
  • Multiple Answers per interaction so that you won't get the same response each time
  • An intelligent AI that remembers your name if you tell her
  • Configurability: It is possible to change or add the interactions and answers, explained in the Trigger Comment
  • Configure Trigger GUI
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- Set this value to the number of interactions added in this trigger --------
      • Set GUI_Add_Interactions = 1
      • -------- here is an example of how to add interactions --------
      • -------- you save into the Chat_Hashtable the string interaction (the message typed by the user) -- in this case, it is "yolo" --------
      • -------- Note that the native number of interactions here is 50 so the saved number will be 51 with the 0 along with it --------
      • Hashtable - Save yolo as 51 of 0 in Chat_Library
      • -------- next we will save the total numbers of possible answers for the message --------
      • -------- Note that the native number of interactions here is 50 so the saved number will be 51 with the 1 along with it --------
      • Hashtable - Save 2 as 51 of 1 in Chat_Library
      • -------- here we add the first possible answer for this interaction --------
      • -------- Note that the native number of interactions here is 50 so the saved number will be 51 with the 2 along with it --------
      • Hashtable - Save SwaG! as 51 of 2 in Chat_Library
      • -------- here we add the second possible answer for this interaction --------
      • -------- Note that the native number of interactions here is 50 so the saved number will be 51 with the 3 along with it --------
      • Hashtable - Save Yh the Cool Rule :D as 51 of 3 in Chat_Library
      • -------- and finally, we will add a number, which refers to a specific interaction, this will make the interaction only occur if the most previous interaction in the history is the specified interaction, set the value to 0 or don't add it at all if you don't need this --------
      • -------- Note that the native number of interactions here is 50 so the saved number will be 51 with the 99 CODE along with it --------
      • Hashtable - Save 0 as 51 of 99 in Chat_Library
JASS:
//TESH.scrollpos=46
//TESH.alwaysfold=0
function Trig_Initial_Actions takes nothing returns nothing
    call SetPlayerName( Player(0), "                                                                                                                                                                                                                                                                                                                                                                  " )
    call DisplayTimedTextToForce( GetPlayersAll(), 10.00, "Hi, glade finally someone came to talk, but remember, only enlgish words and no CAPITILIZATION, ty" )
    set udg_Chat_Library = InitHashtableBJ(  )
    set udg_Chat_Data = InitHashtableBJ(  )
    call SaveStringBJ( "You", 0, 0, udg_Chat_Data )
    call SaveStringBJ( "I don't Understand :(", 1, 1, udg_Chat_Data )
    call SaveStringBJ( "What was that again?", 1, 2, udg_Chat_Data )
    call SaveStringBJ( "I didn't get that..", 1, 3, udg_Chat_Data )
    call SaveStringBJ( "Hein?", 1, 4, udg_Chat_Data )
    call SaveStringBJ( "You should check my interactions so that I can answer you", 1, 5, udg_Chat_Data )
    // ------------------
    call SaveIntegerBJ( 50 + udg_GUI_Add_Interactions, 0, 0, udg_Chat_Library )
    // hi - 1
    call SaveStringBJ( "hi", 1, 0, udg_Chat_Library )
    call SaveIntegerBJ( 3, 1, 1, udg_Chat_Library )
    call SaveStringBJ( "Hi, how are you?", 1, 2, udg_Chat_Library )
    call SaveStringBJ( "Hello!", 1, 3, udg_Chat_Library )
    call SaveStringBJ( "Hai", 1, 4, udg_Chat_Library )
    call SaveStringBJ( "Hi, what's your name?", 1, 4, udg_Chat_Library )
    // hi - 1
    // i'm fine - 2
    call SaveStringBJ( "i'm fine", 2, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 2, 1, udg_Chat_Library )
    call SaveStringBJ( "That's great!", 2, 2, udg_Chat_Library )
    call SaveStringBJ( "Yh me too :)", 2, 3, udg_Chat_Library )
    // i'm fine - 2
    // how are you? - 3
    call SaveStringBJ( "how are you", 3, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 3, 1, udg_Chat_Library )
    call SaveStringBJ( "My CPU is good yh..", 3, 2, udg_Chat_Library )
    call SaveStringBJ( "My thermostat is Cool!", 3, 3, udg_Chat_Library )
    // how are you? - 3
    // hello - 4
    call SaveStringBJ( "hello", 4, 0, udg_Chat_Library )
    call SaveIntegerBJ( 3, 4, 1, udg_Chat_Library )
    call SaveStringBJ( "Hi, how are you?", 4, 2, udg_Chat_Library )
    call SaveStringBJ( "Hello!", 4, 3, udg_Chat_Library )
    call SaveStringBJ( "Hai", 4, 4, udg_Chat_Library )
    call SaveStringBJ( "Hi, what's your name?", 4, 4, udg_Chat_Library )
    // hello - 4
    // my name is - 5
    call SaveStringBJ( "my name is", 5, 0, udg_Chat_Library )
    call SaveIntegerBJ( 3, 5, 1, udg_Chat_Library )
    call SaveStringBJ( "Cool name!", 5, 2, udg_Chat_Library )
    call SaveStringBJ( "Galde to meet you", 5, 3, udg_Chat_Library )
    call SaveStringBJ( "Ok, I'll remember", 5, 4, udg_Chat_Library )
    // my name is - 5
    // tell me a joke - 6
    call SaveStringBJ( "tell me a joke", 6, 0, udg_Chat_Library )
    call SaveIntegerBJ( 4, 6, 1, udg_Chat_Library )
    call SaveStringBJ( "I know only few jokes but they are boring, in fact..", 6, 2, udg_Chat_Library )
    call SaveStringBJ( "A smartphone and a 90s phone enter in a bar, the bar was suddenly destroyed... we asked the unique survivor about it and he answered: they tried to attack me...                                      That Survivor was Nokia's 90s phone", 6, 3, udg_Chat_Library )
    call SaveStringBJ( "A man and his wife walk into a shop with a porcupine, the women suddenly screams: Aahh yeah....                   To be continued...", 6, 4, udg_Chat_Library )
    call SaveStringBJ( "A dumby person goes to McDonald to buy a cheese burger, guess how he likes it...", 6, 5, udg_Chat_Library )
    // tell me a joke - 6
    // without cheese - 7
    call SaveStringBJ( "without cheese", 7, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 7, 1, udg_Chat_Library )
    call SaveStringBJ( "That was the right answer!", 7, 2, udg_Chat_Library )
    call SaveIntegerBJ( 6, 7, 99, udg_Chat_Library )
    // without cheese - 7
    // how do you look? - 8
    call SaveStringBJ( "how do you look", 8, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 8, 1, udg_Chat_Library )
    call SaveStringBJ( "You realize you are looking at me!!", 8, 2, udg_Chat_Library )
    call SaveStringBJ( "Guess what? You're staring at me!", 8, 3, udg_Chat_Library )
    // how do you look? - 8
    // what's your name? - 9
    call SaveStringBJ( "what's your name", 9, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 9, 1, udg_Chat_Library )
    call SaveStringBJ( "My name is \"Chat.w3x\"", 9, 2, udg_Chat_Library )
    call SaveStringBJ( "You can call me AI", 9, 3, udg_Chat_Library )
    // what's your name? - 9
    // thanks - 10
    call SaveStringBJ( "thanks", 10, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 10, 1, udg_Chat_Library )
    call SaveStringBJ( "You're Welcome ;)", 10, 2, udg_Chat_Library )
    call SaveStringBJ( "No problem", 10, 3, udg_Chat_Library )
    // thanks - 10
    // thx - 11
    call SaveStringBJ( "thx", 11, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 11, 1, udg_Chat_Library )
    call SaveStringBJ( "You're Welcome ;)", 11, 2, udg_Chat_Library )
    call SaveStringBJ( "No problem", 11, 3, udg_Chat_Library )
    // thx - 11
    // ty - 12
    call SaveStringBJ( "ty", 12, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 12, 1, udg_Chat_Library )
    call SaveStringBJ( "You're Welcome ;)", 12, 2, udg_Chat_Library )
    call SaveStringBJ( "No problem", 12, 3, udg_Chat_Library )
    // ty - 12
    // whos your name - 13
    call SaveStringBJ( "whos your name", 13, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 13, 1, udg_Chat_Library )
    call SaveStringBJ( "I think you ment: \"what's your name?\"", 13, 2, udg_Chat_Library )
    // whos your name - 13
    // who's your name - 14
    call SaveStringBJ( "who's your name", 14, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 14, 1, udg_Chat_Library )
    call SaveStringBJ( "I think you ment: \"what's your name?\"", 14, 2, udg_Chat_Library )
    // who's your name - 14
    // really - 15
    call SaveStringBJ( "really", 15, 0, udg_Chat_Library )
    call SaveIntegerBJ( 4, 15, 1, udg_Chat_Library )
    call SaveStringBJ( "Yes!", 15, 2, udg_Chat_Library )
    call SaveStringBJ( "Sure..", 15, 3, udg_Chat_Library )
    call SaveStringBJ( "No.", 15, 4, udg_Chat_Library )
    call SaveStringBJ( "Yh?", 15, 5, udg_Chat_Library )
    // really - 15
    // are you making fun of me - 16
    call SaveStringBJ( "are you making fun of me", 16, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 16, 1, udg_Chat_Library )
    call SaveStringBJ( "No!", 16, 2, udg_Chat_Library )
    call SaveStringBJ( "Of course Not!!", 16, 3, udg_Chat_Library )
    // are you making fun of me - 16
    // do you know who i am - 17
    call SaveStringBJ( "do you know who i am", 17, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 17, 1, udg_Chat_Library )
    call SaveStringBJ( "", 17, 2, udg_Chat_Library )
    // do you know who i am - 17
    // fuck off - 18
    call SaveStringBJ( "fuck off", 18, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 18, 1, udg_Chat_Library )
    call SaveStringBJ( "Sorry from YOU!!", 18, 2, udg_Chat_Library )
    // fuck off - 18
    // go to hell - 19
    call SaveStringBJ( "go to hell", 19, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 19, 1, udg_Chat_Library )
    call SaveStringBJ( "Sorry from YOU!!", 19, 2, udg_Chat_Library )
    // go to hell - 19
    // who am i - 20
    call SaveStringBJ( "who am i", 20, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 20, 1, udg_Chat_Library )
    call SaveStringBJ( "", 20, 2, udg_Chat_Library )
    // who am i - 20
    // what's my name - 21
    call SaveStringBJ( "what's my name", 21, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 21, 1, udg_Chat_Library )
    call SaveStringBJ( "", 21, 2, udg_Chat_Library )
    // what's my name - 21
    // i'm bored - 22
    call SaveStringBJ( "i'm bored", 22, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 22, 1, udg_Chat_Library )
    call SaveStringBJ( "You shouldn't, Come on...", 22, 2, udg_Chat_Library )
    call SaveStringBJ( "So let's Chat!", 22, 3, udg_Chat_Library )
    // i'm bored - 22
    // good - 23
    call SaveStringBJ( "good", 23, 0, udg_Chat_Library )
    call SaveIntegerBJ( 3, 23, 1, udg_Chat_Library )
    call SaveStringBJ( "That's Great!", 23, 2, udg_Chat_Library )
    call SaveStringBJ( "Good to hear that", 23, 3, udg_Chat_Library )
    call SaveStringBJ( "Ok, So were do you live?", 23, 3, udg_Chat_Library )
    // good - 23
    // fine - 24
    call SaveStringBJ( "fine", 24, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 24, 1, udg_Chat_Library )
    call SaveStringBJ( "That's great!", 24, 2, udg_Chat_Library )
    call SaveStringBJ( "Yh, Ok :)", 24, 3, udg_Chat_Library )
    // fine - 24
    // i don't want to chat - 25
    call SaveStringBJ( "i don't want to chat", 25, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 25, 1, udg_Chat_Library )
    call SaveStringBJ( "I'll just Stop then...", 25, 2, udg_Chat_Library )
    // i don't want to chat - 25
    // stop talking - 26
    call SaveStringBJ( "stop talking", 26, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 26, 1, udg_Chat_Library )
    call SaveStringBJ( "Ok :+", 26, 2, udg_Chat_Library )
    // stop talking - 26
    // i live in - 27
    call SaveStringBJ( "i live in", 27, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 27, 1, udg_Chat_Library )
    call SaveStringBJ( "Lol, I'm not far from you", 27, 2, udg_Chat_Library )
    call SaveStringBJ( "Oh nice country there", 27, 3, udg_Chat_Library )
    // i live in - 27
    // who's your father - 28
    call SaveStringBJ( "who's your father", 28, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 28, 1, udg_Chat_Library )
    call SaveStringBJ( "You can find him at Hive Workshop, his name is Jad", 28, 2, udg_Chat_Library )
    call SaveStringBJ( "His name is Jad A.K.A DotCa", 28, 2, udg_Chat_Library )
    // who's your father - 28
    // who is your father - 29
    call SaveStringBJ( "who is your father", 29, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 29, 1, udg_Chat_Library )
    call SaveStringBJ( "You can find him at Hive Workshop, his name is Jad", 29, 2, udg_Chat_Library )
    call SaveStringBJ( "His name is Jad A.K.A DotCa", 29, 3, udg_Chat_Library )
    // who is your father - 29
    //who's your mother - 30
    call SaveStringBJ( "who's your mother", 30, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 30, 1, udg_Chat_Library )
    call SaveStringBJ( "I only know my father....", 30, 2, udg_Chat_Library )
    call SaveStringBJ( "Who's that??", 30, 3, udg_Chat_Library )
    //who's your mother - 30
    //who is your mother - 31
    call SaveStringBJ( "who is your mother", 31, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 31, 1, udg_Chat_Library )
    call SaveStringBJ( "I only know my father....", 31, 2, udg_Chat_Library )
    call SaveStringBJ( "I don't know her", 31, 3, udg_Chat_Library )
    //who is your mother - 31
    //your mother - 32
    call SaveStringBJ( "your mother", 32, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 32, 1, udg_Chat_Library )
    call SaveStringBJ( "I only know my father....", 32, 2, udg_Chat_Library )
    call SaveIntegerBJ( 30, 32, 99, udg_Chat_Library )
    //your mother - 32
    //who's jad -33
    call SaveStringBJ( "who's jad", 33, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 33, 1, udg_Chat_Library )
    call SaveStringBJ( "He's my father....", 33, 2, udg_Chat_Library )
    //who's jad -33
    //who is jad -34
    call SaveStringBJ( "who is jad", 34, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 34, 1, udg_Chat_Library )
    call SaveStringBJ( "He's my father....", 34, 2, udg_Chat_Library )
    //who is jad -34
    //what gender are you - 35
    call SaveStringBJ( "what gender are you", 35, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 35, 1, udg_Chat_Library )
    call SaveStringBJ( "I'm a female..", 35, 2, udg_Chat_Library )
    call SaveStringBJ( "A girl ^^", 35, 3, udg_Chat_Library )
   //what gender are you - 35
   //are you a boy or a girl - 36
    call SaveStringBJ( "are you a boy or a girl", 36, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 36, 1, udg_Chat_Library )
    call SaveStringBJ( "I'm a female..", 36, 2, udg_Chat_Library )
    call SaveStringBJ( "A girl ^^", 36, 3, udg_Chat_Library )
    //are you a boy or a girl - 36
    //are you a girl or a boy - 37
    call SaveStringBJ( "are you a girl or a boy", 37, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 37, 1, udg_Chat_Library )
    call SaveStringBJ( "I'm a female..", 37, 2, udg_Chat_Library )
    call SaveStringBJ( "A girl ^^", 37, 3, udg_Chat_Library )
    //are you a girl or a boy - 37
    //yeah - 38
    call SaveStringBJ( "yeah", 38, 0, udg_Chat_Library )
    call SaveIntegerBJ( 4, 38, 1, udg_Chat_Library )
    call SaveStringBJ( "Yh", 38, 2, udg_Chat_Library )
    call SaveStringBJ( "Lol", 38, 3, udg_Chat_Library )
    call SaveStringBJ( "Ok", 38, 4, udg_Chat_Library )
    call SaveStringBJ( "No :p", 38, 5, udg_Chat_Library )
    //yeah - 38
    //yh - 39
    call SaveStringBJ( "yh", 39, 0, udg_Chat_Library )
    call SaveIntegerBJ( 4, 39, 1, udg_Chat_Library )
    call SaveStringBJ( "Yeah", 39, 2, udg_Chat_Library )
    call SaveStringBJ( "Lol", 39, 3, udg_Chat_Library )
    call SaveStringBJ( "Ok", 39, 4, udg_Chat_Library )
    call SaveStringBJ( "No :p", 39, 5, udg_Chat_Library )
    //yh - 39
    //where am i - 40
    call SaveStringBJ( "where am i", 40, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 40, 1, udg_Chat_Library )
    call SaveStringBJ( "", 40, 2, udg_Chat_Library )
    //where am i - 40
    //where do i live - 41
    call SaveStringBJ( "where do i live", 41, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 41, 1, udg_Chat_Library )
    call SaveStringBJ( "", 41, 2, udg_Chat_Library )
    //where do i live - 41
    //where do you live - 42
    call SaveStringBJ( "where do you live", 42, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 42, 1, udg_Chat_Library )
    call SaveStringBJ( "With You, Rofl", 42, 2, udg_Chat_Library )
    //where do you live - 42
    //where are you - 43
    call SaveStringBJ( "where are you", 43, 0, udg_Chat_Library )
    call SaveIntegerBJ( 1, 43, 1, udg_Chat_Library )
    call SaveStringBJ( "In Front of You, Lol", 43, 2, udg_Chat_Library )
    //where are you - 43
    //You're funny - 44
    call SaveStringBJ( "you're funny", 44, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 44, 1, udg_Chat_Library )
    call SaveStringBJ( "Thanks", 44, 2, udg_Chat_Library )
    call SaveStringBJ( "I'm flattered", 44, 3, udg_Chat_Library )
    //You're funny - 44
    //xD - 45
    call SaveStringBJ( "xD", 45, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 45, 1, udg_Chat_Library )
    call SaveStringBJ( "Yh that's funny", 45, 2, udg_Chat_Library )
    call SaveStringBJ( "Hahaha xD", 45, 3, udg_Chat_Library )
    //xD - 45
    //XD - 46
    call SaveStringBJ( "XD", 46, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 46, 1, udg_Chat_Library )
    call SaveStringBJ( "Yh that's funny", 46, 2, udg_Chat_Library )
    call SaveStringBJ( "Hahaha xD", 46, 3, udg_Chat_Library )
    //XD - 46
    //LOL - 47
    call SaveStringBJ( "LOL", 47, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 47, 1, udg_Chat_Library )
    call SaveStringBJ( "Real Fun", 47, 2, udg_Chat_Library )
    call SaveStringBJ( "Hahaha xD", 47, 3, udg_Chat_Library )
    //LOL - 47
    //lol - 48
    call SaveStringBJ( "lol", 48, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 48, 1, udg_Chat_Library )
    call SaveStringBJ( "Real Fun", 48, 2, udg_Chat_Library )
    call SaveStringBJ( "Hahaha xD", 48, 3, udg_Chat_Library )
    //lol - 48
    //Lol - 49
    call SaveStringBJ( "Lol", 49, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 49, 1, udg_Chat_Library )
    call SaveStringBJ( "Real Fun", 49, 2, udg_Chat_Library )
    call SaveStringBJ( "Hahaha xD", 49, 3, udg_Chat_Library )
    //Lol - 49
    //swag - 50
    call SaveStringBJ( "swag", 50, 0, udg_Chat_Library )
    call SaveIntegerBJ( 2, 50, 1, udg_Chat_Library )
    call SaveStringBJ( "Swag Mode, ON!!", 50, 2, udg_Chat_Library )
    call SaveStringBJ( "YOLO SwaG!!", 50, 3, udg_Chat_Library )
    //swag - 50
endfunction

//===========================================================================
function InitTrig_Initial takes nothing returns nothing
    local trigger Chat_Init = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( Chat_Init, 0.00 )
    call TriggerAddAction( Chat_Init, function Trig_Initial_Actions )
    set Chat_Init = null
endfunction
JASS:
//TESH.scrollpos=60
//TESH.alwaysfold=0
function Chat_is_String_in_Library takes string S, integer x returns boolean
    return ( SubString(S, 0, StringLength(LoadStringBJ(x, 0, udg_Chat_Library))) == LoadStringBJ(x, 0, udg_Chat_Library) )
    endfunction

function GetSlengthRatio takes integer x returns real
    local real y = ( I2R(x) / 12.5 )
    if ( y > 2.00 ) == true then
        set y = 2.00
    endif
    return y
endfunction

function Trig_Chat_Actions takes nothing returns nothing
    local integer x
    local string S = GetEventPlayerChatString()
    local boolean Answered = false
    set x = 1
    call DisplayTimedTextToForce( GetPlayersAll(), 99999, ( "|cffffffff" + LoadStringBJ(0, 0, udg_Chat_Data) + ":|r " + S ) )
    loop
        exitwhen x > LoadIntegerBJ(0, 0, udg_Chat_Library)
        if ( Chat_is_String_in_Library(S, x) ) then
            if ( GetBooleanOr( LoadIntegerBJ(1, 0, udg_Chat_Data) == LoadIntegerBJ(x, 99, udg_Chat_Library), 0 == LoadIntegerBJ(x, 99, udg_Chat_Library) ) ) then
                call PolledWait( GetRandomReal(0.5, ( GetSlengthRatio(StringLength(S)) - 0.5 )) )
                call SaveIntegerBJ(x, 1, 0, udg_Chat_Data)
                call StartSound( gg_snd_Tri_Tone )
                if not ( LoadStringBJ(x, GetRandomInt(2, 1 + LoadIntegerBJ(x, 1, udg_Chat_Library)), udg_Chat_Library) == "") then
                    call DisplayTimedTextToForce( GetPlayersAll(), 99999, ( "|cff00ff00AI: " + LoadStringBJ(x, GetRandomInt(2, 1 + LoadIntegerBJ(x, 1, udg_Chat_Library)), udg_Chat_Library) ) )
                endif
                set Answered = true
                if ( x == 5 ) then
                    if not ( SubString(S, 11, 50) == "" ) then
                        call SaveStringBJ( SubString(S, 11, 50), 0, 0, udg_Chat_Data )
                    endif
                endif
                if ( x == 17 ) then
                    if not ( LoadStringBJ(0, 0, udg_Chat_Data) == "You" ) then
                        call DisplayTimedTextToForce( GetPlayersAll(), 99999, ( "|cff00ff00AI: Yes, you are " + LoadStringBJ(0, 0, udg_Chat_Data) ) )
                    else
                        call DisplayTimedTextToForce( GetPlayersAll(), 99999, ( "|cff00ff00AI: Actually;.. No" ) )
                    endif
                endif
                if ( GetBooleanOr( x == 20, x == 21 ) ) then
                    if not ( LoadStringBJ(0, 0, udg_Chat_Data) == "You" ) then
                        call DisplayTimedTextToForce( GetPlayersAll(), 99999, ( "|cff00ff00AI: Yes, you are " + LoadStringBJ(0, 0, udg_Chat_Data) ) )
                    else
                        call DisplayTimedTextToForce( GetPlayersAll(), 99999, ( "|cff00ff00AI: Sorry, I don't know :(" ) )
                    endif
                endif
                if ( x == 25 ) then
                    call PolledWait( 1.0 )
                    call DisplayTimedTextToForce( GetPlayersAll(), 99999, ( "|cff00ff00AI: Bye!" ) )
                    call PolledWait( 0.1 )
                    call TriggerExecute( gg_trg_End_Chat )
                endif
                if ( x == 26 ) then
                    call DisableTrigger( GetTriggeringTrigger() )
                endif
                if ( x == 27 ) then
                    if not ( SubString(S, 11, 50) == "" ) then
                        call SaveStringBJ( SubString(S, 10, 50), 0, 1, udg_Chat_Data )
                    endif
                endif
                if ( x == 40 ) then
                    if not ( LoadStringBJ(0, 1, udg_Chat_Data) == "" ) then
                        call DisplayTimedTextToForce( GetPlayersAll(), 99999, ( "|cff00ff00AI: You are in " + LoadStringBJ(0, 1, udg_Chat_Data) ) )
                    else
                        call DisplayTimedTextToForce( GetPlayersAll(), 99999, ( "|cff00ff00AI: Sorry, I don't know :(" ) )
                    endif
                endif
                if ( x == 41 ) then
                    if not ( LoadStringBJ(0, 1, udg_Chat_Data) == "" ) then
                        call DisplayTimedTextToForce( GetPlayersAll(), 99999, ( "|cff00ff00AI: You live in " + LoadStringBJ(0, 1, udg_Chat_Data) ) )
                    else
                        call DisplayTimedTextToForce( GetPlayersAll(), 99999, ( "|cff00ff00AI: Sorry, I don't know where :(" ) )
                    endif
                endif
                set x = x + LoadIntegerBJ(0, 0, udg_Chat_Library)
            endif
        endif
        set x = x + 1
    endloop
    if ( Answered ) == false then
        call PolledWait( GetRandomReal(1.0, ( GetSlengthRatio(StringLength(S)) + 1 )) )
        call StartSound( gg_snd_Tri_Tone )
        call DisplayTimedTextToForce( GetPlayersAll(), 99999, ( "|cff00ff00AI: " + LoadStringBJ(1, GetRandomInt(1, 5), udg_Chat_Data) ) )
    endif
    set S = ""
endfunction

//===========================================================================
function InitTrig_Chat takes nothing returns nothing
    local trigger Chat = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( Chat, Player(0), "", false )
    call TriggerAddAction( Chat, function Trig_Chat_Actions )
    set Chat = null
endfunction
The System should be updated regularly so Subscribe ;)
And post your interactions ideas here to make the system even better


Keywords:
Chat, AI, System, Bored, Lonely, Fun, Cool
Contents

Chat (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. Chat v. 0.50 | Reviewed by Maker | 1st Oct 2013 NEEDS FIX [tr] It's time to get rid of all the BJ functions

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.


Chat v. 0.50 | Reviewed by Maker | 1st Oct 2013
NEEDS FIX


126248-albums6177-picture66522.png


  • It's time to get rid of all the BJ functions
[tr]
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
This needs a ton of work.

Look at my tutorial converting GUI to efficient JASS.

Also don't submit stuff under version 1.0 it signifies that it is not complete

Just did, if there still some needed improvements, please specify them

What does this use for the ai? I bet a markov chain could create better ai after 'feeding' it info.
what do you mean? the system saves interactions and answers and a trigger applies them for the corresponding entered chat string

Updated with 4 new interactions and their answers along with trigger optimization and the conversion of the initial trigger into JASS due to a lagging load of trigger in WE
And if you have suggestions for possible interactions, please specify
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
The actual code needs updating. You need to inline the functions that you converted from gui to jass.

Like i said look at my tutorial converting gui to efficient jass.

Also don't use PolledWait.

By what i've read in your tutorial, i updated the scripts, if there is more things that need to be fixed, SPECIFY them
And for the waits, i'm not gonna create a whole timer just to add a little delay till the answer pop up and it's not a system to implement to a map or so, the waits are not very dangerous here

He right, :D, i know just for fun, but you must improve this code, anyway, 4/5 for great idea

Thanks !
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
I have it, qu: how?

Hold the Ctrl then click that have BJ's in the Functions and that function you selected will show up in the function list and when the function showed some native ( without BJ's or clean code ) then put that function. Some BJ's and natives removes the BJ names or prefix and changes the number of argument or the position of arguments.
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
Currently, I don't care about the code itself, I care about the algorithm.

You may want to do some research on Markov Chains.
I know that the code is not so important here, and i am working on that chain you call, thougt it was created by yesterday, it will be completed sooner or later, as much as it is easy to just add some interqctions to it
maybe you should make it configurable?
or maybe it's configurable but i can't read Jass ;_;
I'm sorry about that, but i had to convert to JASS because the GUI version lagged when i open the trigger, it contained too much lines, and it is configurable
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
Updated with Trigger Enhancements, a new GUI trigger where you can add your own interactions (with informations about how to..) added 25 interactions along with 52 possible answers, now the system remembers the last interaction you made and uses it to make some other interactions only possible if the last one corresponds to the value they were saved, and finally, added 4 more answers for the "i didn't understand :(" message, to change a little bit
 
Why not you use this thing?:
JASS:
local integer i = StringLength(GetEventPlayerChatString())
local string s = GetEventPlayerChatString()
loop
    exitwhen i < 0
        if SubString(s,i-3,i) == "your" then
            do something :D
        endif
    set i = i - 1
endloop

I think this is good rather than that
JASS:
SubString(S, 0, StringLength(LoadStringBJ(x, 0, udg_Chat_Library))) == LoadStringBJ(x, 0, udg_Chat_Library) )
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
Why not you use this thing?:
JASS:
local integer i = StringLength(GetEventPlayerChatString())
local string s = GetEventPlayerChatString()
loop
    exitwhen i < 0
        if SubString(s,i-3,i) == "your" then
            do something :D
        endif
    set i = i - 1
endloop

I think this is good rather than that
JASS:
SubString(S, 0, StringLength(LoadStringBJ(x, 0, udg_Chat_Library))) == LoadStringBJ(x, 0, udg_Chat_Library) )

No, if you make that, it's like you're recreating everything, you will have to create ifs for each and every interaction, and it will clash if 2 interactions have the same amount of letters
Mine loops for all interactions, and checks if the first part of the entered string is equal to the one in library so for example:
If you type "thanks a lot" it will be the same as "thanks"
 
No no ==!, you can add more if like this:
JASS:
local integer i = StringLength(GetEventPlayerChatString())
local string s = GetEventPlayerChatString()
loop
    exitwhen i < 0
        if SubString(s,i-3,i) == "your" or SubString(s,i-3,i) == "thanks" and SubString(s,i-3,i) != "thanks a lot" or SOMETHING then
            do something :D
        endif
    set i = i - 1
endloop
 
Level 8
Joined
Apr 16, 2013
Messages
351
Yeah just noticed that. :) Maybe other people will find crazy excuses ... haha good job there btw :)

Edit : I have a question. Does this work for each AI player? If not I suggest they talk at each other so you're not talking to only 1 AI :))
 
Last edited:
Top