"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[9233],{8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>l});var n=s(6540);const a={},r=n.createContext(a);function i(e){const t=n.useContext(r);return n.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),n.createElement(r.Provider,{value:t},e.children)}},9993:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"XXTLanControl.lua/assist/ask_text","title":"Request a Text Reply (LCC.assist.ask_text)","description":"Declaration","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/assist/ask_text.md","sourceDirName":"XXTLanControl.lua/assist","slug":"/XXTLanControl.lua/assist/ask_text","permalink":"/docs/en/XXTLanControl.lua/assist/ask_text","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":40,"frontMatter":{"sidebar_position":40},"sidebar":"tutorialSidebar","previous":{"title":"Create and Wait (LCC.assist.request)","permalink":"/docs/en/XXTLanControl.lua/assist/request"},"next":{"title":"Request a Picked Point (LCC.assist.pick_point)","permalink":"/docs/en/XXTLanControl.lua/assist/pick_point"}}');var a=s(4848),r=s(8453);const i={sidebar_position:40},l="Request a Text Reply (LCC.assist.ask_text)",o={},c=[{value:"Declaration",id:"declaration",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Return Values",id:"return-values",level:2},{value:"Notes",id:"notes",level:2},{value:"Example",id:"example",level:2}];function d(e){const t={a:"a",blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,r.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.header,{children:(0,a.jsx)(t.h1,{id:"request-a-text-reply-lccassistask_text",children:"Request a Text Reply (LCC.assist.ask_text)"})}),"\n",(0,a.jsx)(t.h2,{id:"declaration",children:"Declaration"}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{className:"language-lua",children:"result, err, task = LCC.assist.ask_text(options)\n"})}),"\n",(0,a.jsx)(t.h2,{id:"parameters",children:"Parameters"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["options",(0,a.jsx)(t.br,{}),"\n","Table. Assist request configuration. See ",(0,a.jsx)(t.a,{href:"/docs/en/XXTLanControl.lua/assist/common-options",children:"Common Options and Return Objects"}),". This function sets ",(0,a.jsx)(t.code,{children:'type = "text"'})," automatically."]}),"\n"]}),"\n",(0,a.jsx)(t.h2,{id:"return-values",children:"Return Values"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:["result",(0,a.jsx)(t.br,{}),"\n","Table or ",(0,a.jsx)(t.code,{children:"nil"}),". Usually ",(0,a.jsx)(t.code,{children:'{ kind = "text-reply", text = "..." }'})," on success."]}),"\n",(0,a.jsxs)(t.li,{children:["err",(0,a.jsx)(t.br,{}),"\n","String or ",(0,a.jsx)(t.code,{children:"nil"}),". Failure reason."]}),"\n",(0,a.jsxs)(t.li,{children:["task",(0,a.jsx)(t.br,{}),"\n","Table or ",(0,a.jsx)(t.code,{children:"nil"}),". The latest task state."]}),"\n"]}),"\n",(0,a.jsx)(t.h2,{id:"notes",children:"Notes"}),"\n",(0,a.jsxs)(t.blockquote,{children:["\n",(0,a.jsxs)(t.p,{children:["Use this for captchas, SMS codes, passcodes, or other cases where the operator provides text and the script can continue.",(0,a.jsx)(t.br,{}),"\n","Do not use text reply when the operator needs to decide what the next action should be. Use ",(0,a.jsx)(t.code,{children:"request_control()"})," instead."]}),"\n"]}),"\n",(0,a.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{className:"language-lua",children:'local result, err = LCC.assist.ask_text({\n    title = "Enter captcha",\n    text = "Please read the captcha in the screenshot and enter it",\n    screenshotLocalPath = XXT_SCRIPTS_PATH .. "/captcha.png",\n    timeout = 120,\n})\n\nif result then\n    sys.input_text(result.text, false)\nelse\n    nLog("assist failed", err)\nend\n'})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,a.jsx)(t,{...e,children:(0,a.jsx)(d,{...e})}):d(e)}}}]);