Important note for game authors
This is an important follow-up for game author. I forgot one important point when I wrote my previous post:
When you switch to Python as a scripting language, make sure that you set the “octgnVersion” attribute on your game to “0.9” at least.
This is because:
- Your game wouldn’t run properly on 0.8 anyway;
- For the first time I am going to remove features (xml scripts) from OCTGN and break compatibility. For that reason, future OCTGN releases will be marked as incompatible with games requiring any version less than 0.9.
In other news the 0.9 update is now published.
Advertisement
Explore posts in the same categories: OCTGN.net
December 8, 2010 at 12:50 am
looks beautiful so far
Just 1 question though. I have the “draw a card” script below.
def draw(group = me.library):
if len(group) == 0: return
mute()
me.library.top().moveTo(me.hand)
notify(“{} draws a card.”.format(me))
Now, this script works fine when the mouse is over the library pile. However, it doesn’t work when the mouse is on another pile, or the table (in the last several OCTGN versions, this was possible). How do I get the script to tell OCTGN to allow the action in all zones?
December 8, 2010 at 8:26 am
I just opened a new board on the forum, which is going to be a better place to ask such questions:
http://www.octgn.net/forum/index.php?board=13.0
Regarding your question, it depends on what you mean by “work when the mouse is on another pile”.
Clearly, there’s an inconsistency between:
if len(group) == 0: return
Which checks whether the group you’re executing this action on is empty; and:
me.library.top().moveTo(me.hand)
Which always draws the top library card, whatever the group is.
I would either change the first line to:
if len(me.hand) == 0: return
If you want to always draw from hand; Or the second to:
group.top().moveTo(me.hand)
If you want to draw from the current group.
Please note that the .top() function is only available on piles. Although you could do that in all groups, including hand and table:
group[0].moveTo(me.hand)
(index 0 is the top of piles, leftmost card in hand and card with the lowest Z-index on the table)
Finally, if you want your action to be callable on the table, add two optional x,y parameters like this:
def draw(group = me.library, x = 0, y = 0):
If you have more questions, feel free to ask in the forum!
December 14, 2010 at 2:51 am
I don’t know if you’ve seen my bug ticket yet, but there’s a huge problem with the python shuffle code right now. If a player uses the shuffle action faster than OCTGN can process the shuffle, then all python actions lock up and the player can’t use any card or group actions until they reload OCTGN.
December 24, 2010 at 8:29 pm
Its been in dev for 5 years…. just get it done
January 7, 2011 at 9:39 pm
Jods, I just want to say how impressed I am is that you still are the watch on OCTGN.
Every now and then I visit this website to take a peek on the status. Curious when it will hit version 1.00 ….
good luck, and all the best for 2011!