Jul. 20, 2018

Hello der,  Guest
Trader Name:
Password:
 | Home | Forum List | Active Threads | Search:
Page: of 1   
TWX Support > XOR broken?  
<< Thread >>
Subscribed:  
Farnsworth


Joined: Jan 2007

posted: 12/14/2007 at 08:23 PM Post #1

XOR:  Does it work?  Can I buy a clue for 200, Pat?

<blockquote>
$ssplanetmaker  # running planet maker
Script compilation error: Unknown command 'ýX', line 374 (PLANETMAKER.TS)
Script terminated: scripts\planetmaker.ts
</blockquote>

The offending line of code is
XOR  $x 1

I wanted to flip a bit, so I checked to see if there was an available xor command.  Low and behold, there is.  But I noticed this at the bottom of the script.html reference page:

"Notes: This command is used internally by the compiler to allow conditions to work properly. Its use in conventional scripting is almost unheard of."

"grep -i -r xor scripts" reveals that none of the scripts I have downloaded have use xor.

If you are passing by this post and all you have to say is, "Why don't you write a conditional statement?" or "There are other, not as fast ways to do this," thanks for the advice, but I've already taken it.  I'm just curious if I'm using the xor command improperly.

FYI, I'm running twxproxy under wine, so that certainly could be it as well.  If I had a windows machine, I'd test it out . . .
LoneStar


Joined: Jul 2006

posted: 12/15/2007 at 08:11 AM Post #2

It works. you're just not usng it right:

setVar $s TRUE
setVar $s $s xor TRUE
echo "*[" & $s "]*"

this will echo:

[0]


The help file doesn't document its use properly. would be nice if other logical operators where available for use; if i remember correctly, all variable values are stored as string values by TWX --so bitwise operations are pretty much out the window.

      [ Edited to cross a 'I' and dot a 'T' ]

edited by: lonestar on 12/15/2007 at 08:24 AM

The Joker's Always Smiling in Every Hand That's De

"why hello der matey! have a sit and buy me an ale, eh?" -- The Grimy Old Trader

The Grimy Trader is best viewed at 1024x768 resolution -- this page was generated in: 0.312 seconds.