Creating a random list

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
Raileth
Cave Troll
Posts: 28
Joined: Fri Oct 12, 2012 5:09 pm
Location: Camberley, UK

Creating a random list

Post by Raileth »

Is there a way to create a random list in maptools, possibly using the table function. Effectivley I want to have a fixed list of descriptions and place them in a random order when I execute the macro.

In game terms for pathfinder what I want to do is be able to randomly list the things a character discovers about a creature when they identify it. e.g. special attacks, defences, resistances, immunities. however I want to randomise the order they are listed, as depending on their identify roll they may discover 1 or many of the creatures abilities.

I was hoping to put them in a table and then list the whole table when executing the macro, but have it displayed in a random order.

Thanks for your help in advance

Grant
Raileth

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Creating a random list

Post by Jagged »

Many ways you could do this, but simply by entering the data into a table, the table will take care of randomising the result every time you call it.

However if you want to avoid duplicates, you are going to have to do a bit more coding ;)

I would be inclined to have a field on each monster of "detectable attributes" and store the things as a Listof a JSON array. Then you could have one function that could be called on all monsters. If you wanted to get really advanced, you could make it callable from the players and then targeted on a monster ;)

The nice thing about JSON arrays is the shuffle command. So if you had all the items in a JSON, you could shuffle, determine how many items the player had discovered and then reveal the first X items from the JSON.

Let us know how you get on :)

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Creating a random list

Post by aliasmask »

Do you want to randomize the categories or that actual attributes to be revealed? I would make a json array of what you want randomized and use json.shuffle then reveal the listed items starting at the 0 index of the array. I was actually thinking of doing this myself. Perhaps have a list of property names, shuffle the list and based on the success reveal the property values.

Raileth
Cave Troll
Posts: 28
Joined: Fri Oct 12, 2012 5:09 pm
Location: Camberley, UK

Re: Creating a random list

Post by Raileth »

I was only looking at the categories, as im not planning on entering all of the individual creatures infor, effectively I wanted to list the categories the player had discovered, the reason for wanting the full list was if the forst category e.g. resistances, was not something the creature had, then id just move down the list to the next category.

I'll have a play with the json.shuffle command as that sounds like the solution.

Thanks for the super quick replies

Grant
Raileth

Post Reply

Return to “Macros”