Author Topic: New scripting in the next Lackey  (Read 3827 times)

Trevor

  • LackeyCCG Creator
  • Administrator
  • Hero Member
  • *****
  • Posts: 2589
    • View Profile
    • LackeyCCG
New scripting in the next Lackey
« on: September 16, 2012, 07:15:58 pm »
EDIT: This page is rather obsolete. See http://www.lackeyccg.com/forum/index.php?topic=2134.0

The new Lackey has some scripting that is optional and very easy to implement.
If you want to include scripting in your plugin, have one column of your card data file named "Script".
If a card has a script defined for it, the script will run when the card is put onto the table from anywhere.

I tried to keep the syntax short. Here are some examples:

CG4
This sets the number of green counters to 4.

N"This is a note."
This set's a note on the card to "This is a note."

S"Knight"x3
This spawns 3 "Knight" cards, which are typically tokens, but this also works with any kind of card.

F
This card enters play face-down.

R90
This card enters the table rotated 90 degrees.

I
This card enters the table flagged as "immune to turn all" effects.

H
This card enters the table hovering.

You can use multiple scripts if you separate them with a comma, such as
R90,CR3
That makes the card land on the table rotated 90 degrees and with 3 red counters on it.

Currently, these aren't mentioned in the log and they just happen. If anyone has suggestions on improvements, let me know.
« Last Edit: August 19, 2013, 10:00:05 pm by Trevor »

r0cknes

  • Guest
Re: New scripting in the next Lackey
« Reply #1 on: September 17, 2012, 09:19:18 am »
Wow this is great Trevor! Scripting is an excellent improvement! The only suggestion I could make is maybe a script that allowed cards to be dropped to a certain spot on the board, so plugin creators could quicken the pace of their games even further. I understand that not all screens have the same dimensions, so maybe these scripts could be combined with some plugininfo.txt information that separates the board into different sections.

For instance it can say the bottom right 1/3 of the board is named "Player Hero's" Then a script for all heros played could be to send them to that section. Maybe even make it like HTML aligns things. So not only will the card be sent to that section, but it will be ALIGNED BOTTOM LEFT which could push other cards over as well.

I am sure this will be difficult to do, and impossible for me to do given my limited knowledge of programming languages, however if possible down the line I think this would be a huge improvement.

billylee174

  • Guest
Re: New scripting in the next Lackey
« Reply #2 on: September 17, 2012, 06:03:16 pm »
Great news. I can suggest throwing dices (and coins). Like R62 (rolling 2 six-sided dices).
The downfall I found is that plugin makers need to be careful here, because depending on the game and card, sometimes actions can be taken BEFORE those dices are rolled.

Tragic

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • My Card / Board Game YouTube Channel
Re: New scripting in the next Lackey
« Reply #3 on: September 19, 2012, 08:32:28 pm »
heh, sweet.. and so it begins!!

Trevor

  • LackeyCCG Creator
  • Administrator
  • Hero Member
  • *****
  • Posts: 2589
    • View Profile
    • LackeyCCG
Re: New scripting in the next Lackey
« Reply #4 on: September 20, 2012, 01:37:00 am »
I'll need to think more about the playing cards to specific places on the table. That can be tricky because sometimes you just want to show a card or something like that. So far, the scripting I've implemented only affects the card itself, so there is less chance that unintentional interactions will mess up a game.

I'm not sure if scripting dice rolls and coin flips are worth it. I'll see what people think when I post the new version.

I also just added a Clone function.

I will be posting a trial version of the new Lackey in probably a day or 2. This will not be intended as a released lackey, and I'll post more about it soon.

r0cknes

  • Guest
Re: New scripting in the next Lackey
« Reply #5 on: September 20, 2012, 03:50:04 pm »
The more I thought of it, maybe scripting would be the wrong place to put such commands. Maybe you could have a card function such as "Move To" along with "Send to", or maybe even combine the two. Maybe that card function could allow placement on the board itself.

Another option, although I know this would be a major update, would to allow the game zones to be visible on the table, so that you do not have to scroll through the tabs of the different game zones. Keep the game zone tabs and let the plugin maker determine if he would like dictate where that game zone is on the board. I am thinking of LotR LCG as an example. When you want to play a card from the encounter deck it would just be convenient if it was placed in the proper portion of the board. Forgive me for I have left the topic a bit.

If you feel these are unnecessary features then so be it, for you are the Lackey Master!

 

yunari

  • Guest
