Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ Arrays

Arrays

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Madrox   (40 posts)  Bio
Date Wed 01 Nov 2006 11:14 PM (UTC)
Message
Okay, so I've been talking to a friend, about making a healing system for a mud, Imperian. He uses LUA and has tables, I was wondering if there was a way to do something similar with arrays as there are tables in lua. Cause each spot of his table contains two variables. Is that possible with arrays, i've read the help files for them. But they only show examples for 1 peice of input into the array.
Top

Posted by Nick Gammon   Australia  (23,163 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 02 Nov 2006 01:38 AM (UTC)

Amended on Thu 02 Nov 2006 01:40 AM (UTC) by Nick Gammon

Message
See the post by Ksilyan in the thread:

http://www.gammon.com.au/forum/?id=6529

He shows how to do that (last post on the page).



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Madrox   (40 posts)  Bio
Date Reply #2 on Fri 03 Nov 2006 12:48 AM (UTC)
Message
Nooo, I ment in VB, can you store two variables in one "spot" of an array. Like "dogbreed age" being seperate vars.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #3 on Fri 03 Nov 2006 01:44 AM (UTC)
Message
Storing two variables in one "spot" is the same thing as a two-dimensional array where the first size is the number of "spots" (indices) you want and the second size is simply 2. So basically, you are creating a matrix, it's just a very simple matrix.

This is fairly easy to do in VB script. Let's say you want 10 pairs. You'd do:

Dim MyArray(10, 2)

then to get at a pair:

MyArray(1)

or a slot of the pair:

MyArray(1)(1)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Madrox   (40 posts)  Bio
Date Reply #4 on Thu 09 Nov 2006 12:52 AM (UTC)
Message
Okay, so once I get all teh data from a row, how do I seperate it?
Top

Posted by Nick Gammon   Australia  (23,163 posts)  Bio   Forum Administrator
Date Reply #5 on Thu 09 Nov 2006 06:04 AM (UTC)
Message
It would help us to answer these questions if you post an example of what you are trying to do.

"Seperate the data" is not a concept I am really familiar with, so if you post your code, it makes it clearer what you are doing.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Madrox   (40 posts)  Bio
Date Reply #6 on Tue 14 Nov 2006 05:10 AM (UTC)

Amended on Tue 14 Nov 2006 05:16 AM (UTC) by Madrox

Message
function CureHerbAff()
affn = 0
affp = 0
if (miscafftable[7].state) then
if AbleImm() then CureCyanide() end
end
for k in herbafftable do
if (herbafftable[k].state) then
affn = affn + herbafftable[k].affvalue
affp = affp + herbafftable[k].purgevalue
if ((AbleEat()) and (haveherb[herbafftable[k].cure])) then
CureEat(herbafftable[k].cure)
end
end
end
return affn
end


Basicly what that does in lua is read one line of a table or 1 line of an array in vb i soppose it would be. But I don't know how to duplicate it in vb, that's what I'm having trouble with.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


24,015 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.