RPTools.net

Discussion and Support

Skip to content

It is currently Fri Nov 24, 2017 2:25 am 






Reply to topic  [ 5 posts ] 

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
RPTools Team
 
Joined: Thu Jun 01, 2006 1:05 pm
Posts: 5538
Location: Buffalo, NY
 Post subject: Identify which bar you currently are using switch it
PostPosted: Sat Aug 19, 2017 8:26 pm 
OK I have no idea how to approach this, but I am looking to write a macro to follow this logic:

If bar is currently green, then change it to red; if it is red, then change it to green.
(I use bars to specify Current HP)

Basically it will be used when a NPC/Monster changes loyalties or factions - one quick click and their bar switches to the other color that it isn't currently.

My guess is that this will only be a few lines of code, I just have no idea what code it would be.

Thanks in advance!

_________________
How to use my bundled artwork (MT1.3B60+): http://forums.rptools.net/viewtopic.php?f=8&t=11759


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7954
Location: Bay Area
 Post subject: Re: Identify which bar you currently are using switch it
PostPosted: Sat Aug 19, 2017 9:24 pm 
I you use one of the MT built in bars specifying 2 colors but since the border shares a color it's a bit odd looking so I recommend 2 images, 1 red bar, 1 green bar. Set increments to 2 and if you set the bar to 0, then it's one color and anything else like 1 then it's the other. So, lets call this bar RedGreen.

To toggle the bar color you do this:

Code:
[H: bar.RedGreen = 1 - bar.RedGreen]

_________________
Downloads:


Top
 Profile  
 
User avatar  Offline
RPTools Team
 
Joined: Thu Jun 01, 2006 1:05 pm
Posts: 5538
Location: Buffalo, NY
 Post subject: Re: Identify which bar you currently are using switch it
PostPosted: Sat Aug 19, 2017 10:57 pm 
I'm not sure if you misunderstood my question of it I just didn't understand your answer. :p

I already have bars that are fully functional with my damage/heading macros - I've been using them for years, what I want is a simple macro that will be smart enough to look at what color the token is currently is using (let's say it's red and half way ATM), and with the click of the macro button, it switches it to the other color.

Changes loyalty- it is no longer a damaged red bar (bad guy), it is a damaged green bar (now a good guy) (but the macro is also smart enough to change a green bar to a red, because it retrieves what its current color is and makes it the other)

Make better sense?

_________________
How to use my bundled artwork (MT1.3B60+): http://forums.rptools.net/viewtopic.php?f=8&t=11759


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7954
Location: Bay Area
 Post subject: Re: Identify which bar you currently are using switch it
PostPosted: Sat Aug 19, 2017 11:56 pm 
Do you have your red and green bars already or is it something you need to create?

Sounds like you have some visual that indicates allies and enemies. If it is a standalone image in bar format that only have 2 settings, green or red, then setting the bar value to 1 or 0 does the trick.

Now, if it's more complicated than than perhaps a health bar for allies and enemies where you need to turn one off and the other on setting the value from one to the other then it's just a matter of taking the value of one and setting to the other then turning off the first one.

All the bar functions can be found here: http://lmwcs.com/rptools/wiki/Category:Bar_Function

So, here is the pseudo-code I imagine from your description:

Code:
[H, if(isBarVisible("greenBar")), code: {
   <!-- set redbar to value of greenbar -->
   [H: bar.redBar = bar.greenBar]
   <!-- turn off greenbar -->
   [H: setBarVisible("greenBar",0)]
};{
   [H: bar.greenBar = bar.redBar]
   [H: setBarVisible("redBar",0)]
}]


If this doesn't give you a clue then perhaps screen shots or your campaign file are necessary.

_________________
Downloads:


Top
 Profile  
 
User avatar  Offline
RPTools Team
 
Joined: Thu Jun 01, 2006 1:05 pm
Posts: 5538
Location: Buffalo, NY
 Post subject: Re: Identify which bar you currently are using switch it
PostPosted: Sun Aug 20, 2017 1:42 pm 
That worked like a champ, thanks, AM!!

_________________
How to use my bundled artwork (MT1.3B60+): http://forums.rptools.net/viewtopic.php?f=8&t=11759


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 5 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 is 1 user online :: 0 registered, 0 hidden and 1 guest (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 1 guest





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

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman