Gammon Forum
Entire forum
MUSHclient
Lua
Variable problems
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Dragonlord
(24 posts) bio
|
Date
| Sat 25 Mar 2017 05:13 PM (UTC) |
Message
| <triggers>
<trigger
custom_colour="2"
enabled="y"
group="Blackjack"
ignore_case="y"
match="^Your current total is\: (.*?)\|Your current total is\: (.*?) \(soft\)$"
regexp="y"
send_to="12"
sequence="100"
variable="bjtotal"
>
<send>SetVariable ("bjtotal", "%1")
SetStatus ("Your current total is: %1")
</send>
</trigger>
</triggers>
Your current total is: 14 <--- this variable is frozen to this number and not changing to
a new number. I can't find where to make the adjustment.
<triggers>
<trigger
enabled="y"
group="Blackjack"
keep_evaluating="y"
match="^(A blackjack dealer asks, ){0,1}'Will you hit,{0,1} (or ){0,1}stay,{0,1}( or double down){0,1},{0,1} Lyneirari\?'( a blackjack dealer asks\.){0,1}$"
regexp="y"
send_to="10"
sequence="100"
>
<send>Blackjack_Game</send>
</trigger>
</triggers>
<aliases>
<alias
match="Blackjack_Game"
enabled="y"
echo_alias="y"
group="Blackjack"
variable="bjtotal"
send_to="12"
ignore_case="y"
keep_evaluating="y"
sequence="100"
>
<send>local bjtotal
bjtotal = tonumber (GetVariable("bjtotal"))
if bjtotal <= 12 then
Send ("say hit")
elseif bjtotal >= 13 then
Send ("say stay")
end</send>
</alias>
</aliases>
Run-time error
World: Materia Magica GMCP
Immediate execution
[string "Alias: "]:5: attempt to compare nil with number
stack traceback:
[string "Alias: "]:5: in main chunk | top |
|
Posted by
| Dragonlord
(24 posts) bio
|
Date
| Reply #1 on Sun 26 Mar 2017 03:19 AM (UTC) |
Message
|
<aliases>
<alias
match="Blackjack_Game"
enabled="y"
echo_alias="y"
group="Blackjack"
variable="bjtotal"
send_to="12"
ignore_case="y"
keep_evaluating="y"
sequence="100"
>
<send>local bjtotal
bjtotal = tonumber (GetVariable("bjtotal"))
if bjtotal <= 12 then
Send ("say hit")
elseif bjtotal >= 13 then
Send ("say stay")
end</send>
</alias>
</aliases>
<triggers>
<trigger
custom_colour="2"
enabled="y"
group="Blackjack"
ignore_case="y"
match="^Your current total is\: (.*?)\|Your current total is\: (.*?) \(soft\)$"
regexp="y"
send_to="12"
sequence="100"
variable="bjtotal"
>
<send>SetVariable ("bjtotal", "%1")
SetStatus ("Your current total is: %1")
</send>
</trigger>
</triggers>
Your current total is: 14 <--- this variable is frozen to this number and not changing to a new number. I can't find where to make the adjustment.
<triggers>
<trigger
enabled="y"
group="Blackjack"
keep_evaluating="y"
match="^(A blackjack dealer asks, ){0,1}'Will you hit,{0,1} (or ){0,1}stay,{0,1}( or double down){0,1},{0,1} Lyneirari\?'( a blackjack dealer asks\.){0,1}$"
regexp="y"
send_to="10"
sequence="100"
>
<send>Blackjack_Game</send>
</trigger>
</triggers>
Run-time error
World: Materia Magica GMCP
Immediate execution
[string "Alias: "]:5: attempt to compare nil with number
stack traceback:
[string "Alias: "]:5: in main chunk | top |
|
Posted by
| Fiendish
USA (2,514 posts) bio
Global Moderator |
Date
| Reply #2 on Sun 26 Mar 2017 12:03 PM (UTC) Amended on Sun 26 Mar 2017 12:05 PM (UTC) by Fiendish
|
Message
|
|
To make your code more readable please use [code] tags as described here.
|
Quote: attempt to compare nil with number
This is your error message, and it's only caused by one thing (comparing nil with a number).
You would get the same message if you did
Why do you have those variable="bjtotal" lines all over? |
https://github.com/fiendish/aardwolfclientpackage | top |
|
Posted by
| Dragonlord
(24 posts) bio
|
Date
| Reply #3 on Sun 26 Mar 2017 04:45 PM (UTC) |
Message
|
<aliases>
<alias
match="Blackjack_Game"
enabled="y"
echo_alias="y"
group="Blackjack"
variable="bjtotal"
send_to="12"
ignore_case="y"
keep_evaluating="y"
sequence="100"
>
<send>local bjtotal
bjtotal = tonumber (GetVariable("bjtotal"))
if bjtotal <= 12 then
Send ("say hit")
elseif bjtotal >= 13 then
Send ("say stay")
end</send>
</alias>
</aliases>
The variable bjtotal belong to this alias
<triggers>
<trigger
enabled="y"
group="Blackjack"
keep_evaluating="y"
match="^(A blackjack dealer asks, ){0,1}'Will you hit,{0,1} (or ){0,1}stay,{0,1}( or double down){0,1},{0,1} Lyneirari\?'( a blackjack dealer asks\.){0,1}$"
regexp="y"
send_to="10"
sequence="100"
>
<send>Blackjack_Game</send>
</trigger>
</triggers>
This trigger calls to Blackjack_Game
<triggers>
<trigger
custom_colour="2"
enabled="y"
group="Blackjack"
ignore_case="y"
match="^Your current total is\: (.*?)\|Your current total is\: (.*?) \(soft\)$"
regexp="y"
send_to="12"
sequence="100"
variable="bjtotal"
>
<send>SetVariable ("bjtotal", "%1")
SetStatus ("Your current total is: %1")
</send>
</trigger>
</triggers>
This trigger handles the player card total the player is holding.
the problem is SetStatus ("Your current total is: %1") is not changing if another is dealt, or new game. | top |
|
Posted by
| hogarius
USA (22 posts) bio
|
Date
| Reply #4 on Mon 27 Mar 2017 01:44 PM (UTC) Amended on Mon 27 Mar 2017 02:14 PM (UTC) by hogarius
|
Message
| <triggers>
<trigger
custom_colour="2"
enabled="y"
group="Blackjack"
ignore_case="y"
match="^Your current total is\: (.*?)\|Your current total is\: (.*?) \(soft\)$"
regexp="y"
send_to="12"
sequence="100"
variable="bjtotal"
>
<send>SetVariable ("bjtotal", "%1")
SetStatus ("Your current total is: %1")
</send>
</trigger>
</triggers>
I think your match line may have an extra backslash in it, before the `|` pipe symbol. | top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
15,201 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.