Mission point Counter?

Posted by Biran on Fri 13 Jan 2023 05:51 PM — 5 posts, 15,812 views.

#0
I'm new to this type of script and iv looked into the forum for something similar but have had little luck getting it to work.
This is the trigger line.

Raichek says 'As a reward, I am giving you 18 mission points, and 14 Ryo.'
Trigger:
match="^'As a reward, I am giving you (\d+) mission points, and (\d+) Ryo.'$"

Send:
var.mpcount = (var.mpcount or 0) + %1
var.totmp = (var.totmp or 0) + %1

I have it going to script,enabled, regular expression,custom_2
Also my lua file is C:\Program Files (x86)\MUSHclient\scripts\exampscript.lua

My alias recall this number is
Alias = missions

You have gained : @mpcount

It gives the Error variable "mpcount" has not been defined
#1
A couple things to check:

1. Your script contains require 'var', right?
2. Did you enable 'Expand Variables' in the alias?
Amended on Mon 16 Jan 2023 12:52 PM by AdInfinitum
#2
AdInfinitum said:

A couple things to check:

1. Your script contains requires 'var', right?
2. Did you enable 'Expand Variables' in the alias?


I have expanded variables on the alias but I don't have Require var...what would that look like? in the send area or is that a click option?

Thank you for the quick response! i have this trigger that collects sends everything to notepad but having them auto-totaled up would be so much better.
Australia Forum Administrator #3
Rather than describing every aspect of your trigger, please copy/paste whole here, see:

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


That would have answered the questions AdInfinitum asks.

And if your script is in a separate script file (not strictly necessary, you can "send to script" and put the script inline) please also copy/paste the script file contents.




As for how to require something you put, for example:


require "var"


... at the start of your script code.
Amended on Sun 15 Jan 2023 01:40 AM by Nick Gammon
Australia Forum Administrator #4
There are examples of using "var" in this post:

http://www.gammon.com.au/forum/?id=4904&reply=6#reply6

That shows using the "require" statement.

Also, if you don't need to keep the counts over multiple sessions (you might) then simple Lua variables will do, they would reset each time you started the client.