Simple Catch Phrases and standard action Macro(s)

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
User avatar
kristof65
Dragon
Posts: 287
Joined: Tue Mar 31, 2009 9:48 pm
Location: Lakewood, CO

Simple Catch Phrases and standard action Macro(s)

Post by kristof65 »

I'm trying to create some simple macros with stock catchphrases or actions that I can attach to NPC tokens. This is for stuff that NPCs say or do often, like Robin saying "Holy Smokes, Batman", or Gary Coleman's "Watch you talking about Willis?", or Duncan McLeod removing another immortal's head. I'd also like to use it to quickly impersonate a token, then switch back to no impersonation.

I've got an idea for the basic flow and format of the macro, but can't figure out how to code much of it. The way it would work is when the macro button on the token is selected, a dialog would pop up allowing me to input a text line to represent what they were saying, or the action they are taking OR it would let me select one of the preprogrammed catch phrases or actions. It would then send that info to the chat window and close the dialog.

Couple of the things I can't figure out:

How to select between text entered from the input dialog versus pre-programmed selections

How to set the output to impersonate the token it's attached to and then back again EDIT: Hmm, ok, I think I figured this out. It seems that as long as the token is selected, a macro on it will "impersonate" it. Is that correct?

How to set chat output to emote vs impersonating a token.

I'm aware of the Speak For Me, Canned Speech and Message Manager drop in tokens, but these are more universal than what I'm looking to do.
Last edited by kristof65 on Fri Apr 08, 2011 12:57 am, edited 2 times in total.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Simple Catch Phrases and standard action Macro(s)

Post by aliasmask »

I made kind of a magic 8 ball lib just goofing around. It's dispenses more advice than perhaps catch phrases though. It has 77 phrases and they don't repeat for a set amount of tries. I think it's set at 10 right now.

http://forums.rptools.net/viewtopic.php?f=8&t=13463

User avatar
kristof65
Dragon
Posts: 287
Joined: Tue Mar 31, 2009 9:48 pm
Location: Lakewood, CO

Re: Simple Catch Phrases and standard action Macro(s)

Post by kristof65 »

aliasmask - thanks, I tried to look at your token to see what you did, but it won't open. I posted the error I got in your thread.

User avatar
kristof65
Dragon
Posts: 287
Joined: Tue Mar 31, 2009 9:48 pm
Location: Lakewood, CO

Re: Simple Catch Phrases and standard action Macro(s)

Post by kristof65 »

I figured out I can use getSpeech, getSpeechName, and saySpeech to store and build my list of canned speeches. That definitely makes things easier.

User avatar
mfrizzell
Dragon
Posts: 762
Joined: Sat Feb 13, 2010 2:35 am
Location: California

Re: Simple Catch Phrases and standard action Macro(s)

Post by mfrizzell »

Here is a piece from one of the tutorials I looked at when I first started using Maptools. I think it is pretty self evident.

Code: Select all

[Cry1 = "it's head is just what I've been missing."]
[Cry2 = "I need a pretty head"]
[Cry3 = "that's just what I need to complete my collection."]
[Cry4 = "look all of those things brought us new heads for our collection."]
[Num = 1d4]
[VariableName = "Cry" + Num]
[WarCry = eval(VariableName)]
-->
Gurrak looks hungrily at the party and announces, "{WarCry}"
DCI/RPGA# 7208328396 Skype ID mfrizzell77
Characters:
Strabor - Dwarf Avenger 5th Level
Tikkanan - Human Warlock 2nd Level
----------------------------------------------------
"People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs."

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Simple Catch Phrases and standard action Macro(s)

Post by aliasmask »

kristof65 wrote:I figured out I can use getSpeech, getSpeechName, and saySpeech to store and build my list of canned speeches. That definitely makes things easier.
Only problem with that is if you have a centralized token to hold the speeches, you can't be on a different map to access those speeches.

User avatar
kristof65
Dragon
Posts: 287
Joined: Tue Mar 31, 2009 9:48 pm
Location: Lakewood, CO

Re: Simple Catch Phrases and standard action Macro(s)

Post by kristof65 »

I don't want to use a centralized token - which is why I'm writing something instead of using one of the excellent resources like the Canned Speech or Message Manager tokens. In addition to using this macro for my NPCs, I want to offer it to my players so they can use it for their characters as well.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Simple Catch Phrases and standard action Macro(s)

Post by aliasmask »