Re: New scripting in the next Lackey
« Reply #6 on: September 27, 2012, 09:31:42 pm »
I think it would be good to include script.txt as the same way of listofcardsoundfiles.txt,  that would save a lot of time to import script to old database by adding line like this.
<scriptentry><script>R90</script><field>Text</field><eval>CONTAINS</eval><data>enters the battlefield tapped.</data></scriptentry>

Performer command from game zone to table did not trigger come into play with sound file in current lackey this might apply to script as well.

and I would like to see untap all on opponent phase because there are card that untap on opponent turn as well, some are untap on opponent turn instead of own turn.

Another option, although I know this would be a major update, would to allow the game zones to be visible on the table, so that you do not have to scroll through the tabs of the different game zones. Keep the game zone tabs and let the plugin maker determine if he would like dictate where that game zone is on the board. I am thinking of LotR LCG as an example. When you want to play a card from the encounter deck it would just be convenient if it was placed in the proper portion of the board. Forgive me for I have left the topic a bit.

If you feel these are unnecessary features then so be it, for you are the Lackey Master!

   I suggest add additional row of game zone would help. Because manipulate card in game zone is much more convenient. with 2 row of both zone that should enough to handle hand and mana zone without need to swapping and could track opponent discard and mana at the same time. and remember last user preference per plugin as well. So user would not restart and see all game zone start up with own hand and have to set them up again.

   and here are command that I frequently use in my script with lackey which maybe useful if implemented. All of them wrote with autohotkey

Code: [Select]
;move card to x,y grid if not occupied. If occupied it will search free area from right of that point.
;locate=0 would place card on next grid, locate=2 would place card next to old card without overlap it.
CardMoveAtSpace(x,y,locate)
{
global
if (py=x){
x:=px
}
Px:=FindSpaceRight(x,y)+locate
if (Px>0){
cardmove(XGrid_%PX%,YGrid_62,moveback)
}
py:=x
}

