RPTools.net

Discussion and Support

Skip to content

It is currently Wed May 22, 2013 3:20 am 






Reply to topic  [ 8 posts ] 

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Dragon
 
Joined: Tue Aug 23, 2011 10:41 am
Posts: 773
Location: Cornwall, UK
 Post subject: Building "modular" combat macros.
PostPosted: Mon Apr 09, 2012 1:53 am 
Thanks a lot to aliasmask's help, I am now able to jump my macros between clients which helps my framework a lot. However now I'm starting to delve into the optional rules of Alternity, I'm realising more and more that I should build my combat macros with a modular design for buffs/debuffs etc. I have trialled an implementation of it in my delayed combat resolutions under a json object. I was wondering how those of you who implement a similar system do so. Do you apply temporary values to properties which are removed after specific rounds, or do you keep all things affecting the token in a json, to be analysed every time an action is performed?

Also, there is a part of the rulebook called "FX" which is basically, any custom rule you'd like to apply, from magic to advanced alien technology. It's a very open creation system, allowing anything from AD&D style spells to artificial intelligence controlled artefacts. Players and GMs can create their own FX (at the GMs behest), but I am getting the feeling more and more I'm going to have to run the entire framework based on a database of key variables (for example, what exp weight should be assigned to each part of the FX). Just looking for some input/feedback from others trying to implement a rather modular system like this.

Sorry for the useless explanation, my mind doesn't work very well in this instance.

EDIT:

To clarify, I'm making macros/UDFs to operate the repetitive and multi-use parts of the rule-set. All of the damage will now be applied through the same UDF, with parameters for ignoring armor or not, and how it displays, but the core working is all the same. It will produce output with tooltips for the chat. Before, I'd have huge macros (I think my longest was 1k lines or such), but now I'm having many smaller macros, which are called when required.

I can't see any drawback to using my macros this way, if anything it makes more sense now my brain is starting to comprehend the scope and depth i require for framework.

_________________
I'm working on adapting the Alternity game for MapTool, but it's on the back burner unless anyone shows any interest except for me. Current release & support thread: [Alternity] v0.2 *BETA*


Last edited by Bone White on Wed Apr 11, 2012 6:07 pm, edited 1 time in total.

Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Tue Aug 23, 2011 10:41 am
Posts: 773
Location: Cornwall, UK
 Post subject: Re: Building "modular" combat macros.
PostPosted: Wed Apr 11, 2012 5:12 pm 
Ok I'm working on this now, but I wanted to clarify something: json objects do not retain their order, is this correct?

_________________
I'm working on adapting the Alternity game for MapTool, but it's on the back burner unless anyone shows any interest except for me. Current release & support thread: [Alternity] v0.2 *BETA*


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Sep 11, 2007 6:31 pm
Posts: 5228
 Post subject: Re: Building "modular" combat macros.
PostPosted: Wed Apr 11, 2012 6:45 pm 
Bone White wrote:
Ok I'm working on this now, but I wanted to clarify something: json objects do not retain their order, is this correct?

Correct...

_________________
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 5305
Location: Bay Area
 Post subject: Re: Building "modular" combat macros.
PostPosted: Wed Apr 11, 2012 6:59 pm 
jfrazierjr wrote:
Bone White wrote:
Ok I'm working on this now, but I wanted to clarify something: json objects do not retain their order, is this correct?

Correct...

Well... depends on what you mean. They are not designed to maintain an order, but they do have an order. Using certain json functions will mix the order, but the basic get/set will maintain the order. So, the order in which keys are set, remain in the same position if it exists and appends if it doesn't. But if ordering or reordering is important, then building an array of keys associated with the json object is the way to go. I would avoid making an array of objects because of the system impact on execution speed.

_________________
Downloads:


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Tue Aug 23, 2011 10:41 am
Posts: 773
Location: Cornwall, UK
 Post subject: Re: Building "modular" combat macros.
PostPosted: Wed Apr 11, 2012 7:24 pm 
I was thinking about making my own "json object" using an array of a list e.g:

