Setting up a command containing multiple string variables.

Wolfberry
03 Mar 2012, 16:28
Hello forum,

I just updated from quest 4 to quest 5 a few days ago and am still figuring out the new format. Until now, I've had little trouble getting used to it, but I've run into an issue I can't seem to figure out on my own. Hopefully, you smart forum people can help me out :)

Here's my problem -

In quest 4, you used to be able to set up a command containing multiple string variables. For example, I had a game with a command which read:

add #number# points to #skill#

If the player typed "add 7 points to alchemy skill", the script would run a case conditional (now called a switch script in quest 5) of which one case read if #skill# equalled "alchemy skill", then the numeric status variable %alchemy skill% would be incremented by the numeric status variable %amount% ( every time the string variable #number# was changed, another case conditional script would run whereby if #number# equalled "7" (or any other interger in between 1 and 10), then the numeric status variable %amount% would be set to 7. If #number# was changed to 8, %amount% would be set to 8. If #number# was changed to 9, %amount% would be set to 9. Get it?) Anyway, I've been trying to recreate this command in quest 5, but when I made the command "add #number# to #skill#", the game was unable to recognize the variables #number# or #skill#. As a test, I added a command which returned the variable #skill#. I realized that when the player entered the command, the game wouldn't enter the typed-in text as the value of the string variables.

Since this realization, I've been trying to work around it, but it's been proving difficult. I looked up the tutorial to see how to set up new variables in the game, but all I found out was that the string variables #object# and #text# can still be used in a command the same way they could be used in quest 4. I tried making the command " add #text# to #object# " , but this would have required me to make the player's skills actual objects and I didn't want to do that 'cause I'm sure there's a much simpler solution.

This brings me to my question: How do I set up a command with multiple string variables like the one I made in quest 4 which works basically the same way I described it working? How do I make the quest 4 command "add #number# points to #skill#" in quest 5?

I'm sure there's some way to do this, I just haven't been able to figure out how. O generous online community, will you please help me?

-Wolfberry

sgreig
03 Mar 2012, 21:19
So let me just make sure I understand what you're trying to accomplish first. You want to create a command that will allow you to enter something like:

add 7 points to alchemy

and 7 points would presumably be deducted from a variable that keeps track of your accumulated points, and adds them to another variable?

If I'm correct, I think you'd need to use Quest's string operators in the command to remove and store the number of points and the skill you want to increment, and then perform the necessary adjustments. Does that sound about right?

Pertex
03 Mar 2012, 21:34
I think, Wolfberry wants to to do this:

 add #text_number# points to #text_skill#


The variables in the pattern must start with #text if you want to get a stringvariable e.g. #text_number# or #text1# or #textdoodledidumm# :D Same with #object if you want an object

Perhaps this wikientry helps a bit more http://quest5.net/wiki/Custom_commands

sgreig
03 Mar 2012, 22:39
Thanks Pertex! That's what I was trying to explain but I couldn't find the page on the wiki, lol.