;If card not occupied at x,y grid it will drag and drop to that area. If card exist it will tap card on that area.
;Cursor will move back if cursor is under table which should be hand area. (always move back make it impratical to
;use this command to tap card multiple time.
;If tap=1 it will tap card after drag card to that area. Phantamasgoria use this method instead of sickness.
CardExecute(x,y,tap)
{
global
mousegetpos xpos,ypos
if (cardoccupied(x,y))
{
mousemove XGrid_%x%,YGrid_%y%
sleep 100
send !{click}
if moveback and ypos>ygrid_66 {
sleep delay/2
mousemove,xpos,ypos
}
}
else
{
mousegetpos,xpos,ypos
cardmove(XGrid_%x%,YGrid_%y%,0)
if tap
{
sleep 70
send !{click}
sleep delay+100
mousemove,xpos,ypos
}
}

}

   cardmoveatspace are use instead of tranfercard in lackey because of it send card to unpredictable destination on table that have a lot of card.

   card excute use define hotkey to put card to assigned destination and manage them without need to move cursor out of hand zone. Quite useful with game that have limited space. so they end up like this.
Code: [Select]
a:: cardexecute(10,49,1)

s:: cardexecute(22,49,1)
 
d:: cardexecute(34,49,1)

f:: cardexecute(46,49,1)

g:: cardexecute(58,49,1)

v::
if (cardoccupied(34,61)=0)
{
imagesearch Px,Py,0,0,1980,1200,StandByAce.bmp ;draw ace card
click %px%,%py%
sleep delay+150
if cardoccupied(27,46)
mousemove XGrid_27,YGrid_46 move ace to proper area
else if cardoccupied(40,46)
mousemove XGrid_41,YGrid_46 move ace to proper area
; sleep delay
}
cardexecute(34,61,1)
return
   V is quite long becuase it have to draw startup card with lackey tranfercard command. Then move draw card back to where it should belong to.
Code: [Select]
<generalfunction><label>Standby Ace</label>
<kind>TRANSFERCARD</kind>                 
            <sourceowner>performer</sourceowner>
<sourcegamezone>Ace</sourcegamezone>
<sourceposition>Top</sourceposition>                 
            <destinationowner>table</destinationowner>
<includeasbutton>yes</includeasbutton>
        </generalfunction>
   
So if tranfercard could assign position on table it could solve this command without need of script and this command would have seen much more use.

Code: [Select]
FindGrid(byref Px,byref Py)
{
Global
Px:=0
mousegetpos xpos,ypos
loop 67 {
Px:=Px+1
if (xpos<=Xgrid_%a_index%)
{

; msgbox Cursor are on X%Px% Y%Py% grid
break
}
}
Py:=0
loop 67 {
Py:=Py+1
if (ypos<=YGrid_%a_index%)
{
break
}
}
}
I could not work without know where my cursor are on which grid.

Trevor

  • LackeyCCG Creator
  • Administrator
  • Hero Member
  • *****
  • Posts: 2589
    • View Profile
    • LackeyCCG
Re: New scripting in the next Lackey
« Reply #7 on: September 28, 2012, 08:52:40 am »
Right now there is a function that moves a card from your hand to the empty space closest to your half of the center of the table.

It's a lot more difficult to play things to "areas" because those are often vaguely defined and things change based on the other cards on the table. Also, people want to have the freedom to organize things on the table the way they want to.

The problem is right now there are no clearly defined "areas" on the table per se. Even within the same plugin, different players will want to put cards in different parts of the table. If I implemented an "areas", it would force all players to adhere to that paradigm. I'm not sure that lack of choice is worth the potential convenience.

I'll give it some thought and see if I can get something that works. Still, the best way to do it is to drag and drop, but this doesn't work as well when people don't have a mouse (such as when someone is using a laptop without a mouse).

If I were do to it, I would have a plugin define different areas and those areas would have rules about what to do when a new card comes. And a card would know what area it belongs to. But even this is fraught with problems because some cards may not have a specific area or the area it gets played to changes based on the context. One problem with automation is, when it fails, that's worse than having no automation. That's why I want to slowly add more automation, but attempt to do it with things that are unlikely to screw things up.
« Last Edit: September 28, 2012, 09:01:37 am by Trevor »

Myridden

  • Guest
Re: New scripting in the next Lackey
« Reply #8 on: November 13, 2012, 05:55:09 pm »
Did this new Beta version ever get released?  The scripting functions sound very cool and would be perfect for a plugin I'm working on.

Halfwing

  • Guest
Re: New scripting in the next Lackey
« Reply #9 on: November 21, 2012, 11:21:46 pm »
What about bringing up a prompt to ask for a note, instead of automatically assigning one?

Good for cards that say something like "Choose one of the following: X, Y, or Z."

Trevor

  • LackeyCCG Creator
  • Administrator
  • Hero Member
  • *****
  • Posts: 2589
    • View Profile
    • LackeyCCG
Re: New scripting in the next Lackey
« Reply #10 on: July 08, 2013, 11:23:45 am »
What about bringing up a prompt to ask for a note, instead of automatically assigning one?

Good for cards that say something like "Choose one of the following: X, Y, or Z."
That's an interesting idea, but I think it tries to do something outside of the scope of (good) automation.

Automation is good for something that doesn't require player interaction, like a card coming into play with a known and specific amount of counters on it. If you don't need to decide how many and what kind of counters are added, they should be added automatically because that way there is a very little chance things will automate in an unintended way. And things are very likely to automate in an intended way, which is the whole point of scripts.

But when you talk about prompts automatically popping up, I don't think that helps in the same way that automatically setting counters does. You still need respond to the prompt, so what's the point of automating the dialogue? It's true that it might save you a mouse click, but it also may just annoy you if you didn't want to respond to the prompt. And there are lots of times where, because of the context of the game, it simply isn't needed to enter the prompt.

Trevor

  • LackeyCCG Creator
  • Administrator
  • Hero Member
  • *****
  • Posts: 2589
    • View Profile
    • LackeyCCG
Re: New scripting in the next Lackey
« Reply #11 on: July 08, 2013, 11:37:14 am »
I'm also thinking about an implicit script and an explicit script. Currently, all the scripts above are implicit scripts, since they are run automatically whenever a card is moved from a zone to the table. An explicit script would be one that you have to choose to run explicitly.

An example of a good card for an implicit script would be one that does only the following "Put a Knight Token into play". There is no thinking required, so it should just happen.

An example of a good card for an explicit script would be one that grants a permanent effect that says something like "When you pay 2, put a Knight token into play. Whenever you pay 4, put a Dragon Token into play." The latter card would actually require 2 explicit scripts. I think the best way to handle a card like this would be to have these explicit scripts only run from a right click menu where you select one of them. I guess you could also have some sort of key combination like "control+1" would do the first explicit script of selected cards and "control+2" would do the 2nd explicit script. This assumes the cards has explicit scripts defined for the selected card.