Some question for version 5
dragoncymru
22 Dec 2011, 16:21I'm just geting back into QUEST and have downloaded QUEST 5.
Some questions from me as I'm just getting used to the new editor:
1. Is there a neat way of moving a player to a random room? i know I can set up a random variable and then move the player to a room by asigning a number of the variable to each room (ie if a 1 goto tavern, if a 2 goto forest etc) but is there a neater way?
2. Could I make the random selection less random - ie select from only a menu of rooms? And can there be several menus? In fact, how do i set up a menu?
(What I really want is a choice at the start that combines 1 and 2 above. ie if I set the coordinates on my ship, I could program somwhere really specific - say Mars, somewhere less specific (a planet in our solar system and a menus pops up with choices Mars, venus, earth etc), or somewhere completely random. If I do program in some way, i want the ship to be able to 'get lost' anyway and end up somewhere random!)
3. How do I put in Youtube videos - can't get this to work at all!
4. If i copy and paste text into a script message, can I alter it with italics, bold, underline etc?
Thanks for all help in advance
Some questions from me as I'm just getting used to the new editor:
1. Is there a neat way of moving a player to a random room? i know I can set up a random variable and then move the player to a room by asigning a number of the variable to each room (ie if a 1 goto tavern, if a 2 goto forest etc) but is there a neater way?
2. Could I make the random selection less random - ie select from only a menu of rooms? And can there be several menus? In fact, how do i set up a menu?
(What I really want is a choice at the start that combines 1 and 2 above. ie if I set the coordinates on my ship, I could program somwhere really specific - say Mars, somewhere less specific (a planet in our solar system and a menus pops up with choices Mars, venus, earth etc), or somewhere completely random. If I do program in some way, i want the ship to be able to 'get lost' anyway and end up somewhere random!)
3. How do I put in Youtube videos - can't get this to work at all!
4. If i copy and paste text into a script message, can I alter it with italics, bold, underline etc?
Thanks for all help in advance
Alex
23 Dec 2011, 11:141 & 2: The key to this is lists. You can have an object list (remembering that rooms are also objects), which contains all the rooms you want to choose from. Use the ListCount function to get the length of the list, then use GetRandomInt to get a random number between 1 and the length of the list. Finally, use the ObjectListItem function to get the item from the list, remembering that the first index is zero.
So if you have an object list called "mylist", to get a random item from it looks something like this (untested):
Your "mylist" could be a hard-coded list of rooms, or you could use AllObjects to make it any object - could be problematic though as you probably don't want the player to suddenly appear inside a teacup, or themselves. Assuming all your rooms are objects with no parent, you could loop through AllObjects to build up a list of objects with no parent, and then choose a random item from that list.
To create a menu, you can use the "show a menu" script command, new in v5.1 - or for v5.0 you use the ShowMenu function. Either way you need to create a list again, this time a string list containing the menu choices. Then you can use a "switch" to run script depending on the result. In v5.1 you check the "result" variable in the embedded script.
3. You just need the video id. On a YouTube URL it appears after "v=". If the URL doesn't appear in the address bar, you can get it by right-clicking the video and selecting "Copy video URL". For example, there's a nice music video by Plaid here: http://www.youtube.com/watch?feature=player_profilepage&v=eNf5Ga1rw78 and I can embed that in a Quest game using the id "eNf5Ga1rw78" which appears at the end of the address.
4. In a script message, you can use HTML-style tags for formatting, e.g.
So if you have an object list called "mylist", to get a random item from it looks something like this (untested):
randomitem = ObjectListItem(mylist, GetRandomInt(1, ListCount(mylist) - 1))
Your "mylist" could be a hard-coded list of rooms, or you could use AllObjects to make it any object - could be problematic though as you probably don't want the player to suddenly appear inside a teacup, or themselves. Assuming all your rooms are objects with no parent, you could loop through AllObjects to build up a list of objects with no parent, and then choose a random item from that list.
To create a menu, you can use the "show a menu" script command, new in v5.1 - or for v5.0 you use the ShowMenu function. Either way you need to create a list again, this time a string list containing the menu choices. Then you can use a "switch" to run script depending on the result. In v5.1 you check the "result" variable in the embedded script.
3. You just need the video id. On a YouTube URL it appears after "v=". If the URL doesn't appear in the address bar, you can get it by right-clicking the video and selecting "Copy video URL". For example, there's a nice music video by Plaid here: http://www.youtube.com/watch?feature=player_profilepage&v=eNf5Ga1rw78 and I can embed that in a Quest game using the id "eNf5Ga1rw78" which appears at the end of the address.
4. In a script message, you can use HTML-style tags for formatting, e.g.
here is some <b>bold text</b>, here is some <i>italic text</i>, and some <u>underlined text</u>