Can I change room pictures ?
Davidmarks
05 Jan 2015, 21:37Forgive what is probably a dumb question but is it possible (for example) to add a picture (jpg) to a room dsescription which shows an object in the room and then if the player takes the object will redisplay the room with a new picture in which the object is not present (or vice versa.) If it is possible a clue on how to go about it wouyld be appreciated.
jdpjdpjdp
06 Jan 2015, 00:04Yes, you can, assuming you have both pictures.
Make that the script that gets run for the room description of the room. All you have to do is replace the messages with your own room descriptions, change "thing" in lines one and two with the name of the object in question, and replace "thing_gone.jpg" and "thing_here.jpg" with the filenames for the pictures without and with the item, respectively.
Now, this only changes it when the player re-enters the room or types "look." If you want the room description to redisplay automatically when the object is taken or returned, and only in that one room, just add this to "after taking the object" and "after dropping the object", on its Inventory tab:
Again, replace "room" in line one with the name of the room. Hope this does what you need!
if (ListContains(ScopeVisible(), thing)) {
if (Got(thing)) {
msg ("Here's the room description for when the object is absent.")
picture ("thing_gone.jpg")
}
else {
msg ("Here's the room description for when the object is present.")
picture ("thing_here.jpg")
}
}
else {
msg ("Here's the room description for when the object is absent.")
picture ("thing_gone.jpg")
}
Make that the script that gets run for the room description of the room. All you have to do is replace the messages with your own room descriptions, change "thing" in lines one and two with the name of the object in question, and replace "thing_gone.jpg" and "thing_here.jpg" with the filenames for the pictures without and with the item, respectively.
Now, this only changes it when the player re-enters the room or types "look." If you want the room description to redisplay automatically when the object is taken or returned, and only in that one room, just add this to "after taking the object" and "after dropping the object", on its Inventory tab:
if (game.pov.parent = room) {
ShowRoomDescription
}
Again, replace "room" in line one with the name of the room. Hope this does what you need!
Davidmarks
06 Jan 2015, 00:22Brilliant, thank you very much. I think I understand but am very new to this. Now I know I can, I will work at it until I do understand fully (bit on the ancient side and the old grey cells are not what they were ) .. Many thanks again !
David
David
Davidmarks
07 Jan 2015, 08:25Sorry to be a pain but although I am getting some results from the helpful suggestion I don't really understand why ! I cannot understand where the code comes from. (e.g. Where does Listcontains(scopevisible come from ?) The documentation I have found so far doesn't help me. Also when I want to delete items I don't know how. I gathered that there is a sinilarity with XML so got hold of a video tutorial which was almost totally incomprehensible ( perhaps I have taken on more than I can cope with !) Is there anywhere that I can learn more about coding please.

Pertex
07 Jan 2015, 09:19Davidmarks wrote: (e.g. Where does Listcontains(scopevisible come from ?)
listcontains and scopevisible are buildin functions of quest. You can find most of them in the wiki: http://docs.textadventures.co.uk/quest/functions/
There is a fine page there how to work with lists: http://docs.textadventures.co.uk/quest/ ... lists.html which can help, too.
Davidmarks
07 Jan 2015, 09:26Thanks I will do some more studying !
jdpjdpjdp
07 Jan 2015, 18:15Davidmarks wrote:Sorry to be a pain but although I am getting some results from the helpful suggestion I don't really understand why !
I just provided it as code so you could cut and paste, but everything I did there you can do in the editor. Here's how to do exactly the same thing in the editor:
-We're messing with a room description here, so go to the "Room" tab for that room. Change the big "Description" field to "Run a Script".
-Click "Add New Script", and select an "If" statement. After the word "if" you have a drop down of options. Select "object is visible". The next dropdown defaults to "object", meaning it wants the name of an object in dropdown #3. Select the name of your object from the third dropdown (in my example, it was called "thing").
-This creates two conditions, one for the object being visible and one for it being absent. The problem is, if we're carrying it, it's technically visible despite not being a part of the room proper, so we need to account for that. Under "then" for our "if" statement above, click "add new script" and select "if" again, to create a second "if" statement inside the first. This one will differentiate between visible in the room and visible in inventory.
-For our new "if" statement, select "player is carrying object" from the dropdown. Again, leave the second dropdown on "object" and select the object name ("thing") in the third. Under that "if" statement's "then", add two new scripts. The first is "Print a message", where you'll input the message you want (in this instance, the one where the thing is absent). The second is "Show a Picture". Click the browse button, find your picture, and it will pop up in the right place.
-Under "else", do the same thing, with the other message and picture.
-Under the "else" for the first "if" statement, do the same thing again, with the absent version of the message and picture.
That's it. Now, when you switch to code view, it shows you the behind-the-scenes functions that do all that stuff (ListContains, ScopeVisible, etc.). The best way to learn the basic code function, I think, is to do something in the editor, then switch to code view and see what it says. That should help you decipher some of the code stuff.
Davidmarks wrote:Also when I want to delete items I don't know how.
If you are referring to rooms or objects in the game, just click on them in the editor tree (on the left) and push the delete key. It's that simple, but be aware that deleting a parent deletes all its children, too (so deleting a room will delete all the objects in the room too, unless you move them somewhere else first).
If there's something else you're trying to delete, let me know and I'll help if I can.
P.S.- It's no bother, BTW. I'm still learning, and have come on here plenty to ask for help. People here are really helpful about that kind of thing.