K, I play a MUD where stat rolling is important. You can miss out on a lot if you don't get a good roll.
I have seen your huge, code intensive roller someone else asked about.
The thing is, I'm an idiot when it comes to code. I can make simple triggers and aliases, but I'm not a coder and I can't do anything special with MUSHclient.
Is there any way I can get or make a stat roller that's not horribly difficult for your code-moronic people to understand?
Is there something I can plug in to MUSHclient, or am I going to have to struggle with coding in order to get a character with a good roll?
Frankly if code is what I have to work with, I'll have to stick with a pen, paper, calculator and 5 hours of my time to spare.
I'm hoping and praying there's a simpler, easier-to-understand way to do this.
Now, I need to be able to have it roll until it reaches a specific total number, obviously. Each race and class has it's own "good" rolls, so the number of the total stats has to be veriable.
I should be able to specify that I'd like it to continue rolling until it reaches 230 total, for example, and until it gets to that number, adding up the stats, it continues to input "N" into the client for no.
When it hits my specified number, it should select "yes" automatically.
I've only played this one mud, so I have no idea if it works the same on all of them. Pardon me if I'm giving you information you're already aware of.
OK, that looks easy enough. You need a couple of triggers (one for each line) and an alias to set up the total you want ...
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="[Str: * Int: * Wis: * Dex: * Con: *]"
send_to="12"
sequence="100"
>
<send>
SetVariable "str", "%1"
SetVariable "int", "%2"
SetVariable "wis", "%3"
SetVariable "dex", "%4"
SetVariable "con", "%5"
</send>
</trigger>
<trigger
custom_colour="3"
enabled="y"
match="Keep these stats? (Y/N)*"
send_to="12"
sequence="100"
>
<send>dim total
total = CInt (GetVariable ("str")) _
+ CInt (GetVariable ("int")) _
+ CInt (GetVariable ("wis")) _
+ CInt (GetVariable ("dex")) _
+ CInt (GetVariable ("con"))
if total >= CInt (GetVariable ("total_wanted")) then
Send "Y"
Note "** Accepted total stats of " & total
else
Send "N"
Note "Rejected total stats of " & total
end if
</send>
</trigger>
</triggers>
<aliases>
<alias
match="stats *"
enabled="y"
variable="total_wanted"
send_to="9"
sequence="100"
>
<send>%1</send>
</alias>
</aliases>
Copy between the lines and go into MUSHclient File menu, select Import and click on Clipboard. That should install it all.
Then type:
stats 230
(or whatever figure) and that will set up a variable to remember the total you are aiming for. Don't make it too high or you will spam the MUD as the total will never be reached.
Then when you connect the first trigger will match and remember the settings for each entry (str, dex, wis and so on) into variables.
Then the second trigger (Keep these stats? (Y/N)) adds them together and compares to your limit, and sends Y or N.
Line 6: Value '12' too large in numeric attribute named 'send_to'. Range is 0 to 9. (trigger not loaded)
Line 21: Value '12' too large in numeric attribute named 'send_to'. Range is 0 to 9. (trigger not loaded)
Line 49: Attribute not used: send_to="9" (alias)
Line 50: Attribute not used: sequence="100" (alias)
K, let's totally start over here instead of editing to death.
I downloaded 3.42 and it accepted the stuff. Now, it keeps telling me:
Keep these stats? (Y/N) [Str: 20 Int: 69 Wis: 46 Dex: 48 Con: 29]
N
rejected total stats of 223
Keep these stats? (Y/N) [Str: 25 Int: 75 Wis: 58 Dex: 51 Con: 25]
N
Rejected total stats of 223
Even thought the numbers are changing and some are NOT adding up to 223.
Change the total calculation slightly to recalc as it receives and sets each variable, kinda like:
SetVariable "str", "%2"
total = CInt (GetVariable ("str"))
SetVariable "int", "%3"
total = CInt (total + ("int"))
SetVariable "wis", "%4"
total = CInt (total + ("wis"))
SetVariable "dex", "%5"
total = CInt (total + ("dex"))
SetVariable "con", "%6"
total = CInt (total + ("con"))
You'll probly also want to set total to 0 at the beginning of each iteration of the loop if you do this otherwise it will guarantee an acceptance of the 2nd roll.
"You'll probly also want to set total to 0 at the beginning of each iteration of the loop if you do this otherwise it will guarantee an acceptance of the 2nd roll."
Hahahah. That makes no sense. I don't even know what an iteration is.
Eh, guess thats why I shouldna be coding on 8 hours of sleep in the past week. Though in my defense, I did say "kinda like" the example I gave. As for why yours didnt work, I dunno either, it *should* have the way it was written but such is the world of microsoft. I also lied when I said it would need to be set to 0 at the beginning of each roll, the first stat would automatically clear the old total. (DUH!) Bad coder, no cookies for me. (Oh, wait, I don't have any anyway... )
if total >= CInt (GetVariable ("total_wanted")) then
Send "Y"
Note "** Accepted total stats of " & total
else
Send "N"
Note "Rejected total stats of " & total
end if
I'm still getting:
keep these stats? (Y/N) [Str: 36 Int: 56 Wis: 51 Dex: 35 Con: 37]
N
Rejected total stats of 0
OK, let me see the whole thing, not just the lines I changed. In the trigger configuration window (where they are all listed) shift-click to select both triggers, then click "copy" and then paste the results into a message here.
if total >= CInt (GetVariable ("total_wanted")) then
Send "Y"
Note "** Accepted total stats of " & total
else
Send "N"
Note "Rejected total stats of " & total
end if
</send>
</trigger>
</triggers>
Obviously the " and & stuff is " and & in the actual trigger, I'm sure I don't need to tell you that.
It's not double quoted when you actually go into the trigger and look at the match. I don't know why it copied that way when I did the highlight and clicked the copy button.
I entered the last code stuff you gave me, however, it's making me manually insert no or yes.
Hmm - I am assuming now that the line that says: "Keep these stats? (Y/N)" does not have a newline at the end.
That is why the trigger isn't matching - it doesn't match until the newline arrives.
I have done it a different way below - remove the two triggers and replace with this (one trigger and one timer) - you can import them through the File menu -> Import -> Clipboard.
What this does is use a technique documented elsewhere:
This uses a 1-second timer to check to see if the line "Keep these stats? (Y/N)" has arrived, and if so, sends Y or N.
You may need to edit the script in the timer slightly to add a trailing space (eg. "Keep these stats? (Y/N) ") - note the space at the end - it isn't obvious from your post whether it is there or not.
<timers>
<timer enabled="y" second="1" send_to="12"
>
<send>Dim iNumber
'
' Find line number of last line in buffer
'
iNumber = world.GetLinesInBufferCount
'
' Process if it:
' a) does not have a newline at the end
' b) is not a world.note line
' c) is not player input
'
if world.GetLineInfo (iNumber, 3) = 0 and _
world.GetLineInfo (iNumber, 4) = 0 and _
world.GetLineInfo (iNumber, 5) = 0 then
sLine = world.GetLineInfo (iNumber, 1)
if world.GetLineInfo (iNumber, 1) = _
"Keep these stats? (Y/N)" then
if CInt (GetVariable ("total")) >= _
CInt (GetVariable ("total_wanted")) then
Send "Y"
Note "** Accepted total stats of " & total
else
Send "N"
Note "Rejected total stats of " & total
end if ' end total not OK
end if ' end of "Keep these stats" line
end if ' end of output from MUD with no newline
</send>
</timer>
</timers>
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="*[Str: * Int: * Wis: * Dex: * Con: *]"
send_to="12"
sequence="100"
>
<send>SetVariable "total", %2 + %3 + %3 + %5 + %6</send>
</trigger>
</triggers>
Does the line with the stats on it get coloured (ie. does the trigger fire?), and what, if anything, is the value of the variable "total"? You can check that from the variables configuration window.
If Nick has the time and the inclination, I think it's an excellent idea.
Connect to dsl-mud.org on port 4000
There's a bit of character creation (physical traits and then pulling the rope for name approval) before the actual rolling process, so it can get tedious to go through after the millionth time.
Just a quick note that this MUD doesn't allow multi-playing (more than one character connected to them at the same time), even in creation mode, and doing it is immediate grounds for site banning. It's not a good idea to open more than one window for sake of time, unfortunately.
OK, this is the finished result. It worked for me. You hadn't added the extra space on the end of the question.
<aliases>
<alias
match="stats *"
enabled="y"
variable="total_wanted"
send_to="9"
sequence="100"
>
<send>%1</send>
</alias>
</aliases>
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="*[Str: * Int: * Wis: * Dex: * Con: *]"
send_to="12"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
<send>SetVariable "total", %2 + %3 + %3 + %5 + %6
Note "Calculated total stats of " & GetVariable ("total")</send>
</trigger>
</triggers>
<timers>
<timer enabled="y" second="2" send_to="12"
>
<send>Dim iNumber
'
' Find line number of last line in buffer
'
iNumber = world.GetLinesInBufferCount
'
' Process if it:
' a) does not have a newline at the end
' b) is not a world.note line
' c) is not player input
'
if world.GetLineInfo (iNumber, 3) = 0 and _
world.GetLineInfo (iNumber, 4) = 0 and _
world.GetLineInfo (iNumber, 5) = 0 then
sLine = world.GetLineInfo (iNumber, 1)
if world.GetLineInfo (iNumber, 1) = _
"Keep these stats? (Y/N) " then
if isempty (GetVariable ("total_wanted")) or _
GetVariable ("total_wanted") <= 0 then
Note "Wanted stats not defined - type: stats <number>"
else
if CInt (GetVariable ("total")) >= _
CInt (GetVariable ("total_wanted")) then
Send "Y"
Note "** Accepted total stats of " & GetVariable ("total")
else
Send "N"
Note "Rejected total stats of " & GetVariable ("total")
Note "Wanted " & GetVariable ("total_wanted")
end if ' end total not OK
end if ' wanted stats defined
end if ' end of "Keep these stats" line
end if ' end of output from MUD with no newline</send>
</timer>
</timers>
Just go to the File menu -> Import -> Clipboard. Before doing that, remove the existing one if it is still there.
Here is some example output produced while I was sitting watching it ...
[Str: 43 Int: 55 Wis: 49 Dex: 41 Con: 41]
Calculated total stats of 235
Keep these stats? (Y/N)
N
Rejected total stats of 235
Wanted 240
[Str: 42 Int: 50 Wis: 44 Dex: 35 Con: 39]
Calculated total stats of 216
Keep these stats? (Y/N)
N
Rejected total stats of 216
Wanted 240
[Str: 44 Int: 50 Wis: 52 Dex: 45 Con: 43]
Calculated total stats of 232
Keep these stats? (Y/N)
N
Rejected total stats of 232
Wanted 240
[Str: 47 Int: 58 Wis: 46 Dex: 36 Con: 41]
Calculated total stats of 240
Keep these stats? (Y/N)
Y
** Accepted total stats of 240
Do you wish to customize this character?
Customization takes time, but allows a wider range of skills and abilities.
Customize (Y/N)?
n
I added a couple of extra lines to show what it had calculated, and what the limit you set was.
For the first problem, you could put back the original trigger I did - that will match on lines which *do* have a newline, which would apply in this case. Just check it matches the right thing (eg. the space on the end).
For the second problem, disable the *timer* which is what is responding to the message from the MUD.
I'm having kind of the same problem, coding moron here as well, been trying these different forms of code here, just changing some of the strings to fit my mud. here is the stat rolling lines;
if total >= CInt (GetVariable ("total_wanted")) then
Send "Y"
Note "** Accepted total stats of " & total
else
Send "N"
Note "Rejected total stats of " & total
end if
hope that helps, if need be, the mud I'm trying to connect to is darkmist, connection info is;
darkmists.net 2222
I also tried the timer code and it didn't work either, but its closer to what I'm wanting, I'd love to see the total of the stats and what not so I know what I could get if by chance something happens and I put in to high of a number.
I was looking through the forum some more and ran across this trigger, it looks like it should work, but I'm getting an error. I know there is a lot of info on the forums, and I am looking, just trying different things and seeing if I can find one that works, but I'm not having much luck.
Ok, got something going so far, was able to use the mushclient trigger system to get it working, this is the code I have so far, any help fixing it to show me a total for the stats would be great, going to continue to look through the forums too.