In that case, I would just type the speeches in the speeches tab area. Have your macro get the number of speeches with Wiki: getSpeechNames() as a json and use json.length to get the size. Then use Wiki: roll() to get your random speech.

Code: Select all

[H: speeches = getSpeechNames("json")]
[H: numSpeeches = json.length(speeches)]
[R, if(numSpeeches > 0): randomSpeech = getSpeech(json.get(speeches,roll(1,numSpeeches)))]
Btw, here is my list of sayings. Keep in mind this was originally for a magic 8 ball:
||| Sayings |||

Code: Select all

1	You can, but you'll probably die.
10	Seek advice but use your own common sense.
11	It's better to give than receive.
12	A black cat crossing your path signifies that the animal is going somewhere.
13	A lot of people are afraid of heights. Not me. I'm afraid of widths.
14	You may delay, but time will not.
15	Procrastination is something best put off until tomorrow.
16	Everything is funny as long as it is happening to somebody else.
17	If you find yourself in a hole, the first thing to do is stop digging.
18	Being a hero is about the shortest-lived profession.
19	Chaotic action is preferable to orderly inaction.
2	If you don't, millions will die and it will be all your fault.
20	Diplomacy is the art of saying "Nice doggie" until you can find a rock.
21	Do the best you can, and don't take life too serious.
22	If Stupidity got you into this mess, then why can't it get you out?
23	Lettin' the cat outta the bag is a whole lot easier 'n puttin' it back in.
24	Never let yesterday use up too much of today.
25	People who fly into a rage always make a bad landing.
26	It is better to drink and be drunk than to never have been drunk before.
27	The best way out of a difficulty is through it.
28	Things ain't what they used to be and never were.
29	Worrying is like paying on a debt that may never come due.
3	Don't ask the barber whether you need a haircut.
30	You've got to go out on a limb sometimes because that's where the fruit is.
31	Avoid fruits and nuts: after all, you are what you eat.
32	My advice to you is get married: if you find a good mate you'll be happy; if not, you'll become a philosopher.
33	Don't be a vegetarian because you love animals; Be a vegetarian because you hate plants.
34	Sometimes the road less traveled is less traveled for a reason.
35	Love your enemies. It makes them so darned mad.
36	Kiss my shiny black ball.
37	Behind every damsel is a fire breathing dragon.
38	You have the right to remain silent. Anything you say will be misquoted and used against you.
39	Treat everyone the same, till you find out there an idiot.
4	Wise men don't need advice. Fools won't take it.
40	Why are you taking advice from me?  Nobody should take advice from me. I haven't got a clue about anything.
41	You're gonna die here, you know. Convenient.
42	You laugh at me because I'm strange. I laugh at you because you're stupid!
43	When ya got em' by the balls... their hearts and minds will follow.
44	I have the answer in my head. I just havent found it yet.
45	In a world of nonsense, everything something is, it isn't, everything it would be wouldn't, and everything it wasn't, was.
46	The most powerful position is on your knees.
47	Reality is an illusion created by lack of alcohol.
48	No Matter what you do there will be critics.
49	Death is instant. Pain will end. Glory is forever.
5	Advice is what we ask for when we already know the answer but wish we didn't.
50	The power to believe in yourself, is the power to change fate.
51	We must hang together, or surely we shall hang separately.
52	Do not envy the one you admire most, instead, try to make yourself one that can be envied.
53	The lesson is in the struggle, not in the victory!
54	Only those who can see the invisible can do the impossible!
55	You only live once, but if you live it right, once is enough.
56	The best man for a job is a woman.
57	Knowledge talks, wisdom listens.
58	If you do it you'll regret it, if you don't do it you'll regret it, either way your going to regret it, you might as well just do it.
59	Creating success is tough but keeping it is tougher.
6	Advice after injury is like medicine after death.
60	Some people walk in the rain, others just get wet.
61	All who wander are not lost.
62	Ashes to Ashes Dust-to-Dust, Life is short so Party We must!
63	Give up for a second and that is where you will finish.
64	When you reach the end of your rope, tie a knot in it and hang on.
65	Only those who dare to fail greatly can ever achieve greatly.
66	Money can't buy you happiness, but it sure can rent it.
67	Friends help you move. Real friends help you move bodies.
68	If you wish to live wisely, ignore sayings including this one.
69	You have a right to your opinions. Just nobody wants to hear them.
7	Ask a woman's advice, and whatever she advises, do the very reverse and you're sure to be wise.
70	If you want to look young and thin, hang around old fat people.
71	Never eat more than you can lift.
72	Being pessimistic makes you a less hopeful person, but almost always a correct one.
73	If it screams, it's not food... yet.
74	A closed mouth gathers no feet.
75	It's not whether you win or lose; it's how you place the blame.
76	Hard work never killed anybody, but why take the chance?
77	Where ever you go. There you are.
8	Advice is seldom welcome, and those who need it the most, like it the least.
9	Dying is a very dull, dreary affair. And my advice to you is to have nothing whatever to do with it.
	

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Simple Catch Phrases and standard action Macro(s)

