+Landsbanki Posted April 21, 2019 Posted April 21, 2019 I'm building a Top Trumps cartridge. I need to keep track of how many cards the player has and how many cards the non-player opponent has so I can structure the order of cards in each hand. One is a simple function of the other. So if the pack has 48 card and the player has 15 cards then the opponent has 48 minus15 cards. I'm using the Earwigo. I can't find a way of implementing this calculation. You can set a variable to be the same as another variable and you can increment by fixed amounts but what you don't seem to be able to do if increment by a function of a another variable. There is a function tab which I use a lot but I've not yet understood what the parameter x component of it is. The wiki for this section is still under construction. I'm wondering if this is something I can do using the function option. Any help would be gratefully received as at the moment I'm having to have two completely independent variables which is increasing the amount of code and also allows for increased chance of errors. Quote
+Tungstène Posted April 21, 2019 Posted April 21, 2019 (edited) In Earwigo, you can take advantage of the "Lua statement" to achieve this. Don't forget that you'll have to prefix your variables' names by "var_" (if you didn't change this in the cartridge's properties). For example, if your variables are named player_hand and opponent_hand, you could write this "Lua statement" : var_opponent_hand = 48 - var_player_hand Edited April 21, 2019 by Tungstène Quote
+Landsbanki Posted April 23, 2019 Author Posted April 23, 2019 Thanks for that. I've mot created any Lua statements yet so I don't know how to incorporate them into a cartridge. I think there's an Earwigo demo cartridge which uses author script so I'll upload that and see if I can work it out. Thanks for your help. Quote
+Landsbanki Posted April 23, 2019 Author Posted April 23, 2019 OK. I now see it's an option in the drop down menu. Nice and easy. Thanks for your help again. That's me sorted. I'll have to learn some Lua script and see what I can do with it as so far I've only explored what you can do with the drop down menu options. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.