Howdy,
I'm learning to script recently and was able to get some codebits working last night to automatically play a game of blackjack in the Materia Magica MUD.
Here is my code so far:
So from this, I have a few questions that I was hoping I could get some clarification on:
1) How can I combine both of those strings so I don't have to use two different triggers? I'm not yet learned in the ways of regex, but I know its a powerful tool.
2) The game will sometimes have an output of (soft), such as 'Your current total is: 13 (soft). How can I incorporate this into my script, and give it a bit more logic? The (soft) plays my ace as either 1 or 11, so how can I allow the computer to make this decision optimally?
3) Is there a better way for me to send my value to the variable without having a separate trigger to match?
Thanks for any help, and sorry if my questions are noobish. I'm constantly consulting the scripts functions list but I'm not familiar with some of the syntax so I'm trying to learn here.
Thanks,
Forral
I'm learning to script recently and was able to get some codebits working last night to automatically play a game of blackjack in the Materia Magica MUD.
Here is my code so far:
String: Your current total is: *
Send to variable: %1 (variable bjtotal)
String: A blackjack dealer asks, 'Will you hit, stay, or double down, Forral?'
Send to script:
local bjtotal
bjtotal = tonumber (GetVariable("bjtotal"))
if bjtotal <= 12
then SendNoEcho ("say hit")
elseif bjtotal >= 13
then SendNoEcho ("say stay")
end
The alternative version of that string is: 'Will you hit, stay, or double down, Forral?'
Send to script: same code as above.
So from this, I have a few questions that I was hoping I could get some clarification on:
1) How can I combine both of those strings so I don't have to use two different triggers? I'm not yet learned in the ways of regex, but I know its a powerful tool.
2) The game will sometimes have an output of (soft), such as 'Your current total is: 13 (soft). How can I incorporate this into my script, and give it a bit more logic? The (soft) plays my ace as either 1 or 11, so how can I allow the computer to make this decision optimally?
3) Is there a better way for me to send my value to the variable without having a separate trigger to match?
Thanks for any help, and sorry if my questions are noobish. I'm constantly consulting the scripts functions list but I'm not familiar with some of the syntax so I'm trying to learn here.
Thanks,
Forral