Let me start out by saying I know just enough JavaScript to get by... I have developed a quiz where the user competes in a game with the computer. If the user gets the answer wrong the computer gets to \"guess.\" I used a random number generated from SL. My trouble is that I don't want the computer to guess the same answer as the user. I have tried several combinations in JavaScript but just can't get it to work. Your help is greatly appreciated! This is my code:
\n
var player=GetPlayer();
var i=player.GetVar(\"PlayerResponse\");
var y=player.GetVar(\"RandumNumber\");
while (y = i) {
var randomnumber = Math.floor((Math.random()*4)+1);
var i = randomnumber;
}
player.SetVar(\"RandumNumber\",randomnumber);
player.SetVar(\"worked\",y);
","kudosSumWeight":0,"postTime":"2022-05-02T11:17:41.000-07:00","images":{"__typename":"AssociatedImageConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"attachments":{"__typename":"AttachmentConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[{"__typename":"AttachmentEdge","cursor":"MjQuMTF8Mi4xfG98NXxfTlZffDE","node":{"__ref":"Attachment:{\"id\":\"attachment:message991187AttachmentNumber1\",\"url\":\"https://community.articulate.com/t5/s/rwgqn69235/attachments/rwgqn69235/discuss/227074/1/Untitled1.story\"}"}}]},"tags":{"__typename":"TagConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[{"__typename":"TagEdge","cursor":"MjQuMTF8Mi4xfG98MTB8X05WX3wx","node":{"__typename":"Tag","id":"tag:General E-Learning","text":"General E-Learning","time":"2021-03-01T06:45:41.000-08:00","lastActivityTime":null,"messagesCount":null,"followersCount":null}}]},"timeToRead":1,"currentRevision":{"__ref":"Revision:revision:991187_1"},"latestVersion":null,"metrics":{"__typename":"MessageMetrics","views":3},"visibilityScope":"PUBLIC","canonicalUrl":null,"seoTitle":null,"seoDescription":null,"isEscalated":null,"placeholder":false,"originalMessageForPlaceholder":null,"messagePolicies":{"__typename":"MessagePolicies","canModerateSpamMessage":{"__typename":"PolicyResult","failureReason":{"__typename":"FailureReason","message":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","key":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","args":[]}}},"archivalData":null,"body":"Let me start out by saying I know just enough JavaScript to get by... I have developed a quiz where the user competes in a game with the computer. If the user gets the answer wrong the computer gets to \"guess.\" I used a random number generated from SL. My trouble is that I don't want the computer to guess the same answer as the user. I have tried several combinations in JavaScript but just can't get it to work. Your help is greatly appreciated! This is my code:
\n
var player=GetPlayer();
var i=player.GetVar(\"PlayerResponse\");
var y=player.GetVar(\"RandumNumber\");
while (y = i) {
var randomnumber = Math.floor((Math.random()*4)+1);
var i = randomnumber;
}
player.SetVar(\"RandumNumber\",randomnumber);
player.SetVar(\"worked\",y);
","customFields":[]},"Conversation:conversation:991187":{"__typename":"Conversation","id":"conversation:991187","solved":false,"topic":{"__ref":"ForumTopicMessage:message:991187"},"lastPostingActivityTime":"2022-05-06T05:38:42.000-07:00","lastPostTime":"2022-05-06T05:38:42.000-07:00","unreadReplyCount":2,"isSubscribed":false},"ModerationData:moderation_data:991187":{"__typename":"ModerationData","id":"moderation_data:991187","status":"APPROVED","rejectReason":null,"isReportedAbuse":false,"rejectUser":null,"rejectTime":null,"rejectActorType":null},"Attachment:{\"id\":\"attachment:message991187AttachmentNumber1\",\"url\":\"https://community.articulate.com/t5/s/rwgqn69235/attachments/rwgqn69235/discuss/227074/1/Untitled1.story\"}":{"__typename":"Attachment","id":"attachment:message991187AttachmentNumber1","filename":"Untitled1.story","filesize":2206607,"contentType":"application/octet-stream","url":"https://community.articulate.com/t5/s/rwgqn69235/attachments/rwgqn69235/discuss/227074/1/Untitled1.story"},"Revision:revision:991187_1":{"__typename":"Revision","id":"revision:991187_1","lastEditTime":"2022-05-02T11:17:41.000-07:00"},"ForumReplyMessage:message:991189":{"__typename":"ForumReplyMessage","id":"message:991189","conversation":{"__ref":"Conversation:conversation:991187"},"author":{"__ref":"User:user:732579"},"revisionNum":1,"uid":991189,"depth":1,"hasGivenKudo":false,"subscribed":false,"board":{"__ref":"Forum:board:discuss"},"subject":"Re: Random Number","readOnly":false,"editFrozen":false,"moderationData":{"__ref":"ModerationData:moderation_data:991189"},"parent":{"__ref":"ForumTopicMessage:message:991187"},"body":"