Calling Properties with a Variable?

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
kirerellim
Kobold
Posts: 7
Joined: Sat Mar 29, 2014 11:51 am

Calling Properties with a Variable?

Post by kirerellim »

This is probably going to be very simple, so bear with me lol.

In my properties for a D&D 3.5 like campaign, I have Weapon1, WeaponToHIt1, WeaponDamage1. I have this repeated 2 more times with a number at the end (Weapon2, etr). I wanted to make one macro for ‘Equipping Weapons’ that allows you to pick which of the three you’re changing. I figured it would be as simple as asking for a variable for a number 1-3, then doing something like…

[Weapon+”WeaponNumber” = whatever]
[WeaponToHit+”WeaponNumber” = whatever1]
[WeaponDamage+”WeaponNumber” = whatever2]

However, this isn’t working >< Can someone tell me what I’m doing wrong and why?

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Calling Properties with a Variable?

Post by aliasmask »

You're close.

Code: Select all

[H: whatever = eval("Weapon"+WeaponNumber)]

kirerellim
Kobold
Posts: 7
Joined: Sat Mar 29, 2014 11:51 am

Re: Calling Properties with a Variable?

Post by kirerellim »

Actually, posting this and continuing my search through forum helped me find what I needed >< Like two minutes after I posted, I found a thread on page 6 or 7 talking about SetProperties. Though I'll have to look what Eval does because I've seen it mentioned a lot lol.

User avatar
Bone White
Great Wyrm
Posts: 1124
Joined: Tue Aug 23, 2011 11:41 am
Location: Cornwall, UK

Re: Calling Properties with a Variable?

Post by Bone White »

For reference, the opposite of eval is Wiki: set().

Post Reply

Return to “Macros”