msg ("Are you <form><input type=\"radio\" name=\"gender\" value=\"male\" onclick=\"ASLEvent('GenderSelected', 'male');\"> Male<br/><input type=\"radio\" name=\"gender\" value=\"female\" onclick=\"ASLEvent('GenderSelected', 'female');\"> Female</form>")
The Pixie wrote:In a dialogue box like this?
http://textadventures.co.uk/games/view/ ... tcg/deeper
Here is a simple example:
viewtopic.php?f=18&t=4822#p35972
And a library:
viewtopic.php?f=18&t=5474
Also, take a look at this page which explains how to link JavaScript to your game:
http://docs.textadventures.co.uk/quest/ ... cript.html
If you just want radio buttons in the text, just print the HTML:msg ("Are you <form><input type=\"radio\" name=\"gender\" value=\"male\" onclick=\"ASLEvent('GenderSelected', 'male');\"> Male<br/><input type=\"radio\" name=\"gender\" value=\"female\" onclick=\"ASLEvent('GenderSelected', 'female');\"> Female</form>")
The onclick event here will invoke the special function ASLEvent, which in turn will call a function in your game called, in this instance, GenderSelected, with the gender as a parameter.
<stuff><![CDATA[
<div id="dialog_window_1" class="dialog_window" title="Character Creation">
<p>Input your character information here!</p>
Name: <input type="text" id="name_input" /><br/>
Age: <input type="text" id="age_input" class="numbersOnly" /><br/>
Gender: <input type="radio" name="gender" id="Male" value="Male">Male<input type="radio" name="gender" id="Female" value="Female">Female<br/>
</div>
<script>
jQuery('.numbersOnly').keyup(function () {
this.value = this.value.replace(/[^0-9\.]/g,'');
});
function setValues() {
answer = $('#name_input').val() + "|" + $('#age_input').val() + "|" + $('input:radio[name=gender:checked').val();
ASLEvent("HandleDialogue", answer);
$('#dialog_window_1').dialog("close");
}
$(document).ready(function () {
$('#dialog_window_1').dialog({
height: 400,
width: 640,
buttons: {
"Done": function() { setValues();}
}
});
});
</script>
]]></stuff>
msg(s) // for debugging only
ary = Split(s, "|")
age = ToInt(StringListItem(ary, 2))