From WikiChip
mirc/commands/bset
< mirc‎ | commands
Revision as of 21:57, 5 July 2014 by PatrolBot (talk | contribs) (Bot: Automated text replacement (-<small>Note: Individual switches were not taken into consideration.</small> +))

The /bset command lets you assign specific ASCII values (or text) at a specific position. If the variable does not exists, a new binary variable will be created and zero-pad until <pos>. If <pos> exceeds the length of the variable, the variable will extend (by zero-padding the gap) to accommodate the new values.

Note: Important fact to remember about binary variables is that they are not limited to the local scope of the alias but instead they remain set until processing is complete. Thus it's possible to use the same binary variable within multiple aliases if they call each other during the same script execution.

Synopsis

/bset -c <&bvar> <pos> <asciivalue> [asciivalue ... asciivalue]
/bset -tc <&bvar> <pos> <string>

Switches

  • -t - Indicates a string is to be written instead of literal ASCII values
  • -c - Fills the binary variable with the string/ASCII values and truncates anything after it

Parameters

  • <&bvar> - The binary variable name to use/create
  • <pos> - The position to set the new ASCII values or the string
  • <asciivalue> - ASCII value to write
  • [asciivalue ... asciivalue] - Succeeding ASCII values to be written
  • <string> - The string to be written

Example

Alias Example {
  ;Create a binary variable set it to "This is fun!"
  bset -t &Example 1 This is fun!
 
  ;Print out the content of the variable
  echo -a $bvar(&Example, 1-).text
}

Binary variables have the advantage that they can be accessed from anywhere during the script execution.

Alias Example {
  ;Create a binary variable
  bset -t &Example 1 Hello There Bob.
  bb
}
Alias bb {
  ; Override that last part and truncate it 
  bset -tc &Example 7 Stranger!
  cc
}
Alias cc {
  ; print the value
  echo -a $bvar(&Example, 1-).text
}

This example shows how the variable gets zero-padded if <pos> is outside the size of the variable:

Alias Example {
  ; put 'd' as the 5th byte in &var
  bset &var 5 100
 
  ; will print: 0 0 0 0 100
  echo -a $bvar(&var, 1-)
 
  ; zero-pad bytes 6-9
  bset &var 9 0
  
  ; will print: 0 0 0 0 100 0 0 0 0
  echo -a $bvar(&var, 1-)
}

Compatibility

Added: mIRC v5.3

Added On: 13/12/1997


See also

v · d · e mIRC commands list

A /abook, /action, /add, /ajinvite, /alias, /aline, /ame, /amsg, /anick, /aop, /auser, /auto, /autojoin, /avoice, /away

B /background, /ban, /bcopy, /beep, /bindip, /bread, /break, /breplace, /bset, /btrunc, /bunset, /bwrite

C /channel, /clear, /clearall, /clearial, /cline, /clipboard, /close, /closechats, /closedccs, /closefserves, /closemsg, /cnick, /color, /colour, /comclose, /comlist, /commands, /comopen, /comreg, /continue, /copy, /creq, /ctcp, /ctcpreply, /ctcps

D /dcc, /dccserver, /dde, /ddeserver, /debug, /dec, /describe, /dialog, /did, /didtok, /disable, /disconnect, /dlevel, /dline, /dll, Template:mIRC/donotdisturb, /dns, /dqwindow, /drawcopy, /drawdot, /drawfill, /drawline, /drawpic, /drawrect, /drawreplace, /drawrot, /drawsave, /drawscroll, /drawsize /drawtext

E /ebeeps, /echo, /editbox, /else, /elseif, /emailaddr, /enable, /events, /exit

F /fclose, /filter, /findtext, /finger, /firewall, /flash, /flist, /flood, /flush, /flushini, /fnord, /font, /fopen, /fseek, /fsend, /fserve, /fullname, /fupdate, /fwrite

G /ghide, /gload, /gmove, /gopts, /goto, /gplay, /gpoint, /gqreq, /groups, /gshow, /gsize, /gstop, /gtalk, /gunload, /guser

H /hadd, /halt, /haltdef, /hdec, /hdel, /help, /hfree, /hinc, /hload, /hmake, /hotlink, /hop, /hsave

I /ial, /ialclear, /ialmark, /identd, /if, /ignore, /iline, /inc, /iuser

J /join

L /leave, /linesep, /links, /list, /load, /loadbuf, /localinfo, /log, /logview

M /maxdepth, /mdi, /me, /menubar, /mkdir, /mnick, /mode, /msg

N /noop, /notice, /notify

O /onotice, /omsg

P /pareline, /part, /partall, /pdcc, /perform, /play, /playctrl, /pop, /protect, /proxy, /pvoice

Q /qme, /qmsg, /query, /queryrn, /quit, /quote

R /raw, /registration, /reload, /remini, /remote, /remove, /rename, /renwin, /reseterror, /resetidle, /return, /returnex, /rlevel, /rline, /rmdir, /run, /ruser

S /save, /savebuf, /saveini, /say, /scid, /scon, /server, /set, /setlayer, /showmirc, /signal, /sline, /sockaccept, /sockclose, /socklist, /socklisten, /sockmark, /sockopen, /sockpause, /sockread, /sockrename, /sockudp, /sockwrite, /sound, /speak, /splay, /sreq, /strip, /switchbar

T /timer, /timestamp, /tip, /tips, /titlebar, /tnick, /tokenize, /toolbar, /topic /tray, /treebar

U /ulist, /unload, /unset, /unsetall, /updatenl, /url, /username, /uwho

V /var, /vcadd, /vcmd, /vcrem, /vol

W

X /xyzzy