Code:
["Strength#10","Dexterity#12","Constitution#14"]


Using # as the list_seperator in list functions to do all the work for me, though it'd be slower than using a json object. Using a separate array of keys is a much smarter idea.

I'm glad that they maintain order if only using get/set (which is all I need to use) so I'll continue on using these, thankyou for the reply.

_________________
I'm working on adapting the Alternity game for MapTool, but it's on the back burner unless anyone shows any interest except for me. Current release & support thread: [Alternity] v0.2 *BETA*


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Sep 11, 2007 6:31 pm
Posts: 5228
 Post subject: Re: Building "modular" combat macros.
PostPosted: Wed Apr 11, 2012 7:30 pm 
Bone White wrote:
I was thinking about making my own "json object" using an array of a list e.g:

Code:
["Strength#10","Dexterity#12","Constitution#14"]


Using # as the list_seperator in list functions to do all the work for me, though it'd be slower than using a json object. Using a separate array of keys is a much smarter idea.

I'm glad that they maintain order if only using get/set (which is all I need to use) so I'll continue on using these, thankyou for the reply.


Don't count on it maintaining order!!! If you fall into that trap, you will be totally annoyed at some point in the future.

_________________
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 5305
Location: Bay Area
 Post subject: Re: Building "modular" combat macros.
PostPosted: Wed Apr 11, 2012 7:55 pm 
I use a modified Wiki: json.sort() to accommodate sorting json objects. But jfrazierjr is right. You shouldn't count on json objects being ordered, because that's not a part of their function. Just be aware if things fall out of order, this could be the reason why. But my opinion is, if this is simply ordered for output's sake and you're not indexing anything, it's no big deal. Also, if it's a structure where you add elements and you wish to reorder them a json object isn't the most efficient way. I haven't actually created a json object that I needed to sort, but I still have this function laying around if I feel so inclined.

Code:
@@ @json.sort
[H: data = arg(0)]
[
H, if(argCount() >= 2): direction = arg(1); direction = "a"]
[
H, if(json.isEmpty(direction)): direction = "a"; direction = substring(lower(direction),0,1)]
[
H, if(json.type(data) == "OBJECT"), code: {
   [H: keys = oldFunction(json.fields(data,"json"),direction)]
   [H: newObj = "{}"]
   [H, foreach(key,keys): newObj = json.set(newObj,key,json.get(data,key))]
};{
   [H: counter = 0]
   [H: args = ""]
   [H, foreach(arg,macro.args), code: {
      [H: args = listAppend(args,"arg"+counter)]
      [H: set("arg"+counter,arg(counter))]
      [H: counter = counter + 1]
   }]
   [H: newObj = eval(strformat("oldFunction(%{args})"))]
}]
[
H: macro.return = newObj]

!!
 

_________________
Downloads:


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Tue Aug 23, 2011 10:41 am
Posts: 773
Location: Cornwall, UK
 Post subject: Re: Building "modular" combat macros.
PostPosted: Wed Apr 11, 2012 9:11 pm 
Basically, all I'm doing is making tooltips for combat using an alteration of "the community"'s tooltip from json object macros. It'd be nice if the order was kept as I supplied it, but it's not that troublesome. To be honest, to achieve what I require and to maintain order, it'd be easier to just list as an array: [Index1,Value1,Index2,Value2] and output to the tooltip in that way. If I experience problems in the future I know I'll be doing that.

I was almost tempted to keep this as an array of objects, simply to help with formatting individual lines (I'll sometimes want a sub total, followed by more values, with a grand total, but I'll jump that hurdle when I come to it.) This screenshot should give you an idea of my progress.

Attachment:
tooltip1.jpg
tooltip1.jpg [ 283.73 KiB | Viewed 199 times ]

_________________
I'm working on adapting the Alternity game for MapTool, but it's on the back burner unless anyone shows any interest except for me. Current release & support thread: [Alternity] v0.2 *BETA*


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 8 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 0 users online :: 0 registered, 0 hidden and 0 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 0 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman