A couple of questions

DGNXFoxN
I was wondering if it was possible to do these following things:

1. Put the command bar at the bottom of the page, instead of just below the displayed text.
2. Instead of the command bar showing "Type here...", if it can show something else, or nothing at all.
3. Is it possible to have an IF statement deal with synonyms? Or would I have to create a new script for every synonym?
for example: If i'm trying to re-create a search engine. The searchengine wants you to input a searchterm. I would like it to give me the same result if I type "little cats" instead of "kittens"


Thanks in advance!

adammadam
i dont know about the first two, but you can add different names to objects, if you click on an object you have listed down the left, then click on "object" you have the "other names" part where you can add other names, so if you have a "cats" object, under "other names" you can type in "cat, kittens, etc". for verbs you can have them listed like this "speak to; talk to; chat with" etc. So any one of those commands will work also. I guess if you have a specific command you would write it like "search for kittens; search for cats" etc

DGNXFoxN
adammadam wrote:i dont know about the first two, but you can add different names to objects, if you click on an object you have listed down the left, then click on "object" you have the "other names" part where you can add other names, so if you have a "cats" object, under "other names" you can type in "cat, kittens, etc". for verbs you can have them listed like this "speak to; talk to; chat with" etc. So any one of those commands will work also. I guess if you have a specific command you would write it like "search for kittens; search for cats" etc


So you are suggesting that I add possible search terms as objects to the game?
Would have to look into that ;) thank you!

XanMag
Along the lines of what Adammadam posted -

1 & 2. Pixie or Jay (or another) will likely stroll along and help with the first two questions you have.

3. I just finished something similar in my game. That is, using a computer to essential look things up. Here is what I did:

A. I added a computer object.
B. In my case I had the computer on already and not able to be turned off seeing as there was no need for that.
C. When the player types 'use computer', I use a 'get input' script. In your case you might first print a message like "What search engine would you prefer to use - 1. 'Google', 2. 'Yahoo', or 3. 'Bing'?" followed by a 'get input' script. Under the 'Then' run a 'Switch' script and add the 'cases' you want. For your cases, you might have "1","Google","google" and "2","Yahoo","yahoo" and "3","Bing","bing".
D. Double click the "1","Google","google" case and you will have a pop-up Script Editor Box. Add a 'print message' script with something like "What would you like to search on google?" followed by another 'get input' 'then' 'switch' script.
E. Add your relevant cases again and offer information for their searches.
F. Under the 'default' part of the 'switch' script, add a 'print message' like "You search for that on Google, but nothing really catches your attention.
G. After <b>every</b> possible search they can perform, add a 'print message' at the end of the information you present to them that reads something like this. "Would you like to perform another search? Yes or No?"
H. After this, add another 'get input', 'switch' with 'yes' and 'no' cases.
I. Add a function. Bottom of your menu screen on the left in the editor page. Give it a name like "google loop"
J. Under the 'yes' option, add a 'call function' and call "google loop". Under the 'no' option print a message like "You decide to take a break from searching the internet." *I'm not sure if the following is required or not (I don't think so), but I didn't want to screw up my function too bad, but I also put a 'move object to current room' and moved my player to that room. Try it without, and if the no part of the script isn't working, add that last bit... =P
K. Copy your A-J steps above and paste them in the function you've created called "google loop".

This should create a never ending internet search loop until the player chooses to type 'no'.

This should work unless my description above has a fatal flaw. But, from memory, those are the steps I used and it is working with 99% accuracy!

Also, you will DEFINITELY want to make sure you type carefully in the case scripts. If you are searching for cats, for example... After you click (+case), there will be a little box there. You need to type it in exactly as you want it. For example, in the box --> "Cats","cats","cat","Cat","Feline","feline","Felines","felines"

If you accidentally have --> "cats"... ... ... "cats" it will crash the script. I know there is a way to ignore capital letters and run partial inputs only and correct for misspellings, but I was not willing to learn it because it looked pretty complicated. Someone on here may give you an easier way to input cases to make you work a little simpler.

I hope I didn't muddle that up too bad.

