Caighan2008-01-13 16:59:11
Hello again. My friend and I are trying to develop a trigger or rather a set of triggers that will allow an empath to catch the module numbers of all modules and store them in variables for proper healing. I.E. the empath looks at GRID MODULES and then the number is stored for the command chair and the empath grid and the different turrets etc... We have this working fine until we get to having 3 turrets. We want the first in the list to go to variable turret1 and so on and so forth. problem we have had is they all go to turret one, we haven't been able to find a way to split them off into their appropriate variable. Right now we are playing around with an idea to add them to a database record or stringlist but other than adding them to those things we haven't been able to think of a way to pull them out properly every time. So long story short any help you could provide be it a whole new idea or just a simple function to use we would greatly appreciate it; because although we would undoubtedly figure it out in the long run your help would likely save us tons of time.
Thanks,
Caighan
Thanks,
Caighan
Anisu2008-01-13 17:53:37
my current (temporary) ship id system exists out of
 Â#T+ identifyship
grid modules
 Â
   Â^"chair(%n)" *
   Â#var chair %1
#gag
 Â
 Â
   Â^"turret(%n)"  *
   Â#if (@turnum == 1) {#var turret1 %1;#var turnum 2} {#if (@turnum == 2) {#var turret2 %1;#var turnum 3} {#if (@turnum == 3) {#var turret3 %1}}}
#gag
 Â
 Â
   Â1
   Â1
 Â
 Â
   Â^"orb(%n)"    *
   Â#var orb %1
#gag
 Â
 Â
   Â^"ramhead(%n)" *
   Â#var ramhead %1
#gag
 Â
 Â
   Â^"grid(%n)" *
   Â#var grid %1
#gag
 Â
 Â
   Â^"collector(%n)" *
   Â#var collector %1
#gag
 Â
 Â
   Â^(%n)h, (%n)m, (%n)e, *
   Â#var turnum 1
#T- identifyship
#say ship identified!
 Â
also if anyone has the ship VS ship and hitting mines trigger lines I would love getting them, I lost mine
CODE
 Â
grid modules
 Â
   Â
   Â
#gag
 Â
 Â
   Â
   Â
#gag
 Â
 Â
   Â
   Â
 Â
 Â
   Â
   Â
#gag
 Â
 Â
   Â
   Â
#gag
 Â
 Â
   Â
   Â
#gag
 Â
 Â
   Â
   Â
#gag
 Â
 Â
   Â
   Â
#T- identifyship
#say ship identified!
 Â
also if anyone has the ship VS ship and hitting mines trigger lines I would love getting them, I lost mine
Unknown2008-01-13 19:55:35
That's one way to do it, but I'd prefer to just #ADDITEM turrets %1 to store the three turrets in a string list and then access them with %item (or even a custom function to make the code more readable).
Anisu2008-01-13 20:15:14
QUOTE(Zarquan @ Jan 13 2008, 08:55 PM) 476645
That's one way to do it, but I'd prefer to just #ADDITEM turrets %1 to store the three turrets in a string list and then access them with %item (or even a custom function to make the code more readable).
would not of worked with my gui in zmud, which this code orignally came from
Unknown2008-01-14 13:27:45
I use %item on buttons in zMUD, and it works for me!
Tsakar2008-01-18 00:19:58
I wrote this for my catcher maybe it could help, it probably isn't as optimized as it could be, as I only wrote it recently
but it works just fine for quickly catching the important modules. I personally preferred having the turrets be able to
automatically grab their values from the record (which unfortunately makes it cmud only), just seemed cleaner to me.
"(%w)(%n)"
#if (%1 = "turret") {
#if (@turretcount = 3) {
#var turrets {}
#call %vartype(turrets,5)
#var turretcount 0
}
#if (@turretcount < 3) {
#addkey turrets "turret"@turretcount %2
#math turretcount @turretcount+1
}
}
#if (%1 = "chair") {
#var commandchair %2
}
#if (%1 = "grid") {
#var empathgrid %2
}
#if (%1 = "collector") {
#var energycollector %2
}
#if (%1 = "orb") {
#var shieldorb %2
}
#if (%1 = "cube") {
#var cloakcube %2
}
@turrets.turret0
@turrets.turret1
@turrets.turret2
---
Though a zmud friendly version using a string list instead of a cmud database record variable would be:
#if (%1 = "turret") {
#if (@turretcount = 3) {
#var turrets {}
#var turretcount 0
}
#if (@turretcount < 3) {
#call %additem(%2,@turrets)
#math turretcount @turretcount+1
}
}
#if (%1 = "chair") {
#var commandchair %2
}
#if (%1 = "grid") {
#var empathgrid %2
}
#if (%1 = "collector") {
#var energycollector %2
}
#if (%1 = "orb") {
#var shieldorb %2
}
#if (%1 = "cube") {
#var cloakcube %2
}
%item(@turrets,1)
%item(@turrets,2)
%item(@turrets,3)
but it works just fine for quickly catching the important modules. I personally preferred having the turrets be able to
automatically grab their values from the record (which unfortunately makes it cmud only), just seemed cleaner to me.
#if (@turretcount = 3) {
#var turrets {}
#call %vartype(turrets,5)
#var turretcount 0
}
#if (@turretcount < 3) {
#addkey turrets "turret"@turretcount %2
#math turretcount @turretcount+1
}
}
#if (%1 = "chair") {
#var commandchair %2
}
#if (%1 = "grid") {
#var empathgrid %2
}
#if (%1 = "collector") {
#var energycollector %2
}
#if (%1 = "orb") {
#var shieldorb %2
}
#if (%1 = "cube") {
#var cloakcube %2
}
@turrets.turret0
@turrets.turret1
@turrets.turret2
---
Though a zmud friendly version using a string list instead of a cmud database record variable would be:
#if (%1 = "turret") {
#if (@turretcount = 3) {
#var turrets {}
#var turretcount 0
}
#if (@turretcount < 3) {
#call %additem(%2,@turrets)
#math turretcount @turretcount+1
}
}
#if (%1 = "chair") {
#var commandchair %2
}
#if (%1 = "grid") {
#var empathgrid %2
}
#if (%1 = "collector") {
#var energycollector %2
}
#if (%1 = "orb") {
#var shieldorb %2
}
#if (%1 = "cube") {
#var cloakcube %2
}
%item(@turrets,1)
%item(@turrets,2)
%item(@turrets,3)