BigWorm
04-22-2004, 06:20 PM
I've felt like sharing lately. Some of you might find this useful. Basically, it is a way to to extract variables from game text in some cases. However, there is a caveat: it only works with a string of text that the game with repeat each time you input a command. So, no, I can't give scriptpaths a way to get the name a person that whispers to them (Unless you could get that person to whisper about 10 times in a row, but I won't go into that).
The code is a little hard to explain and is definately not for casual scripters. It basically builds the %s variable from game text one character at a time. To do this however, it has to input a command at least one more time than there are characters in the string to be matched, so it probably won't be too hard for a GM to see that you are scripting, so DON'T USE THIS IN AN AFK SCRIPT!!!
Other notes about the way it works:
Because of the way the Wizard matches, there is no case-sensitivity. Also, in order to match something, the script must know at least the first character of the line of game text. The script also cannot match more than one line of text. There are most likely some bugs with some of the special characters. I know things like ,.?!()[]-' work, but I haven't been able to test if the Wizard will correctly match and save characters like %:"
The first script with extract the first name of your character using the info command. It should work whether or not the character has a last name. The second is the template I use to adapt the code to other uses. The header does a pretty good job of explaining what needs to be changed.
I wrote this code mainly to learn more about the way WizardScript works. Feel free to use it in your scripts, but I would appreciate it if you gave a little bit of credit.
The code is a little hard to explain and is definately not for casual scripters. It basically builds the %s variable from game text one character at a time. To do this however, it has to input a command at least one more time than there are characters in the string to be matched, so it probably won't be too hard for a GM to see that you are scripting, so DON'T USE THIS IN AN AFK SCRIPT!!!
Other notes about the way it works:
Because of the way the Wizard matches, there is no case-sensitivity. Also, in order to match something, the script must know at least the first character of the line of game text. The script also cannot match more than one line of text. There are most likely some bugs with some of the special characters. I know things like ,.?!()[]-' work, but I haven't been able to test if the Wizard will correctly match and save characters like %:"
The first script with extract the first name of your character using the info command. It should work whether or not the character has a last name. The second is the template I use to adapt the code to other uses. The header does a pretty good job of explaining what needs to be changed.
I wrote this code mainly to learn more about the way WizardScript works. Feel free to use it in your scripts, but I would appreciate it if you gave a little bit of credit.