Good luck! Ask questions if you don't understand, and if anyone notices a mistake in my little format there, please correct it before DGN gets too confused!! Thanks!

XanMag

EDIT.. I see your recent post and I would suggest NOT adding them as objects if all you have to do is search for information on them! =)

For clarification (maybe! =)
Below is a very small portion of the code I used for the program. This first section is where the computer has been hacked already...
if (GetBoolean(computer, "hacked")) {
msg ("You punch in the password again and are prompted with your program choice again.")
msg ("Which program would you like to run (type 'stop' to stop using the computer)?<br/>1 - Dingo Database<br/>2 - Compound Information<br/>Stop - stop using computer")
get input {
switch (result) {
case ("1") {
msg ("<br/>The screen clears and a single prompt appears in green.<br/><br/>Please type the last name of the person you would like to search or type 'stop' to quit using the computer or type 'return' to return to the program selection screen:")
get input {
switch (result) {
case ("Dingo", "dingo") {
play sound ("alarm.mp3", false, false)
msg ("CLASSIFIED...I added a classified return here because he is the head bad guy.")
wait {
computer loop
}
}
case ("Magoo","magoo") {
msg ("Here is the info returned on a search for an 'NPC' name Magoo.")
wait {
computer loop
}
}


There are only two of my gazillion names that could be searched above... I think you get the point, right? The above code was my person search program. I did the exact same thing for program number two but with rooms in the compound. Make sure you have a default for an irrelevant search query that ends with the call function (in my case it was titled computer loop). I had a 'stop' case in there when the player was done searching which automatically ended the computer loop.

HegemonKhan
see the 'library and code samples' forum, as Pixie and~or Jay (Jaynabonne) has threads on the Command Input Line, panes, UI, and etc stuff.

viewforum.php?f=18 (library and code samples)

and I think here is directly what you want (I hope anyawys) with the command line input box at the bottom of screen:

viewtopic.php?f=18&t=4681

------

if you want to hide~show the command line bar~box:

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

Request (Hide, "Command")
// or something like this (I can't find the thread~post by Pixie or Jay on it... argh)

DGNXFoxN
Thanks XanMag & HegemonKhan for the information.

Not sure what you mean with cases but i'll look into it ;) (here I was thinking I had LUA-based scripting under control... lol)
For the command bar, i'll be looking into trying and getting it to show at the bottom.

XanMag
There is a button to add cases when you add a switch script. You can't miss it! Good luck!

TinFoilMkIV
A 'switch' basically works like an 'if' statement with multiple possible outcomes, you can really use either to accomplish the same thing but switches are a bit easier to use and read for choices or input with multiple results in my opinion. a 'case' is basically one of your if checks. So for an on/off switch, you would have two cases that are just "on" and "off". The switches are also a bit nicer to work with multiple inputs, as said above you can separate each trigger for each case with a comma ',' to denote an 'or', ie: "1", "google = user entered "1" or "google", either will be considered a match for that case.

A trick with the 'get input' script is that you can then modify the 'result' variable that holds the player input either before or while comparing search terms for your switch. For example 'switch ( LCase(result) )' will make the result variable all lower case before comparing it to your cases. for the GUI editor that would equate to just entering 'LCase(result)' in the first box for the switch.

EDIT: also for a switch, below the cases is a section called 'default' this is what happens if the check matches none of your cases, or in comparison with an 'if' statement, this is the 'else' part.

XanMag
Hahaha. Dang. I wish I would have known the LCase(result) thing earlier. I spent a lot of time making sure all my capitalization was just right for my recent LENGTHY script!! I guess I should have asked! lol

Well, the good news is, that I am using it for my smaller hint system and it is working beautifully, so, thanks TinFoilMkIV!!

TinFoilMkIV
Heh, no problem. Also for reference http://docs.textadventures.co.uk/quest/functions/
scroll down to the String Functions section for similar functions you can use.

HegemonKhan
wow, I just learned that the 'switch' indeed has an 'else' option, laughs. Well, I think 'switches' are still more limited a bit than the 'if' Script, but now less so.

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

Support

Forums