About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 Register to post in forums, or Log in to your existing account
 

 Related 
Contents
Arrays
  %arrget
  %arrhigh
  %arrset
  Arrays
Function Reference
  %abs
  %additem
  %addkey
  %alarm
  %alias
  %ansi
  %array
  %arrget
  %arrhigh
  %arrset
  %ascii
  %average
  %begins
  %bitand
  %bitnot
  %bitor
  %bitset
  %bitshift
  %bittest
  %bitxor
  %btncol
  %btnenable
  %btnimage
  %case
  %char
  %charcomment
  %charnotes
  %class
  %clip
  %color
  %colorname
  %colorsyntax
  %comactive
  %comcreate
  %comget
  %comset
  %concat
  %copy
  %count
  %countlist
  %crtonl
  %db
  %dbget
  %dbitems
  %dbkey
  %dbkeys
  %dblist
  %dbmax
  %dbmin
  %dbvalues
  %dde
  %ddeclose
  %ddemacro
  %ddeopen
  %ddepoke
  %defined
  %delete
  %delitem
  %delkey
  %delnitem
  %destroom
  %dice
  %diceavg
  %dicedev
  %dicemax
  %dicemin
  %doorname
  %dups
  %ends
  %eval
  %exec
  %exp
  %expand
  %expanddb
  %expandlist
  %filesize
  %find
  %float
  %format
  %getglobal
  %grep
  %gsl
  %handle
  %hexcolor
  %hexnum
  %hexstr
  %htmldecode
  %htmlencode
  %iconstate
  %if
  %insert
  %int
  %inwalk
  %isfloat
  %iskey
  %ismember
  %isnumber
  %isvalue
  %item
  %json
  %lastdir
  %left
  %leftback
  %len
  %line
  %list
  %literal
  %look
  %lower
  %mapfilter
  %maplocked
  %mapquery
  %mapvnum
  %match
  %max
  %mcp
  %min
  %mod
  %mss
  %nextdir
  %nltocr
  %norm
  %null
  %number
  %numbuttons
  %numitems
  %numkeys
  %numparam
  %numrec
  %numrooms
  %numwords
  %numzones
  %packages
  %param
  %params
  %parsemode
  %parsenumbers
  %pat
  %pathcompress
  %pathexpand
  %pathfrom
  %pathreverse
  %pick
  %pop
  %portal
  %portalenabled
  %pos
  %pref
  %priority
  %prompt
  %proper
  %push
  %query
  %quote
  %random
  %read
  %ref
  %regex
  %remove
  %repeat
  %replace
  %replaceitem
  %reversedir
  %rgb
  %right
  %rightback
  %roomcol
  %roomcom
  %roomcontents
  %roomcost
  %roomdesc
  %roomexit
  %roomflags
  %roomid
  %roomint
  %roomkey
  %roomkind
  %roomlink
  %roomload
  %roommode
  %roomname
  %roomnote
  %roomnum
  %roomportal
  %roomvnum
  %roomzone
  %round
  %section
  %setglobal
  %sort
  %sql
  %sqldb
  %sqrt
  %state
  %stdev
  %string
  %stripansi
  %stripq
  %subchar
  %subregex
  %sum
  %switch
  %threadid
  %threadname
  %time
  %trigger
  %trim
  %trimleft
  %trimright
  %upper
  %url
  %vartype
  %viewrec
  %walk
  %walkactive
  %walkconfirm
  %walkmode
  %walkroom
  %window
  %word
  %write
  %yesno
  %zonename
  %zonenum
  %zonevnum
Related Links:
  %arrget
  %arrhigh
  %arrset
  #SHOWARR
  Arrays
%array [[cmud_%array]] 
array

Syntax: %array(values)

return an array filled with values. Only the #VAR command can store an array. You can also pass an array to any of the COM/OLE functions.

Examples:

#VAR a %array(1,2,3)

creates an array of 3 elements. The first element (element 0) has a value of 1, the second has a value of 2, etc.

#VAR a %array(1,"hello",3)

creates an array of 3 elements. The first element (element 0) has a value of 1, the second has a value of "hello", etc. Notice that you can mix both numbers and strings in the array contents.

#VAR cmud %comcreate("Zmud.Application")
#VAR ss
%comget(cmud,"CurrentSession")
#COM ss "CMUDCommand" 216 %array("varname","value")

ok, here's a tricky one. This is COM code. First we store a link to the COM Server "Zmud.Application", which is CMUD itself. Then we access the "CurrentSession" property of CMUD and store that session in ss; a shorter means to this would be to use the %session predefined variable. Then we execute the "CMUDCommand" method of the current session. The CMUDCommand method takes two arguments: the first is the command ID to use. These IDs are documented in the CMUD.INC file in the [url=\"http://www.zuggsoft.com/cmud/down.asp#Developer\"]Developer's Kit[/url]. ID number 216 corresponds to the #VAR command. The second argument for CMUDCommand is an Array of values to pass to the command. In this case, we pass an array with the elements "varname" and "value". So, this ends up executing: "#VAR varname value" which will create a variable in the current session.

Not a very practical example, but it *does* show how you use %array in a COM statement if you need it.
Viewer Comments [0 - Post your comments]

Jump to:  

© 2009 Zugg Software. Hosted by Wolfpaw.net