RPTools.net

Discussion and Support

Skip to content

It is currently Thu Dec 14, 2017 12:59 am 






Reply to topic  [ 10 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Fri Jul 08, 2016 2:12 pm
Posts: 6
 Post subject: Puzzle Spellcraft/Potion Macro
PostPosted: Tue Jul 19, 2016 11:00 pm 
Hey guys :mrgreen:, anyone there could indicate me which way to go to develop a macro spells more or less with this idea:

Image

Where depending on a sequence that a button was pressed, a type of spell is cast, something perhaps as a array :shock: , if you understand me :lol:.

And following this idea a macro potions production:

Image

With perhaps a Drop down lists like this:

Image

where each space or square would have such a menu to which would add the item and the combination of the array would generate a potion at the end.
Thank ever since the attention, and I'm sorry for my English :oops:.


Last edited by Willbo on Sat Jul 30, 2016 5:42 pm, edited 1 time in total.

Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9427
Location: Netherlands
 Post subject: Re: Puzzle Spellcraft/Potion Macro
PostPosted: Wed Jul 20, 2016 1:56 am 
bit of work, but not too hard.

first one you can do with an html form where the 9 images are separate buttons each button with its own code e.g. 1,2,3,4,5 etc. and then a handler macro that each time a button is pressed it adds that number to stored number and if that sequence makes sense: spell, else nothing.
read the first link in my sig. check out 'forms tutorial' for the forms part.
storing the added numbers is best done on a lib:token property as thats accessible from any map.

the potions... i guess your on your way: dropdown list where you can choose OR if you want to go fancy: make each section a button which when pressed leads you to another html form with all ingredients (as button images) click one and your lead back to the original 'form' with the ingredient added: that is quite a hassle to build though!! but possible

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
 Offline
Kobold
 
Joined: Fri Jul 08, 2016 2:12 pm
Posts: 6
 Post subject: Re: Puzzle Spellcraft/Potion Macro
PostPosted: Wed Jul 20, 2016 10:26 am 
wolph42 wrote:
bit of work, but not too hard.

first one you can do with an html form where the 9 images are separate buttons each button with its own code e.g. 1,2,3,4,5 etc. and then a handler macro that each time a button is pressed it adds that number to stored number and if that sequence makes sense: spell, else nothing.
read the first link in my sig. check out 'forms tutorial' for the forms part.
storing the added numbers is best done on a lib:token property as thats accessible from any map.

the potions... i guess your on your way: dropdown list where you can choose OR if you want to go fancy: make each section a button which when pressed leads you to another html form with all ingredients (as button images) click one and your lead back to the original 'form' with the ingredient added: that is quite a hassle to build though!! but possible


Thank you friend :mrgreen: I'll break my head with it :oops: soon post my results or progress :lol: !!!


Top
 Profile  
 
 Offline
Kobold
 
Joined: Fri Jul 08, 2016 2:12 pm
Posts: 6
 Post subject: Re: Puzzle Spellcraft/Potion Macro
PostPosted: Mon Jul 25, 2016 5:32 pm 
After checking countless tutorials ...
I must point out how nope I'm hahhaha ....
I'm caught in a point in question ....
I can not turn the image buttons on a link - to take me to another place or performs an action based on an external macro - note these examples here:

Image

here in case I could not link the inventory to the same button, so nor could advance the spellcraft moreover:

Image

I checked quite html tutorials on image buttons but got nothing relevant besides these results and the fact that I am a novice in this area makes this even more frustrating ... but do not want to give up, I need either help to make progress on that excuse me and thank you.


Top
 Profile  
 
User avatar  Offline
Demigod
 
Joined: Sun Feb 25, 2007 11:53 am
Posts: 3782
Location: MD
 Post subject: Re: Puzzle Spellcraft/Potion Macro
PostPosted: Mon Jul 25, 2016 8:57 pm 
Willbo wrote:
I checked quite html tutorials on image buttons but got nothing relevant besides these results and the fact that I am a novice in this area makes this even more frustrating ... but do not want to give up, I need either help to make progress on that excuse me and thank you.

Take a look at macroLink.

So you could pull an image from a table like this:

Code:
[h: inventory.icon = strformat('<img alt = "Inventory" border = 0 src="%s" />', tblImage("CharacterSheet", 1))]

And your macrolink would look like this:

Code:
[r: macroLink(inventory.icon, "Inventory@Lib:Inventory", "", "", "")]

Clicking on the inventory image would launch the Inventory macro located on Lib:Inventory.

_________________
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."


Top
 Profile  
 
 Offline
Kobold
 
Joined: Fri Jul 08, 2016 2:12 pm
Posts: 6
 Post subject: Re: Puzzle Spellcraft/Potion Macro
PostPosted: Mon Jul 25, 2016 10:16 pm 
Full Bleed wrote:
So you could pull an image from a table like this:

Code:
[h: inventory.icon = strformat('<img alt = "Inventory" border = 0 src="%s" />', tblImage("CharacterSheet", 1))]

And your macrolink would look like this:

Code:
[r: macroLink(inventory.icon, "Inventory@Lib:Inventory", "", "", "")]

Clicking on the inventory image would launch the Inventory macro located on Lib:Inventory.



However only i had to add the id "impersonated" in order to correct the error
Error executing "getProperty": there is the impersonated token.

Code:
[r: macroLink(inventory.icon, "Inventory@Lib:Inventory", "", "", "impersonated")]


Thank :D :mrgreen: uuuhhhhhhhhuuuuuu ....
it works, it works ....

I had found this link:
http://lmwcs.com/rptools/wiki/macroLink
previously in my travels ...
however to be an apprentice in the matter, it was like looking at a page in Japanese :lol: , if you understand me hahahahahah

I will follow your tip now in macro spell casting will soon return with the results and when everything is working, i will posting the link to download it ok.

Thank :D :mrgreen: uuuhhhhhhhhuuuuuu ....
it works, it works hahahahaha....


Top
 Profile  
 
 Offline
Kobold
 
Joined: Fri Jul 08, 2016 2:12 pm
Posts: 6
 Post subject: Re: Puzzle Spellcraft/Potion Macro
PostPosted: Fri Jul 29, 2016 10:43 pm 
hi my friends !!! :lol:

Through trial and error, I walked up to this result:

https://drive.google.com/open?id=0B2DdvK4_HEK4dUJheVlPLTZnVTg

I used maptool-1.4.0.5

It is worth mentioning that there is still a lot I can not say whether this was the right way to do something and if it is, based on the evaluation of you, finish making possible combinations missing.
The example to posting has only horizontal combinations, still missing even if that way there that I did, which I'm sure must be outrageously wrong, but could not solve another hahahahaha mode, vertical and diagonal combinations.

I decided to post it anyway, so you can tell me how do you retrieve the value that is being add the tokem when preciona a sequence and so I click the button [submit/casting] he send this result to only chat instead the number itself a corresponding image of the table understand, tried to use the [getProperty] but it does not catch the number nor poco a related image.

Sorry for my bad english, I'm using google translator :oops: .


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9427
Location: Netherlands
 Post subject: Re: Puzzle Spellcraft/Potion Macro
PostPosted: Mon Aug 01, 2016 10:38 am 
ok I had a look at your campaign file and you're in the right direction, but not quite there. You have created a 'handler macro' per button. That is terribly inefficient. You should create ONE handler macro to which is activated when a button is pressed. Every button can have its own identifier and is passed on as an argument to the handler macro. The handler macro then roughly does this:

Code:
[storedSequence    = getLibProperty("storedSequence", "Lib:Spell")]
[
buttonPressed    = arg(0)]
[
newSequence    = listAppend(storedSequence, buttonPressed)]

[
spellActivated    = 1]
[switch(
newSequence):
    case "1, 2, 3": spell1();
    case "1, 8, 2": spell2();
    case "5, 4, 7": spell3();
    default:spellActivated = 0
]

[if(!
spellActivated), CODE:{
    [if(listCount(newSequence) > 3), CODE:{
        <!-- assuming spell sequence is max 3 characters, if more are pressed, it automatically resets -->
        [newSequence = ""]
        [ broadcast("That sequence does not exist")]
    };{}]
};{
    <!-- spell is activated, so reset the sequence -->
   [ newSequence = ""   ] 
}]

[
setLibProperty("storedSequence", newSequence, "Lib:Spell")]
<!--
 refresh the button panel with the already pressed buttons (hence passed on as argument newSequence). In case newSequence is "" all buttons will be 'unpressed' -->
[
macro("showSpellPanel@Lib:Spell"): newSequence]
  


something like that. This assumes that each spell is its own function, you can also use the code option in the switch statement and put the spell effect in that code block directly. Thats up to you.

This way you only need 1 macro with the form (which is created based on passed on arguments) and 1 macro handler which is always called when a button is pressed. It parses the argument and then automatically calls the 'form macro' again with the new sequence as argument.

note that i added a length check, you can leave that out (or not) and i didn't pay any attention to the last button (probly the 'activate spell') but this only means that you need to add that button identifier to the code in e.g. an if statement. (if that button is pressed, then get the sequence and check which spell it is, else just increase the sequence).

something like that.

edit:

here a working example of the 'showSpellPanel' macro:

Code:
[h: spellCasting = getLibProperty("storedSequence", "Lib:Spell")]
<!--
 a bit tricky, but this sequence creates variables fire=7, life=8, air=9 etc. -->
[
h:buttonList    = "submit,earth,death,ice,spirit,balance,physical,fire,life,air"]
[
h,count(10): set(listGet(buttonList, roll.count), roll.count)]
<!--
 even trickier: here 9 is added to those variables IF it exists in the sequence -->
[
h,foreach(num,spellCasting): set(listGet(buttonList, num), eval(listGet(buttonList, num))+9)]
[
h:balance]


<!---------------------------
  ACTIVE BUTTONS  ------------------------------>
[
dialog("Spellcraft"): {
    <h2 align="center"><u>CASTING YOUR SPELL</u></h2>
    <TABLE border = 1 bgcolor="black"  align="center"><form>
        <h3 align="center">
        &nbsp &nbsp    [r: macroLink(strformat('<img alt = "Fire" border = 0 src="%s" />', tblImage("SpellButtons", fire)),"spellHandler@Lib:Spell", "all", fire, "impersonated")] &nbsp
                    
[r: macroLink(strformat('<img alt = "Life" border = 0 src="%s" />', tblImage("SpellButtons", life)), "spellHandler@Lib:Spell", "all", life, "impersonated")] &nbsp
                    
[r: macroLink(strformat('<img alt = "Air" border = 0 src="%s" />', tblImage("SpellButtons", air)), "spellHandler@Lib:Spell", "all", air, "impersonated")] &nbsp
        
<br>
        &nbsp &nbsp [r: macroLink(strformat('<img alt = "Spirit" border = 0 src="%s" />', tblImage("SpellButtons", spirit)), "spellHandler@Lib:Spell", "all", spirit, "impersonated")] &nbsp
                    
[r: macroLink(strformat('<img alt = "Balance" border = 0 src="%s" />', tblImage("SpellButtons", balance)), "spellHandler@Lib:Spell", "all", balance, "impersonated")] &nbsp
                    
[r: macroLink(strformat('<img alt = "Physical" border = 0 src="%s" />', tblImage("SpellButtons", physical)), "spellHandler@Lib:Spell", "all", physical, "impersonated")] &nbsp
        
<br>
        &nbsp &nbsp [r: macroLink(strformat('<img alt = "Earth" border = 0 src="%s" />', tblImage("SpellButtons", earth)), "spellHandler@Lib:Spell", "all", earth, "impersonated")] &nbsp
                    
[r: macroLink(strformat('<img alt = "Death" border = 0 src="%s" />', tblImage("SpellButtons", death)), "spellHandler@Lib:Spell", "all", death, "impersonated")] &nbsp
                    
[r: macroLink(strformat('<img alt = "Ice" border = 0 src="%s" />', tblImage("SpellButtons", ice)), "spellHandler@Lib:Spell", "all", ice, "impersonated")] &nbsp
                
        
</h3>

        <h4 align="center">
        &nbsp &nbsp &nbsp[r: macroLink(strformat('<img alt = "Submit" border = 0 src="%s" />', tblImage("SpellButtons", 0)), "submit@Lib:Spell", "", "", "impersonated")]&nbsp &nbsp &nbsp
        
</h4>
    </form></TABLE>
}]

 


these two macros are the ONLY two you need to use the panel. beyond this you only need the handling of the spells themselves.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9427
Location: Netherlands
 Post subject: Re: Puzzle Spellcraft/Potion Macro
PostPosted: Mon Aug 01, 2016 12:17 pm 
I think im gonna use something similar for a game im designing so I though to take it to full length and get the core working. There are now three macros in total, minor incremental changes to what i posted before. but it entails all you need:

Code:
[h:'<!-- ---------------------------------- showSpellPanel ---------------------------------------------- -->']

[h: spellCasting = getLibProperty("storedSequence", "Lib:Spell")]
<!-- a bit tricky, but this sequence creates variables fire=7, life=8, air=9 etc. -->
[h:buttonList   = "submit,earth,death,ice,spirit,balance,physical,fire,life,air"]
[h,count(10): set(listGet(buttonList, roll.count), roll.count)]
<!-- even trickier: here 9 is added to those variables IF it exists in the sequence -->
[h,foreach(num,spellCasting): set(listGet(buttonList, num), eval(listGet(buttonList, num))+9)]
[h:balance]


<!---------------------------  ACTIVE BUTTONS  ------------------------------>
[dialog("Spellcraft"): {
   <h2 align="center"><u>CASTING YOUR SPELL</u></h2>
   <TABLE border = 1 bgcolor="black"  align="center"><form>
      <h3 align="center">
      &nbsp &nbsp   [r: macroLink(strformat('<img alt = "Fire" border = 0 src="%s" />', tblImage("SpellButtons", fire)),"spellHandler@Lib:Spell", "none", fire, "impersonated")] &nbsp
               [r: macroLink(strformat('<img alt = "Life" border = 0 src="%s" />', tblImage("SpellButtons", life)), "spellHandler@Lib:Spell", "none", life, "impersonated")] &nbsp
               [r: macroLink(strformat('<img alt = "Air" border = 0 src="%s" />', tblImage("SpellButtons", air)), "spellHandler@Lib:Spell", "none", air, "impersonated")] &nbsp
      <br>
      &nbsp &nbsp [r: macroLink(strformat('<img alt = "Spirit" border = 0 src="%s" />', tblImage("SpellButtons", spirit)), "spellHandler@Lib:Spell", "none", spirit, "impersonated")] &nbsp
               [r: macroLink(strformat('<img alt = "Balance" border = 0 src="%s" />', tblImage("SpellButtons", balance)), "spellHandler@Lib:Spell", "none", balance, "impersonated")] &nbsp
               [r: macroLink(strformat('<img alt = "Physical" border = 0 src="%s" />', tblImage("SpellButtons", physical)), "spellHandler@Lib:Spell", "none", physical, "impersonated")] &nbsp
      <br>
      &nbsp &nbsp [r: macroLink(strformat('<img alt = "Earth" border = 0 src="%s" />', tblImage("SpellButtons", earth)), "spellHandler@Lib:Spell", "none", earth, "impersonated")] &nbsp
               [r: macroLink(strformat('<img alt = "Death" border = 0 src="%s" />', tblImage("SpellButtons", death)), "spellHandler@Lib:Spell", "none", death, "impersonated")] &nbsp
               [r: macroLink(strformat('<img alt = "Ice" border = 0 src="%s" />', tblImage("SpellButtons", ice)), "spellHandler@Lib:Spell", "none", ice, "impersonated")] &nbsp
      <br>
      &nbsp &nbsp &nbsp[r: macroLink(strformat('<img alt = "Submit" border = 0 src="%s" />', tblImage("SpellButtons", 0)), "submitSpell@Lib:Spell", "", "", "impersonated")]&nbsp &nbsp &nbsp
      </h3>
   </form></TABLE>
}]



Code:
[h:'<!-- ---------------------------------- spellHandler (buttonPressed) ---------------------------------------------- -->']

[storedSequence   = getLibProperty("storedSequence", "Lib:Spell")]
[buttonPressed   = arg(0)]
[newSequence   = listAppend(storedSequence, buttonPressed)]
[broadcast(newSequence)]

[if(listCount(newSequence) > 3), CODE:{
   <!-- assuming spell sequence is max 3 characters, if more are pressed, it automatically resets -->
   [newSequence = ""]
   [broadcast("Sequence too long")]
};{}]

[setLibProperty("storedSequence", newSequence, "Lib:Spell")]
<!-- refresh the button panel with the already pressed buttons (hence passed on as argument newSequence). In case newSequence is "" all buttons will be 'unpressed' -->
[macro("showSpellPanel@Lib:Spell"): newSequence]
 
 


Code:
[h:'<!-- ---------------------------------- submitSpell () ---------------------------------------------- -->']

[storedSequence   = getLibProperty("storedSequence", "Lib:Spell")]
[switch(storedSequence), CODE:
   case "1, 2, 3": {
      [broadcast("You activated spell 123")]
   };
   case "1, 8, 2": {
      [broadcast("You activated spell 182")]
   };
   case "5, 4, 7": {
      [broadcast("You activated spell 547")]
   };
   default:{[broadcast("That sequence is unknown")]}
]

[setLibProperty("storedSequence", "", "Lib:Spell")]
<!-- reset the button panel -->
[macro("showSpellPanel@Lib:Spell"): ""]


ive tested them and it works.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
 Offline
Kobold
 
Joined: Fri Jul 08, 2016 2:12 pm
Posts: 6
 Post subject: Re: Puzzle Spellcraft/Potion Macro
PostPosted: Mon Aug 01, 2016 2:18 pm 
Quote:
"wolph42"


hahahahaha. My friend, I sure would take a two lives and a half to get this result, you really was amazing.

I had found html tutorials about the switch, but all my conversions resulted in errors, so ended up with this result posted.
Based on your code posted I will terminate and return with a link to download beauty

these days to think about it, to use their tutorials in [Bag of Tricks] with this idea and create something like a key to unlock a door or trap if the player press the correct sequence.

and I will make a skill tree, then when finished will post the file ok. Thank you for your attention.

and with that idea, I will make a skill tree, then when finished, will post the file ok. Thank you for your attention.

I am glad that my idea has given you a way to project future.


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 10 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