Tarot System

Manni
Posts: 116
Joined: Tue May 31, 2011 9:00 pm

Tarot System

Post by Manni »

I'm completely new to scripting and I'm trying to script a Tarot system that draws the card, charges it, and then flings it at the target. As it is I can get the system to work up to when I target a player, but when I don't target a player I want the target to be the ground. I put together something I thought would work, but it is failing horribly. Also I'm trying to set this up so that when I use Hierophant it automatically sends my order to the player on balance recovery, but this isn't working either. Any Ideas?

NoRAd
Posts: 6
Joined: Thu Dec 02, 2010 12:16 pm

Re: Tarot System

Post by NoRAd »

I don't know what alias you're using to target the player, but if you can modify this to fit, I think it might work
Code: [show] | [select all] lua
if matches[2] == nil then tarotTarget = "ground" else tarotTarget = matches[2] end
or you could capture the card when you charge it and enable the triggers for either ground or targeted that way?


Edit: Whoops, forgot to put ground in quotes, Fixed

Edit2: possible regex for targeting alias: ^ttar ?(\d+|\w+)?$
Last edited by NoRAd on Fri Jun 03, 2011 11:38 pm, edited 2 times in total.

Manni
Posts: 116
Joined: Tue May 31, 2011 9:00 pm

Re: Tarot System

Post by Manni »

Thats exactly what I have but for some reason I can't get it to work.

Manni
Posts: 116
Joined: Tue May 31, 2011 9:00 pm

Re: Tarot System

Post by Manni »

alias:
Code: [show] | [select all] lua
^tarot (\w+)\s*(\w*)$

tarotTarget = matches[2]

if matches[3] == nil then
tarotTarget = "ground"
else
tarotTarget = matches[3]
end

send("outd "..matches[2])
send("charge "..matches[2])

enableTrigger("Throw")
trigger
Code: [show] | [select all] lua
send("fling " ..tarotCard " at " ..tarotTarget);
disableTrigger("Throw");

NoRAd
Posts: 6
Joined: Thu Dec 02, 2010 12:16 pm

Re: Tarot System

Post by NoRAd »

I think I see the problem. It looks like your regex was forcing a target. You also had matches[2] sent to tarotTarget and then used as the card. I was thinking you would have two aliases, one for targeting, and one to charge/fling.

Here's your version tweaked slightly.
Code: [show] | [select all] lua
^tarot (\w+) ?(\w+)?$

if matches[3] == nil then
tarotTarget = "ground"
else
tarotTarget = matches[3]
end

send("outd "..matches[2])
send("charge "..matches[2])

enableTrigger("Throw")
separate alias version (Slightly less typing in the heat of battle)
Code: [show] | [select all] lua
^ttar ?(\w+)?
if matches[2] == nil then tarotTarget = "ground" else tarotTarget = matches[2] end
Code: [show] | [select all] lua
^tarot (\w+)$

send("outd "..matches[2]..";charge "..matches[2])
enableTrigger("Throw")

Manni
Posts: 116
Joined: Tue May 31, 2011 9:00 pm

Re: Tarot System

Post by Manni »

Thank you, but it seems that the issue is with the trigger, it can't fetch tarotCard. I recently reloaded my program, and my script that did work no longer does... it's frustrating...

NoRAd
Posts: 6
Joined: Thu Dec 02, 2010 12:16 pm

Re: Tarot System

Post by NoRAd »

Ok, Add the line
Code: [show] | [select all] lua
tarotCard = matches[2][\lua] anywhere in your alias, or if you're using the two alias version I set up, put it in the one that pulls the card out and charges it.

Manni
Posts: 116
Joined: Tue May 31, 2011 9:00 pm

Re: Tarot System

Post by Manni »

I had already added that line to the alias... and the problem persisted... I'm not sure if it's a bug in 2.0 r5 or not

NoRAd
Posts: 6
Joined: Thu Dec 02, 2010 12:16 pm

Re: Tarot System

Post by NoRAd »

In the one you had posted before, you had matches[2] going to tarotTarget, you fixed that, right?

Another idea is setting tarotCard triggered with the line where you charge it.

Manni
Posts: 116
Joined: Tue May 31, 2011 9:00 pm

Re: Tarot System

Post by Manni »

Yes, I fixed that, I even used tarotCard to get the card from the deck and charge it... which worked, but Throw can not fetch the global variable

Post Reply