View unanswered posts | View active topics It is currently Thu Apr 18, 2024 2:30 pm



Reply to topic  [ 3 posts ] 
 Twxproxy script command: getChar? 
Author Message
Ensign
User avatar

Joined: Mon Dec 26, 2011 8:41 am
Posts: 206
Unread post Twxproxy script command: getChar?
So I finally found getCharCode, but now I'm looking for getChar. Adding a command to twx seems failry easy, although I guess I could just add the array to my scripts manually... is there already a better way than that? I tried experimenting with the char codes and I couldn't find a better way. If there isn't one, I wouldn't mind a command like getChar (edit: maybe getChar isn't the best name, but whatever people think it should be called is fine) :

script reference entry:
TwxProxy2.05 script Reference wrote:
getChar
Purpose: Get the single-character value for an ascii character code.
Syntax: getChar {int} resultVar
{int}: The integer to get the char for. It must be between 0 and 255.
resultVar: A variable to hold the character.
Notes: For more information on ASCII character conversions, look up 'ASCII chart' in an internet search engine.


In TwxProxy ScriptCmd.pas, something like this:
Code:
function CmdGetChar(Script : TObject; Params : array of TCmdParam) : TCmdAction;
var
  CharCode : Integer;
begin
  // CMD: getChar <int> resultVar

  ConvertToNumber(Params[0].Value, CharCode);

  if ((CharCode < 0) Or (CharCode > 255)) then
    raise EScriptError.Create('Bad integer');

  Params[1].Value :=  Char(CharCode);

  Result := caNone;
end;


Then in test script:
Code:
setVar $i 0
while ($i <= 255)
  getChar $i $char
  echo "*Char(" & $i & "): _" & $char & "_"
  add $i 1
end


Test script output:
Code:
Char(0): __
Char(1): __
Char(2): __
Char(3): __
Char(4): __
Char(5): __
Char(6): __
Char(7): __
Char(8): _
Char(9): _   _
Char(10): _
_
Char(11): _ _
Char(12): _ _
Char(13): _
_
Char(14): __
Char(15): __
Char(16): __
Char(17): __
Char(18): __
Char(19): __
Char(20): __
Char(21): __
Char(22): __
Char(23): __
Char(24): __
Char(25): __
Char(26): __
Char(27): _har(28): __
Char(29): __
Char(30): __
Char(31): __
Char(32): _ _
Char(33): _!_
Char(34): _"_
Char(35): _#_
Char(36): _$_
Char(37): _%_
Char(38): _&_
Char(39): _'_
Char(40): _(_
Char(41): _)_
Char(42): _*_
Char(43): _+_
Char(44): _,_
Char(45): _-_
Char(46): _._
Char(47): _/_
Char(48): _0_
Char(49): _1_
Char(50): _2_
Char(51): _3_
Char(52): _4_
Char(53): _5_
Char(54): _6_
Char(55): _7_
Char(56): _8_
Char(57): _9_
Char(58): _:_
Char(59): _;_
Char(60): _<_
Char(61): _=_
Char(62): _>_
Char(63): _?_
Char(64): _@_
Char(65): _A_
Char(66): _B_
Char(67): _C_
Char(68): _D_
Char(69): _E_
Char(70): _F_
Char(71): _G_
Char(72): _H_
Char(73): _I_
Char(74): _J_
Char(75): _K_
Char(76): _L_
Char(77): _M_
Char(78): _N_
Char(79): _O_
Char(80): _P_
Char(81): _Q_
Char(82): _R_
Char(83): _S_
Char(84): _T_
Char(85): _U_
Char(86): _V_
Char(87): _W_
Char(88): _X_
Char(89): _Y_
Char(90): _Z_
Char(91): _[_
Char(92): _\_
Char(93): _]_
Char(94): _^_
Char(95): ___
Char(96): _`_
Char(97): _a_
Char(98): _b_
Char(99): _c_
Char(100): _d_
Char(101): _e_
Char(102): _f_
Char(103): _g_
Char(104): _h_
Char(105): _i_
Char(106): _j_
Char(107): _k_
Char(108): _l_
Char(109): _m_
Char(110): _n_
Char(111): _o_
Char(112): _p_
Char(113): _q_
Char(114): _r_
Char(115): _s_
Char(116): _t_
Char(117): _u_
Char(118): _v_
Char(119): _w_
Char(120): _x_
Char(121): _y_
Char(122): _z_
Char(123): _{_
Char(124): _|_
Char(125): _}_
Char(126): _~_
Char(127): __
Char(128): _€_
Char(129): __
Char(130): _‚_
Char(131): _ƒ_
Char(132): _„_
Char(133): _…_
Char(134): _†_
Char(135): _‡_
Char(136): _ˆ_
Char(137): _‰_
Char(138): _Š_
Char(139): _‹_
Char(140): _Œ_
Char(141): __
Char(142): _Ž_
Char(143): __
Char(144): __
Char(145): _‘_
Char(146): _’_
Char(147): _“_
Char(148): _”_
Char(149): _•_
Char(150): _–_
Char(151): _—_
Char(152): _˜_
Char(153): _™_
Char(154): _š_
Char(155): _›_
Char(156): _œ_
Char(157): __
Char(158): _ž_
Char(159): _Ÿ_
Char(160): _ _
Char(161): _¡_
Char(162): _¢_
Char(163): _£_
Char(164): _¤_
Char(165): _¥_
Char(166): _¦_
Char(167): _§_
Char(168): _¨_
Char(169): _©_
Char(170): _ª_
Char(171): _«_
Char(172): _¬_
Char(173): _­_
Char(174): _®_
Char(175): _¯_
Char(176): _°_
Char(177): _±_
Char(178): _²_
Char(179): _³_
Char(180): _´_
Char(181): _µ_
Char(182): _¶_
Char(183): _·_
Char(184): _¸_
Char(185): _¹_
Char(186): _º_
Char(187): _»_
Char(188): _¼_
Char(189): _½_
Char(190): _¾_
Char(191): _¿_
Char(192): _À_
Char(193): _Á_
Char(194): _Â_
Char(195): _Ã_
Char(196): _Ä_
Char(197): _Å_
Char(198): _Æ_
Char(199): _Ç_
Char(200): _È_
Char(201): _É_
Char(202): _Ê_
Char(203): _Ë_
Char(204): _Ì_
Char(205): _Í_
Char(206): _Î_
Char(207): _Ï_
Char(208): _Ð_
Char(209): _Ñ_
Char(210): _Ò_
Char(211): _Ó_
Char(212): _Ô_
Char(213): _Õ_
Char(214): _Ö_
Char(215): _×_
Char(216): _Ø_
Char(217): _Ù_
Char(218): _Ú_
Char(219): _Û_
Char(220): _Ü_
Char(221): _Ý_
Char(222): _Þ_
Char(223): _ß_
Char(224): _à_
Char(225): _á_
Char(226): _â_
Char(227): _ã_
Char(228): _ä_
Char(229): _å_
Char(230): _æ_
Char(231): _ç_
Char(232): _è_
Char(233): _é_
Char(234): _ê_
Char(235): _ë_
Char(236): _ì_
Char(237): _í_
Char(238): _î_
Char(239): _ï_
Char(240): _ð_
Char(241): _ñ_
Char(242): _ò_
Char(243): _ó_
Char(244): _ô_
Char(245): _õ_
Char(246): _ö_
Char(247): _÷_
Char(248): _ø_
Char(249): _ù_
Char(250): _ú_
Char(251): _û_
Char(252): _ü_
Char(253): _ý_
Char(254): _þ_
Char(255): _


Edit: oh you can't see the nice chars I saw, here:
Attachment:
sstw.jpg
sstw.jpg [ 221.05 KiB | Viewed 4585 times ]


Wed Oct 02, 2013 6:25 pm
Profile ICQ
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1131
Location: Augusta, GA
Unread post Re: Twxproxy script command: getChar?
Off the cuff, how about setCharCode?
As in...
setCharCode $char 80

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


Thu Oct 03, 2013 10:04 pm
Profile WWW
Ensign
User avatar

Joined: Mon Dec 26, 2011 8:41 am
Posts: 206
Unread post Re: Twxproxy script command: getChar?
ElderProphet wrote:
Off the cuff, how about setCharCode?
setCharCode $char 80


Okay so
setCharCode $resultVar {int}

I guess that does make most sense. As long as it fits with existing convention... looking at the other commands I guess the $result variable can be anywhere in the command parm list.


Thu Oct 03, 2013 10:59 pm
Profile ICQ
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 6 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 STSoftware.