Post by Azhrei »

Heh, cute list.

78. If a man says something in a forest and there's no woman around to hear him, is he still wrong?
79. Q: "How do you know women so well?" A: "I just think of a man and remove all reason and accountability."

8)

(That last one was paraphrased from Jack Nicholson's role in As Good As It Gets.)

User avatar
kristof65
Dragon
Posts: 287
Joined: Tue Mar 31, 2009 9:48 pm
Location: Lakewood, CO

Re: Simple Catch Phrases and standard action Macro(s)

Post by kristof65 »

I'm getting really frustrated with this. MT's macro language is such an unorganized mish-mash of various other things, I wind up getting pissed off every time I try to deal with anything beyond simple die rolls.

User avatar
kristof65
Dragon
Posts: 287
Joined: Tue Mar 31, 2009 9:48 pm
Location: Lakewood, CO

Re: Simple Catch Phrases and standard action Macro(s)

Post by kristof65 »

So I got this working:

Code: Select all

[H: speeches = getSpeechNames("json")]
[H: numSpeeches = json.length(speeches)]
[H: speechID = 0]

[h: input(
	"speechID | 0  | Speech No:")]

	
[R, if(numSpeeches > 0): randomSpeech = getSpeech(json.get(speeches,speechID))]
But what I'd like it to do is give me a list of the speeches so that I can select one via drop down list or radio button. I can't get that to work. I just don't know how to extract the info from the json.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Simple Catch Phrases and standard action Macro(s)

Post by aliasmask »

Code: Select all

[H: speechKeys = getSpeechNames("json")]
[H: numSpeeches = json.length(speechKeys)]
[H: output = ""]
[H, if(numSpeeches > 0), code: {
   [H: speeches = ""]
   [H, foreach(key,speechKeys): speeches = listAppend(speeches,replace(getSpeech(key),",",","))]
   [H: abort(input(strformat("speechNum|%{speeches}|Select Speech|LIST|SPAN=TRUE")))]
   [H, if(numSpeeches > 0): output = listGet(speeches,speechNum)]
};{}]
[R: output]

User avatar
kristof65
Dragon
Posts: 287
Joined: Tue Mar 31, 2009 9:48 pm
Location: Lakewood, CO

Re: Simple Catch Phrases and standard action Macro(s)

Post by kristof65 »

thanks alias. I wasn't even close, as I thought I had to be doing more with json specific commands.

And as for my little tantrum earlier - I do understand why the macro language is the way that it is. It doesn't make me like it any better, but I can forgive it since MT isn't a commercial product. I'll just have to deal with it, and hope 1.4 has a more cohesive structure.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Simple Catch Phrases and standard action Macro(s)

Post by aliasmask »

np. I'm probably going to use a version of this code for a new character of mine as well. He's a preacher and I want to have some verses ready to quote.

OrigSyn
Cave Troll
Posts: 28
Joined: Sun Feb 13, 2011 10:51 pm
Contact:

Re: Simple Catch Phrases and standard action Macro(s)

Post by OrigSyn »

aliasmask wrote:

Code: Select all

[H: speechKeys = getSpeechNames("json")]
[H: numSpeeches = json.length(speechKeys)]
[H: output = ""]
[H, if(numSpeeches > 0), code: {
   [H: speeches = ""]
   [H, foreach(key,speechKeys): speeches = listAppend(speeches,replace(getSpeech(key),",",","))]
   [H: abort(input(strformat("speechNum|%{speeches}|Select Speech|LIST|SPAN=TRUE")))]
   [H, if(numSpeeches > 0): output = listGet(speeches,speechNum)]
};{}]
[R: output]
This is elegantly BRILLIANT! Thanks, alias!
When all else fails, move a pawn.

Post Reply

Return to “Macros”