switchable object

Spider
I have an in-game computer that I've made switchable. But I'd like to be able, not just to power it on, but then to input an access code to get me to the "desktop" - like we all do in RealLife. (I've hidden the access code under the planter!) I know it has something to do with GetInput, but I can't get things to work. Sorry for what's probably a dumb question!

Quantus
Sounds like you need to print a message like: enter access code . Do this before tour get input. Get input's variable name is: result , by default. Use an if-else to set the out come for an accurate code.

HegemonKhan
see here for how to use the 'get input' Function~Script:

http://docs.textadventures.co.uk/quest/ ... ation.html (character creation guide)

and here is the guides:

http://docs.textadventures.co.uk/quest/guides/

(check out the guides on or related to security password doors, the 'switch' or 'case' Function~Script, and etc)
(especially scroll down to the bottom, to the 'helpsheet for beginners' section of links)

there's also a thread around here (the main forum board, this one, not the doc site links above, lol) on someone also wanting to make a computer in their game just like you, which will have a lot of answers for your questions.

XanMag
Here is both the code and the .aslx file. If you have any questions on how to make it work, please ask, or look in the doc supplied by HK. Good luck.

  <object name="computer room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="computer">
<inherit name="editor_object" />
<inherit name="switchable" />
<look type="script">
if (GetBoolean(computer, "on")) {
msg ("The computer is on and it looks like it is ready to receive some input! Go ahead and 'use\" computer!")
}
else {
msg ("The commputer is currently off. You could turn it on if you wish.")
}
</look>
<feature_switchable />
<onswitchon type="script">
msg ("You push the power button and within seconds the screen comes to life. Now you just need to use it.")
SetObjectFlagOn (computer, "on")
</onswitchon>
<onswitchoff type="script">
msg ("You push the power button and the screen goes dark.")
SetObjectFlagOff (computer, "on")
</onswitchoff>
<feature_usegive />
<use type="script"><![CDATA[
if (GetBoolean(computer, "on")) {
if (GetBoolean(computer, "logged")) {
msg ("<br/>What program would you like to run? (I am not creating a whole bunch of programs! =)<br/><br/>But, if I wanted to, I could use a similar process when you first logged on to access whatever message I wanted to print.")
}
else {
msg ("You sit down at the computer and you are confronted with a log-in screen asking for your password.<br/><br/><b>What password will you type in?</b>")
get input {
switch (LCase(result)) {
case ("play xanadu","playxanadu") {
msg ("<br/>Log-in... successful!<br/><br/>What program would you like to run? (I am not creating a whole bunch of programs! =)<br/><br/>But, if I wanted to, I could use a similar process when you first logged on to access whatever message I wanted to print.")
}
default {
msg ("Your password is incorrect. Please try again. (To try again, the player will need to type 'use computer' again)")
}
}
}
}
}
else {
msg ("<br/>You don't even have the computer turned on, genius!")
}
]]></use>
</object>
<object name="post it note">
<inherit name="editor_object" />
<alias>post-it note</alias>
<look>The post-it note has some writing on it.</look>
<read>The post-it note reads: play xanadu</read>
<alt type="stringlist">
<value>post-it note</value>
</alt>
</object>
</object>


.aslx =

You can copy the code and place in your game or you can open my .aslx file and use it as a template to create it how you want. I'd suggest the latter.

Spider
Thanks! I'll try it!

Spider
XanMag -

I love it! Thanks very much! I'll try to remember to let you know if I can get things to work the way I want!

Spider

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums