Web Interface to Token Properties: Difference between revisions
m (Conversion script moved page Web Interface to Token Properties to web Interface to Token Properties: Converting page titles to lowercase) |
m (Taustin moved page web Interface to Token Properties to Web Interface to Token Properties without leaving a redirect) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 34: | Line 34: | ||
Change this line: | Change this line: | ||
< | <syntaxhighlight lang="php"> | ||
$kwnplrs=array(“Blint”=>”10”, “Silom”=>”10”, “Enna”=>”10”, “RedClaw”=>”10”, “Goujin”=>”10”); | $kwnplrs=array(“Blint”=>”10”, “Silom”=>”10”, “Enna”=>”10”, “RedClaw”=>”10”, “Goujin”=>”10”); | ||
</ | </syntaxhighlight> | ||
To: | To: | ||
< | <syntaxhighlight lang="php"> | ||
$kwnplrs=array(“Bob”=>”10”, “Bill”=>”10”, “Jill”=>”10”, “Janet”=>”10”, “Thor the Destroyer”=>”10″); | $kwnplrs=array(“Bob”=>”10”, “Bill”=>”10”, “Jill”=>”10”, “Janet”=>”10”, “Thor the Destroyer”=>”10″); | ||
</ | </syntaxhighlight> | ||
Then the second line to change if you need or want to is for the data file it keeps. The webserver needs the permissions to write to this folder. | Then the second line to change if you need or want to is for the data file it keeps. The webserver needs the permissions to write to this folder. | ||
So if you want to change this to c:\temp. | So if you want to change this to c:\temp. | ||
Change this line: | Change this line: | ||
< | <syntaxhighlight lang="php"> | ||
$filename=”/tmp/mobs.txt”; | $filename=”/tmp/mobs.txt”; | ||
</ | </syntaxhighlight> | ||
To: | To: | ||
< | <syntaxhighlight lang="php"> | ||
$filename=”c:\temp\mobs.txt”; | $filename=”c:\temp\mobs.txt”; | ||
</ | </syntaxhighlight> | ||
That’s it for the web pages. | That’s it for the web pages. |
Latest revision as of 23:59, 3 May 2023
BearFather of the RPTools forums has put together some macros using the RESTful macro functions and some PHP web pages to provide a web interface into the tokens on a MapTool server. The following originally came from his blog page but has been edited and formatted slightly.
Introduction
This pack of macros and webpages will allow for tracking of hps and tokens through a website. With this system the webpage becomes the authority on hps. It allows players to pull up a website on their smart device and update their or their party members hps and to view the hps of the current mobs. The GM page will allow the GM to update any tracked tokens hps players and mobs. The actual values are displayed just percentages.
Requirements
You will need access to or be running your own web server with PHP support.
Files Needed
First you need to download the zip pack of files from BearFather's blog page linked above. Then unzip it to some convenient location.
In the root of the zip file you will find 4 php files:
- api.php(for macros)
- players.php(for players)
- gm.php(for gm)
- functions.php(the real code)
You need to place these on a web server and note the address. In my example my server address will be 192.168.1.25, and the path with be /dnd.
Also in the zip file is a folder named macros and inside that is a set of 5 text files containing macro code for each macro.
- add
- adjust
- delete
- reset
- update
These will be explained later.
PHP Web Pages
There are a couple of lines in functions.php
you will need to change to make it work for your environment.
First we need to set our players names so the pages know to separate them. and allow players to edit the values. Change the names to match the names on the tokens for your players. The number following the name is not important just some value will do. Format: “player name” => “10”
So if you want to add players with the names Bob, Bill, Jill, Janet, Thor the Destroyer.
Change this line:
$kwnplrs=array(“Blint”=>”10”, “Silom”=>”10”, “Enna”=>”10”, “RedClaw”=>”10”, “Goujin”=>”10”);
To:
$kwnplrs=array(“Bob”=>”10”, “Bill”=>”10”, “Jill”=>”10”, “Janet”=>”10”, “Thor the Destroyer”=>”10″);
Then the second line to change if you need or want to is for the data file it keeps. The webserver needs the permissions to write to this folder. So if you want to change this to c:\temp. Change this line:
$filename=”/tmp/mobs.txt”;
To:
$filename=”c:\temp\mobs.txt”;
That’s it for the web pages.
Changes to your MapTool Campaign
You will need a couple campaign settings setup for the macros to work and display the hitpoints.
First in Edit -> Campaign Properties -> Token Properties Choose your campaign settings you want to edit or create a new set(click “new” button). You will need two properties here. “HitPoints (HP)” and “MaxHP”
Next in Campaign Properties, choose Bars Create a bar named “HitPoints” and in “Show To:” select GM, Owner, and Everybody Else. Rest of the settings are up to you.
Now in Campaign Properties, choose States You will need to create two States. They are called “Bloodied” and “Dead”. You can assign images and the like to this but they need to exists.
Token Properties For each token to be used with this you need to give values to the new properties from the first step: HitPoints and MaxHP. Also in the token properties select “State” tab uncheck the hide button on the “HitPoints” bar.
This will have to be done for every token used. I have a macro for when I create a new token it asks it’s MaxHP and few other things for my campaign.
The Macros
In the file pack you will find 5 files, add, delete, adjust, reset, update. The first line in each of the macros need to be updated to your webserver address. ‘[h:webhost=”192.168.1.125″]’ is the line your looking to change. I have all these macros set as campaign macros.
- Add - This is the macro to add selected token(s) to the pool of tokens to be monitored.
- Delete - This will remove selected token(s) that 0 or below hps. (This will also remove them from the playing field, if you don’t want this to happen remove line 9.)
- Adjust - This allows you to adjust the hps of the selected token(s). Negative number to remove, positive will add.
- Reset - This will remove all know info of tracked tokens. Will blank the file that stores the mobs.
- Update - This will take the info from the website and update tokens in the playing field. I have this set to my next init macro, so when I switch init to the next token it will also update all tracked token hps and health bars.