Icontem

File: example.html

Recommend this page to a friend!
  Classes of Arturs Sosins  >  Fallout 3 Terminal Hack  >  example.html  >  Download  
File: example.html
Role: Example script
Content type: text/plain
Description: Example script in action
Class: Fallout 3 Terminal Hack
Help guessing passwords for fallout 3
Author: By
Last change:
Date: 6 years ago
Size: 3,371 bytes
 

Contents

Class file image Download
<!--
/************************************************************* 
 * This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com 
 * Feel free to distribute and modify code, but keep reference to its creator 
 * 
 * Code Breaker class helps you to hack terminals in Fallout 3, by suggesting which words better to choose.
 * Basically in Fallout 3 game, when hacking terminals, you need to guess the correct password. 
 * There are set of words given, and by selecting a word as input, you will receive the ammount of correct letters 
 * in the provided word as output. Based on this clues, this class helps you guess the right password, usually in 3 tries.
 * 
 * For more information, examples and online documentation visit:  
 * http://webcodingeasy.com/JS-classes/Hack-terminals-in-Fallout-3
**************************************************************/
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:fb="http://ogp.me/ns/fb#">
	<head>
		<link rel="shortcut icon" href="/favicon.ico">
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta name="resource-type" content="document"/>
		<meta name="audience" content="all"/>
		<meta name="distribution" content="global"/>
		<meta name="robots" content="index, follow"/>
		<meta name="revisit-after" content="10 days"/>
	</head>
	<body>
		<div id = "wrapper">
			<form>
				All words: <textarea rows="30" cols="30" name="AllInputwords" id="AllInputwords"></textarea>
				<input type="button" value="generateWords" onclick="update();">
				
				<select name="options" id='wordList'>
				</select>
				Correct: <input type="text" name="count" id='rule'>
				<input type="button" value="addRule" onclick="setValue();">
				
			<form/>
			<p>Best try: <span id="BestTry"></span></p>
			
		</div>
	</body>
 </html>
 <script type="text/javascript" src="codeBreaker.packed.js"></script>
<script type="text/javascript">
	var myBreaker = new codeBreaker();
	
	function createOption(word, selected){
		var opt = document.createElement("option");
		opt.value = word;
		opt.innerHTML = word;
		if(selected)
		{
			opt.selected = true;
		}
		document.getElementById("wordList").appendChild(opt);
	}
	
	function update(){
		var words = document.getElementById('AllInputwords').value;
		myBreaker.addBulkWords(words);
		var obj = myBreaker.analyze();

		for(var i = 0, l = obj.words.length; i < l; i++)
		{
			var select = false;
			if(i == obj.bestIndex)
			{
				select = true;
			}
			createOption(obj.words[i], select);
		}
		document.getElementById("BestTry").innerHTML = obj.words[obj.bestIndex];
	}
	
	function setValue(){
		var value = document.getElementById("rule").value;
		var wordList = document.getElementById("wordList");
		var word = wordList.options[wordList.selectedIndex].value;
		var obj = myBreaker.updateRule(word,value);

		wordList.innerHTML = "";
		for(var i = 0, l = obj.words.length; i < l; i++)
		{
			var select = false;
			if(i == obj.bestIndex)
			{
				select = true;
			}
			createOption(obj.words[i], select);
		}
		document.getElementById("BestTry").innerHTML = obj.words[obj.bestIndex];
	}
	</script>