|
Psi Newbie
Joined: 30 Mar 2010 Posts: 3
|
Posted: Tue Mar 30, 2010 8:36 pm
generic script help. Please! |
Hey, absolute novice at scripting here. I need to help with a particularly monotonous element of a game I play. I want to create a script to do the following:
I start by typing Kill xxx
When the mud tells me
XXX is dead.
The trigger goes:
kill XXX
Simple(s) so far! I could do this :)
but, when i gain a level (mud says you gain a level) I want the script to check my stats (command is: stats).
If it reads the line:
Your base abilities are: Str:18 Int:10 Wil:10 Dex:18 Con:18. (if there were 19's in place of 18's, these would be fine too!)
I want the script to stop. But until a certain level I will have no stats, so if it does not read this line from the mud i'd like the script to continue with K XXX
If it does read the line above (Your base abilities.....), but does not meet the minimum stats, I want the script to input the command
Restat;k XXX
I'm not asking for someone to write this for me necessarily (would be nice!) but can you guru's out there tell me what functions I should be researching to be able to do this? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Mar 30, 2010 9:06 pm |
Quote: |
#trigger {^(*) is dead.$} {GainedLevel = 0}
#condition {^You gain a level.$} {GainedLevel = 1} {WithinLines|param=X}
#condition {^your prompt goes here} {#if (@GainedLevel) {stats} {kill %t1}} {nocr|prompt}
#variable WantedStats {Str=18|Int=10|Wil=10|Dex=18|Con=18}
#alias ChooseStats {
#addkey WantedStats Str %1
#addkey WantedStats Int %2
#addkey WantedStats Wil %3
and so on
} |
I'll let you have fun with the base abilities line, but all you'd need for that is an #IF command that uses logical AND and >=. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Psi Newbie
Joined: 30 Mar 2010 Posts: 3
|
Posted: Wed Mar 31, 2010 6:20 pm |
MattLofton wrote: |
Quote: |
#trigger {^(*) is dead.$} {GainedLevel = 0}
#condition {^You gain a level.$} {GainedLevel = 1} {WithinLines|param=X}
#condition {^your prompt goes here} {#if (@GainedLevel) {stats} {kill %t1}} {nocr|prompt}
#variable WantedStats {Str=18|Int=10|Wil=10|Dex=18|Con=18}
#alias ChooseStats {
#addkey WantedStats Str %1
#addkey WantedStats Int %2
#addkey WantedStats Wil %3
and so on
} |
I'll let you have fun with the base abilities line, but all you'd need for that is an #IF command that uses logical AND and >=. |
As I said, complete novice, so my questions here may be amateur, but I am trying to take all this in.
{WithinLines|param=X} - presumably this makes the script only check within X lines for the text 'you gain a level' after it reads 'is dead'
#condition {^your prompt goes here} {#if (@GainedLevel) {stats} {kill %t1}} {nocr|prompt} - so, if the {@GainedLevel} is true, the command would be 'stats', if not, 'kill %t1'? Sorry I don't understand what my prompt is in this instance.
to enable me to get 18 or above in the stats, do i use the following:
#variable WantedStats {Str=<17|Int=10|Wil=10|Dex=<17|Con=<17} - to get above 17 presumably, i.e. 18 or 19? or would it be <18?
So, presuming I am even in the right ball park with my assumptions above, i just then need to create the #IF line that stops the script if the right stats are reached?
Thanks for all your advice[/list] |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Apr 01, 2010 3:00 am |
Quote: |
{WithinLines|param=X} - presumably this makes the script only check within X lines for the text 'you gain a level' after it reads 'is dead'
|
Yes. I didn't have an example, so I don't know how many lines were or could be between each one.
Quote: |
#condition {^your prompt goes here} {#if (@GainedLevel) {stats} {kill %t1}} {nocr|prompt} - so, if the {@GainedLevel} is true, the command would be 'stats', if not, 'kill %t1'? Sorry I don't understand what my prompt is in this instance.
|
For the first part of the question, yes. For the second part, the prompt would be whatever line appears when the MUD is waiting for you to enter commands. For example, this is the prompt in Aardwolf: [1987/1987hp 1653/1653mn 2432/2432mv 0qt 2834tnl] >
You wouldn't have to capture anything, but obviously the prompt will change frequently so all the numbers and stuff would need to be replaced with %d and so forth depending on what your prompt format actually is.
Quote: |
to enable me to get 18 or above in the stats, do i use the following:
#variable WantedStats {Str=<17|Int=10|Wil=10|Dex=<17|Con=<17} - to get above 17 presumably, i.e. 18 or 19? or would it be <18?
|
No, the variable as I wrote it represents a datarecord variable, where Str/Int/etc represent the keynames (see below in the condition) and the number is the minimum amount you want to say yes to (ie, Str = 17 if you want to keep stats that have strength at or greater than 17). To check them against the base abilities line, you would use an #IF command, which has the format of #IF (condition) {true} {false}.
condition -- (%1 >= @WantedStats.Str) and (%2 >= @WantedStats.Int) and ...and so on all the way to Con.
true -- the commands you want to perform when you meet or exceed your baseline
false -- the commands you want to perform when you are still short of your baseline (restat;kill X)
To capture the data into those %1...%99 variables, you would use (%d) (the parentheses mean to save this value, the %d means to match numbers) so your trigger pattern would be something like Your baseline stats: Str:(%d) Int:(%d) etc. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|