Rev 1614 | Rev 1644 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1614 | Rev 1620 | ||
|---|---|---|---|
| Line 123... | Line 123... | ||
| 123 | } |
123 | } |
| 124 | 124 | ||
| 125 | return "No help for " + command_name + " found\n"; |
125 | return "No help for " + command_name + " found\n"; |
| 126 | } |
126 | } |
| 127 | RegisterConsoleCommand(help, help_complete); |
127 | RegisterConsoleCommand(help, help_complete); |
| - | 128 | ||
| - | 129 | var prompt_requests = new Array(); |
|
| - | 130 | var prompt_request_counter = 0; |
|
| - | 131 | ||
| - | 132 | function prompt(question, callback, text) |
|
| - | 133 | { |
|
| - | 134 | var id = prompt_request_counter++; |
|
| - | 135 | prompt_requests[id] = callback; |
|
| - | 136 | ||
| - | 137 | var prompt = ""; |
|
| - | 138 | ||
| - | 139 | if (text) |
|
| - | 140 | { |
|
| - | 141 | if (text[text.length - 1] != '\n') |
|
| - | 142 | { |
|
| - | 143 | text += "\n"; |
|
| - | 144 | } |
|
| - | 145 | ||
| - | 146 | prompt += text; |
|
| - | 147 | } |
|
| - | 148 | ||
| - | 149 | prompt += "P;" + id + ";" + question + "\n"; |
|
| - | 150 | ||
| - | 151 | return prompt; |
|
| - | 152 | } |
|
| - | 153 | ||
| - | 154 | function Console_PromptResponse(id, response) |
|
| - | 155 | { |
|
| - | 156 | var result = prompt_requests[id](response); |
|
| - | 157 | ||
| - | 158 | delete prompt_requests[id]; |
|
| - | 159 | ||
| - | 160 | return result; |
|
| - | 161 | } |
|