plz help me , the marco can not calculate the numbers

All about the macro plugin can be found in this forum. This forum is intended for the macro plugin only.

Moderator: Moderators

doraemonchihiro
Noob
Noob
Posts: 1
Joined: 12 May 2013, 03:34
Noob?: Yes

plz help me , the marco can not calculate the numbers

#1 Post by doraemonchihiro »

GM will ask me some questions like : figure out 12+45=?

Code: Select all

automacro calculate {
 console /figure out (\d+)+(\d+)/
 call b
 }

macro b {
 $num = $.lastMatch1
 $num2 = $.lastMatch2
 $result = @eval($num+$num2)
 do pm $.lastpm $result
 }
the reslut is 3 ........obviously incorrect.

according to this macro , make 1+2 =3 ....but i need to calculate 12+45 , and GM won't ask me like : 12 plus 45 ....


plz help me ~~~ thx a lot !!
glennlevi
Plain Yogurt
Plain Yogurt
Posts: 58
Joined: 19 May 2011, 00:40
Noob?: Yes

Re: plz help me , the marco can not calculate the numbers

#2 Post by glennlevi »

Dunno if this would work, but try this

Code: Select all

automacro calculate {
 console /figure out (\d+) + (\d+)/

 call  {
 $num = $.lastMatch1
 $num2 = $.lastMatch2
 $result = @eval($num+$num2)
 do pm $.lastpm $result
 }
 }
All I did was put spaces in between + signs, maybe the macro is for "figure out 12 + 45"?
iMikeLance
Moderators
Moderators
Posts: 208
Joined: 01 Feb 2010, 17:37
Noob?: No
Location: Brazil - MG

Re: plz help me , the marco can not calculate the numbers

#3 Post by iMikeLance »

/figure out (\d+) (?:\+|plus) (\d+)/