These are the following codes of one the main page.
<%@ Language=VBScript %>
<%
Response.ContentType = "text/xml"
Response.Buffer = true
%>
<%
mWord = Request.QueryString("mWord")
level = Request.QueryString("varLevel")
chance = Request.QueryString("chance")
charsUsed = Request.QueryString("charsUsed")
charSelected = Request.QueryString("charSelected")
'check if user input character is inside the WORD? replace the '-' with the character input
charsUsedArr = Split(charsused, ",")
if instr(UCase(mWord), UCase(charSelected)) > 0 then
If Instr(UCase(mWord), UCase(charSelected)) = 0 then
chance = chance - 1
End if
else
For i = 1 to Len(mWord)
mWordShow = mWordShow & "_ "
next
end if
if charsUsed = "" then
charsUsed = charSelected
else
charsUsed = charsUsed & ", " & charSelected
end if
'mWordShow = "--a--a"
'check for end of game
endOfGame = false
If Instr(mWordShow, "_") = 0 then
endOfGame = true
End if
if chance = 0 then
endOfGame = true
end if
%>
<CiscoIPPhoneText>
<Title>Hangman(Word-guessing application)</Title>
<Prompt></Prompt>
<%if endOfGame = true then%>
<Text>You have completed the game</Text>
<% 2 conditions%>
<% whether they finish all the chances but fail to guess%>
<%
if chance = 0 and Instr(mWordShow, "_") > 0 then
Response.write "You have finished all your chances and fail to complete the puzzle"
end if
%>
<% whether they manage to guess without finishing all the chances%>
<%
if chance < 0 and Instr(mWordShow, "_") = 0 then
Response.write "You managed to solve the puzzle"
end if
%>
<SoftKeyItem>
<Name>Restart</Name>
<URL>SoftKey:Select</URL>
<Position>2</Position>
</SoftKeyItem>
<SoftKeyItem>
<Name>Option</Name>
<URL>SoftKey:Select</URL>
<Position>3</Position>
</SoftKeyItem>
<%else%>
<Text>Guess this word (level:<%=level%>)</Text>
<Text><%=mWordShow%></Text>
<Text>Chances: <%=chance%></Text>
<Text>Chars used:("UCase(charsUsed)")</Text>
<SoftKeyItem>
<Name>Guess</Name>
<URL>http://172.20.131.164/Hangman/Enter.asp?word=<%=word%>&chance=<%=chance%>&level=<%=level%>&charsused=<%=charsused%></URL>
<Position>1</Position>
</SoftKeyItem>
<SoftKeyItem>
<Name>Restart</Name>
<URL>SoftKey:Select</URL>
<Position>2</Position>
</SoftKeyItem>
<SoftKeyItem>
<Name>Option</Name>
<URL>SoftKey:Select</URL>
<Position>3</Position>
</SoftKeyItem>
<SoftKeyItem>
<Name>Exit</Name>
<URL>SoftKey:Exit</URL>
<Position>4</Position>
</SoftKeyItem>
<%end if%>
</CiscoIPPhoneText>
<%
Response.Flush()
Response.End()
%>

New Topic/Question
Reply




MultiQuote




|