Input() Function

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
qcgreywolf
Cave Troll
Posts: 43
Joined: Mon Dec 09, 2013 10:23 pm

Input() Function

Post by qcgreywolf »

Ladies and gentlemen,
Spoiler
[h:status=input(
"FireProtection|0|Amount of Fire Protection",
"AcidProtection|0|Amount of Acid Protection",
"ColdProtection|0|Amount of Cold Protection",
"ElectricityProtection|0|Amount of Electricity Protection",
"changeR|0|Change Resistances?|CHECK",
"FR|0|Fire Resistance|CHECK",
"AR|0|Acid Resistance|CHECK",
"CR|0|Cold Resistance|CHECK",
"ER|0|Electricity Resistance|CHECK")]
[h:abort(status)]
Using that little snipped of junk code as an example, can I have an entry box with a preexisting variable (read: Not a static value).

For example this box, when invoked, would bring up the input query to adjust your current energy protection values. I do not want to have to 'know' what the previous value was, I would like it to auto-fill.

Ex.
"FireProtection|FireProtection|Amount of Fire Protection",

Where FireProtection is the variable stored on a token for it's current Protection from Fire value lies.

Suggestions?

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

Re: Input() Function

Post by aliasmask »

I wouldn't recommend using the input variable to represent the actual token variable unless that token variable is hidden (ie, not a part of the token types properties). This is especially true with user entered data. That being said, you can do this:

Code: Select all

[h: abort(input(
   strformat("FireProtection|%{FireProtection}|Amount of Fire Protection|TEXT"),
   strformat("AcidProtection|%{AcidProtection}|Amount of Acid Protection|TEXT"),
   strformat("ColdProtection|%{ColdProtection}|Amount of Cold Protection|TEXT"),
   strformat("ElectricityProtection|%{ElectricityProtection}|Amount of Electricity Protection|TEXT"),
   "changeR|0|Change Resistances?|CHECK",
   "FR|0|Fire Resistance|CHECK",
   "AR|0|Acid Resistance|CHECK",
   "CR|0|Cold Resistance|CHECK",
   "ER|0|Electricity Resistance|CHECK"
))] 

qcgreywolf
Cave Troll
Posts: 43
Joined: Mon Dec 09, 2013 10:23 pm

Re: Input() Function

Post by qcgreywolf »

Thank you, Aliasmask!

That is exactly what I was looking for. Your help is always appreciated.

I am going to build in a couple lines of protection code and use a local variable to hold the inputs until they are at least verified to be realistic inputs. Once they are deemed plausible, then they will be copied over to the token.

I do generally agree that those human inputs need to be watched carefully :)

Post Reply

Return to “Macros”