Arrays, cleanup question.
Posted: Sun Mar 26, 2017 2:42 pm
I would like to thank everyone for the replies to my previous post found at viewtopic.php?f=204&t=13617. You have all been extremely helpful and kind, and I have followed your advice.
As I previously explained, BASIC was my first computer language, used on an Atari800xl. I've had to research things like string, int, bool, etc. The following question(s) has(have) to do with the use of arrays and variables to parse data and perform separate actions based on a true/false check.
Snippet A:
/declare x int local
/delay 1
/for x 1 to ${NetBots.Counts}
/consent ${NetBots.Client.Arg[${x}]}
/delay 1s
/next x
/return
Snippet B:
/varset Bot TRUE
/declare x int local
/for x 1 to ${NetBots.Counts}
/varset NBToon${x} ${NetBots.Client.Token[${x}, ]}
/echo ${NetBots[${NBToon${x}}].Name}
/next x
/return
Both of these are building arrays based on the Netbot plugin. Snippet A is intended to have everyone connected to Netbot consent to a rezz. Snippet B is intended to create an array so HP% can be monitored. But, there are some major differences between the creations of those arrays.
#1
My first question is whether or not it would be possible to modify those two snippets to then build an array based not on the NetBot plugin, but on the groupmember count itself. For instance, by the use of an array I want this command line:
Command Line A
/if ( ${Group.Member[5].PctHPs}<100) {
/casting "${fastheal}" ${fasthealgem} -maxtries|5 -targetid|${Group.Member[5]}
/gsay ${Group.Member[5]} has ${Target.PctHPs}%hp
} else {|||...
to function more like this command line:
Command Line B
/if (${NetBots[${NBToon${x}}].PctHPs}<=${healAt} {
/casting ${heal} gem${healGem} -maxtries|5 -targetid|${NetBots[${NBToon${x}}].ID}
/g Incoming << ${heal} >> for ${Target} ...
}
/return
Without using the NetBot plugin, I want to compile an array which uses the group member count and replaces the "5" in ${Group.Member[5]} with an "x" so as to make it more in line with ${NBToon${x}} in order to compact the script, and to use /next x before /return.
#2
I also would like to know if it is more appropriate to use brackets around the integer as it is in ${Group.Member[5]}[/1], because as you note in the variable with [i]${NBToon${x}} it has been enclosed in braces. Is the use of braces around the variable {x} proper language as compared to [x]?
#3
In Snippet B:, the following commands are present, which are not present in Snippet A::
/varset Bot TRUE
and
/varset NBToon${x} ${NetBots.Client.Token[${x}, ]}
What function do they serve, and in the second /varset line, does the blank space in [${x}, ]} following the comma have a default function?
#4
And my final question is, what's the appropriate syntax within:
/for x 1 to ${NetBots.Counts}
and:
/varset NBToon${x} ${NetBots.Client.Token[${x}, ]
If we replace the instances of "Netbots" with "Group.Member"?
Thank you very kindly for your assistance. I would like to actually learn how to script these things on my own with a little guidance rather than just be handed a functional macro, because in all honesty, I've never had as much fun playing EQ on live (started in Kunark, went to emu when GoD was released) or on any other emulator I've tried since I started working with MQ2.
I really want to get this pegged down because I'm about to take my rng(main), pal, clr, dru, shm, enc team through the actual progression: I'm getting the Kael armor, then the Kael armor upgrade at Shadowhaven and doing the automaton quests, then SSRA, so on and so forth. This server is chock full of quests and I want to be able to enjoy them ground-up, and I know that I am incapable of doing so unless I can peg down the above questions.
(As a side-note, I refused to cheese it with the AA's on the solo aura quest for Eustace and I will not proceed with it until I reach 300 tailoring. I'm currently at 286 skill, and I have enough components for 164 more Tae Ew packs. If you need a few, please hit me up in this thread or in-game.)
As I previously explained, BASIC was my first computer language, used on an Atari800xl. I've had to research things like string, int, bool, etc. The following question(s) has(have) to do with the use of arrays and variables to parse data and perform separate actions based on a true/false check.
Snippet A:
/declare x int local
/delay 1
/for x 1 to ${NetBots.Counts}
/consent ${NetBots.Client.Arg[${x}]}
/delay 1s
/next x
/return
Snippet B:
/varset Bot TRUE
/declare x int local
/for x 1 to ${NetBots.Counts}
/varset NBToon${x} ${NetBots.Client.Token[${x}, ]}
/echo ${NetBots[${NBToon${x}}].Name}
/next x
/return
Both of these are building arrays based on the Netbot plugin. Snippet A is intended to have everyone connected to Netbot consent to a rezz. Snippet B is intended to create an array so HP% can be monitored. But, there are some major differences between the creations of those arrays.
#1
My first question is whether or not it would be possible to modify those two snippets to then build an array based not on the NetBot plugin, but on the groupmember count itself. For instance, by the use of an array I want this command line:
Command Line A
/if ( ${Group.Member[5].PctHPs}<100) {
/casting "${fastheal}" ${fasthealgem} -maxtries|5 -targetid|${Group.Member[5]}
/gsay ${Group.Member[5]} has ${Target.PctHPs}%hp
} else {|||...
to function more like this command line:
Command Line B
/if (${NetBots[${NBToon${x}}].PctHPs}<=${healAt} {
/casting ${heal} gem${healGem} -maxtries|5 -targetid|${NetBots[${NBToon${x}}].ID}
/g Incoming << ${heal} >> for ${Target} ...
}
/return
Without using the NetBot plugin, I want to compile an array which uses the group member count and replaces the "5" in ${Group.Member[5]} with an "x" so as to make it more in line with ${NBToon${x}} in order to compact the script, and to use /next x before /return.
#2
I also would like to know if it is more appropriate to use brackets around the integer as it is in ${Group.Member[5]}[/1], because as you note in the variable with [i]${NBToon${x}} it has been enclosed in braces. Is the use of braces around the variable {x} proper language as compared to [x]?
#3
In Snippet B:, the following commands are present, which are not present in Snippet A::
/varset Bot TRUE
and
/varset NBToon${x} ${NetBots.Client.Token[${x}, ]}
What function do they serve, and in the second /varset line, does the blank space in [${x}, ]} following the comma have a default function?
#4
And my final question is, what's the appropriate syntax within:
/for x 1 to ${NetBots.Counts}
and:
/varset NBToon${x} ${NetBots.Client.Token[${x}, ]
If we replace the instances of "Netbots" with "Group.Member"?
Thank you very kindly for your assistance. I would like to actually learn how to script these things on my own with a little guidance rather than just be handed a functional macro, because in all honesty, I've never had as much fun playing EQ on live (started in Kunark, went to emu when GoD was released) or on any other emulator I've tried since I started working with MQ2.
I really want to get this pegged down because I'm about to take my rng(main), pal, clr, dru, shm, enc team through the actual progression: I'm getting the Kael armor, then the Kael armor upgrade at Shadowhaven and doing the automaton quests, then SSRA, so on and so forth. This server is chock full of quests and I want to be able to enjoy them ground-up, and I know that I am incapable of doing so unless I can peg down the above questions.
(As a side-note, I refused to cheese it with the AA's on the solo aura quest for Eustace and I will not proceed with it until I reach 300 tailoring. I'm currently at 286 skill, and I have enough components for 164 more Tae Ew packs. If you need a few, please hit me up in this thread or in-game.)