|
jcmcbeth Beginner
Joined: 18 Sep 2008 Posts: 13 Location: Charlotte, NC
|
Posted: Wed Sep 24, 2008 2:07 pm
Weird #PICK behavior |
I have a button that build's the follow variable to pass to pick:
Code: |
p:Select a target:|o:1|"( 8220) Diamond :target Diamond "|"( 36) Cruiser m33 (Earth Sphere Coalition) :target Cruiser m33 (Earth Sphere Coalition) "|"( 9832) Gold :target Gold "|"( 27542) Jupiter :target Jupiter "|"( 36) Corvette m35 (Earth Sphere Coalition) :target Corvette m35 (Earth Sphere Coalition) "|"( 11262) Venus :target Venus "|"( 9) Mars :target Mars "|"( 6049) Gal-Mart :target Gal-Mart "|"( 36) Patrol Starfighter m52 (Earth Sphere Coalition) :target Patrol Starfighter m52 (Earth Sphere Coalition) "|"( 2860) Sol :target Sol "|"( 36) Corvette m48 (Earth Sphere Coalition) :target Corvette m48 (Earth Sphere Coalition) "|"( 13541) Luna :target Luna " |
Basically, what the problem i'm having is with these entries,
Code: |
"( 36) Cruiser m33 (Earth Sphere Coalition) :target Cruiser m33 (Earth Sphere Coalition)" |
What it does is it evaluates everything in the parenthesis for the command, so I get,
Code: |
target Cruiser m33 EarthSphereCoalition |
when I want,
Code: |
target Cruiser m33 (Earth Sphere Coalition) |
I'm not sure how to get around this.
This is the code i'm using,
Code: |
$targets = %dbitems(@targets);
$menuitems = "p:Select a target:|o:1";
$i = 1;
#LOOP %eval(%numitems($targets)/2) {
$menuitem = %format("(&6.0d) &s", %item($targets, %eval($i + 1)), %item($targets, $i));
$val = "target " %item($targets, $i);
$val = $menuitem ":" $val;
#ADDITEM $menuitems $val;
$i = $i + 2;
}
#PRINT $menuitems;
#PICK $menuitems; |
The variable $targets is a database variable with the ship names as keys and the distance as values. |
|
|
|
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Wed Sep 24, 2008 2:24 pm |
Code: |
$targets = %dbitems(@targets);
$menuitems = "p:Select a target:|o:1";
$i = 1;
#LOOP %eval(%numitems($targets)/2) {
$menuitem = %format("(&6.0d) &s", %item($targets, %eval($i + 1)), %item($targets, $i));
$val = "target " %item($targets, $i);
$val = $menuitem ":" %replace(%replace($val,"(","~("),")","~)");
#ADDITEM $menuitems $val;
$i = $i + 2;
}
#PRINT $menuitems;
#PICK $menuitems; |
This might work... no gaaruntees tho, untested. |
|
|
|
jcmcbeth Beginner
Joined: 18 Sep 2008 Posts: 13 Location: Charlotte, NC
|
Posted: Wed Sep 24, 2008 5:08 pm |
That's an idea, because I tried %quote() and i'm guessing that didn't work because it probably doesn't quote parenthesis.
I'll let you know. |
|
|
|
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Wed Sep 24, 2008 6:36 pm |
You'll havta find the exact spot its stripping out the parenthesis and do the replace then... Where I have it might be too late in the script...
|
|
|
|
jcmcbeth Beginner
Joined: 18 Sep 2008 Posts: 13 Location: Charlotte, NC
|
Posted: Thu Sep 25, 2008 10:06 pm |
The code you gave me worked.
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|