View unanswered posts | View active topics It is currently Fri Apr 24, 2026 1:15 am



Reply to topic  [ 4 posts ] 
 TWX Arrays 
Author Message
Lieutenant

Joined: Sat Mar 03, 2001 3:00 am
Posts: 592
Location: USA
Unread post 
I am having trouble understanding using arrays.

I would like to build an array holding all members of a predefined corp #. Id like it to just read the corp member listing to get the info. So if it asks what corp #, and I type "2" then it reads the corp list and grabs all names from corp 2.

Ive got something done up ill try to get it posted...obviously its not working but like I said I don't understand arrays much, at least not how to make them. I tried the scripting reference...its a little confusing on that command.


Wed Dec 15, 2004 3:07 am
Profile ICQ YIM WWW
Lieutenant

Joined: Sat Mar 03, 2001 3:00 am
Posts: 592
Location: USA
Unread post 
send "t d r"
waitfor "elp)?"
echo ansi_11 "**What Corp #? "
getconsoleinput $who
send "d l"
:corp_search
waitfor "-----------------"
settexttrigger 1 :corp_number
pause
:corp_number
setvar $corp ""
getword CURRENTLINE $corp 1
if ($corp = "")
goto :done_corp_search
elseif ($corp <> $who)
goto :corp_search
elseif ($corp = $who)
waitfor "Creation Date:"
settextlinetrigger 1 :member_line
pause
:member_line
gosub :killem
settextlinetrigger 1 :get_member
pause
:get_member
gosub :killem
getword CURRENTLINE $name 1
if ($name = "-----------------------------------------------------")
send "q"
goto :menu
elseif ($name = "Corp")
getword CURRENTLINE $name 4
end
setArray $members MEMBERS
setvar $members[$name] 1
goto :get_member


Wed Dec 15, 2004 3:11 am
Profile ICQ YIM WWW
Lieutenant

Joined: Sat Mar 03, 2001 3:00 am
Posts: 592
Location: USA
Unread post 
umm...the

gosub :killem

just goes to something like

:killem
killtrigger 1
killtrigger 2
etc
etc
return


Wed Dec 15, 2004 3:13 am
Profile ICQ YIM WWW
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post 
Well, there's a couple of ways you could arrange this array. Let's say you and I are on the target corp. You could have it arrayed like this:

$members[1] = "ElderProphet"
$members[2] = "PHX"

This would be good for certain circumstances, but you will probably just want to do a quick test to see if the guy who hit your fig is on that predefined corp. In that case, you just want to set the corp members to have a value of 1, so the array would look like this:

$members[ElderProphet] = 1
$members[PHX] = 1

Then, when the person hits a fig, you grab their name in a variable like $name, then do a check like this:

if ($members[$name] = 1)
goto :attack
end

You pretty much have it setup correctly, just loose the setArray line (setArray $members MEMBERS). The dynamic array will build automatically, and you only want to use a static array if you're dealing with lots of values, and know the quantity. Otherwise, you don't need to setArray.

+EP+

P.S. The index (the part inside the [] brackets) can be anything in a dynamic array, like we used [ElderProphet] and [PHX]. But in a static array, it must be between 1 and the size you set it at. It can't contain letters, numbers, symbols, and can't be zero, negative numbers, or decimals.

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Wed Dec 15, 2004 3:38 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: Google [Bot] and 37 guests


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by wSTSoftware.