Search found 27 matches

by electrifiedspam
Thu Jan 06, 2011 3:53 am
Forum: newLISP in the real world
Topic: Converting decimal to hexadecimal
Replies: 4
Views: 1939

Re: Converting decimal to hexadecimal

Johu,

Maybe I am over thinking it but would:

(define (hexs n (w 4)) (format (string "%0" w "X") n))

be better?

Thank you for the example.
by electrifiedspam
Mon Jan 03, 2011 12:31 am
Forum: newLISP in the real world
Topic: Converting decimal to hexadecimal
Replies: 4
Views: 1939

Re: Converting decimal to hexadecimal

Well,

That was more concise. I knew someone could do it. Thank you for sharing. The second part makes me feel better, because evidently there isn't a way to print hexadecimal.

Thank you for the response!
Chris
by electrifiedspam
Sun Jan 02, 2011 9:03 pm
Forum: newLISP in the real world
Topic: Converting decimal to hexadecimal
Replies: 4
Views: 1939

Converting decimal to hexadecimal

(define (to-hex number) (set 'answer '()) (while (> number 0) (cond ((> number 0) (set 'answer (append (list (hex-let (mod number 16))) answer)) (set 'number (/ number 16))) ((= number 0) (set 'answer (append (list (hex-let (mod number 16))) answer))) ) ) (join (map string answer)) ) (define (hex-le...
by electrifiedspam
Sun Jan 02, 2011 8:50 pm
Forum: newLISP in the real world
Topic: Modbus CRC
Replies: 1
Views: 990

Re: Modbus CRC

I chose a string of 1's and 0's simply so I would know what was going on and it was easy to print out all of the shifts and register manipulations so I could debug easier. granted that (^ 0xFFFF 0x11) turns out the same result as all of the cruft I had to go through but I went for a version that was...
by electrifiedspam
Sun Jan 02, 2011 8:45 pm
Forum: newLISP in the real world
Topic: Modbus CRC
Replies: 1
Views: 990

Modbus CRC

I figured out how to do it. I thought I would share. Mind you, this is the gross version so there is much optimization left to do, my goal was to get something that did the trick. Now I need to make it cleaner, but I thought that I would at least share. ----------------------------------------------...
by electrifiedspam
Tue Dec 28, 2010 5:11 pm
Forum: newLISP in the real world
Topic: Help with RS-232 comms
Replies: 2
Views: 1299

Re: Help with RS-232 comms

Please forgive me, I am so new and constantly over my head.

I see that the result symbol is only capturing true and not the message.
by electrifiedspam
Tue Dec 28, 2010 6:02 am
Forum: newLISP in the real world
Topic: Help with RS-232 comms
Replies: 2
Views: 1299

Help with RS-232 comms

When running the following code: ; Initialization (define (com-init) (exec "mode COM1 BAUD=9600 PARITY=O DATA=8 STOP=1")) ; Getting data from COM-port (define (start-listening) (local (hndl buff) (set 'hndl (open "COM1" "r")) (read hndl buff 40 (char 0x0D)) (close hndl) (int (-12 5 buff)))) (com-ini...
by electrifiedspam
Fri Dec 24, 2010 5:34 pm
Forum: newLISP and the O.S.
Topic: (+ newLISP Windows RS232)
Replies: 7
Views: 5355

Re: (+ newLISP Windows RS232)

I think I found the problem. The 'sec' in the CreateFile attribute was allowed to be null so I packed it as a null character like this: (constant 'sec (pack "nn" nill)) Below is the code that detected COM1. (constant 'FILE_SHARE_READ 0x00000001) (constant 'FILE_SHARE_WRITE 0x00000002) (constant 'OPE...
by electrifiedspam
Fri Dec 24, 2010 4:49 am
Forum: newLISP and the O.S.
Topic: (+ newLISP Windows RS232)
Replies: 7
Views: 5355

Re: (+ newLISP Windows RS232)

My ultimate goal is to write a modbus module for newlisp. My immeadiate goal is to find the comport. I know that I have com1, yet I can't find it. I found "this" code: ----------------------------------------------------------------- Return TRUE if the COM exists, FALSE if the COM does not exist Pub...
by electrifiedspam
Wed Dec 08, 2010 4:09 am
Forum: newLISP and the O.S.
Topic: Problems installing on Vista
Replies: 10
Views: 8877

Re: Problems installing on Vista

OK I read up on 'or'. According to what I read, it returns the first thing that is not nil. Emacs was already using the home variable and the others were set to other things left over from projects past... I edited the newlisp-edit.lsp and had it check the DOCUMENT_ROOT variable first. I set that va...
by electrifiedspam
Wed Dec 08, 2010 2:59 am
Forum: newLISP and the O.S.
Topic: Problems installing on Vista
Replies: 10
Views: 8877

Re: Problems installing on Vista

What should (env "NEWLISPDIR") return? I get "C:\\Program Files\\newlisp" which is where my directory is installed. -------------------------------------------------------------------------- (set 'userSettingsDir (string (or (env "APPDATA") (env "HOME") (env "USERPROFILE") (env "DOCUMENT_ROOT")) "/n...
by electrifiedspam
Wed Dec 08, 2010 2:53 am
Forum: newLISP and the O.S.
Topic: Problems installing on Vista
Replies: 10
Views: 8877

Re: Problems installing on Vista

When I run 'newlisp-edit' from the command line I get:

"Cannot find newlisp. Make sure that you typed the name correctly and try again."

Furthermore when I type in 'newlisp' into the terminal I get the standard "Newlisp is not recognized as a batch command...."
by electrifiedspam
Tue Dec 07, 2010 4:19 am
Forum: newLISP and the O.S.
Topic: Problems installing on Vista
Replies: 10
Views: 8877

Re: Problems installing on Vista

Rebooting didn't help.
by electrifiedspam
Tue Dec 07, 2010 4:19 am
Forum: newLISP and the O.S.
Topic: Problems installing on Vista
Replies: 10
Views: 8877

Re: Problems installing on Vista

Rebooting didn't help.
by electrifiedspam
Tue Dec 07, 2010 3:23 am
Forum: newLISP and the O.S.
Topic: Problems installing on Vista
Replies: 10
Views: 8877

Re: Problems installing on Vista

Well,
There was a C:\temp

AND I have changed the TEMP system and user variable to C:\temp. So far all to no avail. I will try a reboot but I am doubting that it will bring any changes.
by electrifiedspam
Sun Dec 05, 2010 11:24 pm
Forum: newLISP and the O.S.
Topic: Problems installing on Vista
Replies: 10
Views: 8877

Problems installing on Vista

I have installed newlisp on other vista computers without problems. How ever it does not seem to like installing on this one. I am running Vista. I download the installer and run it. I open the link on my desktop and the IDE starts. But I get ERR: No working directory found. Newlisp will not run in ...
by electrifiedspam
Sun Nov 28, 2010 6:16 pm
Forum: newLISP in the real world
Topic: Class instantiation
Replies: 5
Views: 1870

Re: Class instantiation

I changed: (define (addPt x y) (append (list (list x y)) (list (self 1)))) to (define (addPt x y) (setf (self 1) (append (list (list x y)) (list (self 1))) ) ) That seemed to do the trick. Now I can have player 1, 2, 3, 4, 5, 6, 7..... and the game state for that player follows the object. Any input...
by electrifiedspam
Sun Nov 28, 2010 6:04 pm
Forum: newLISP in the real world
Topic: Class instantiation
Replies: 5
Views: 1870

Re: Class instantiation

I am trying to understand foop. Given the class: ----------------------------------------------------------------------------- ;;obstruction class ;;This is an object that has a point and can return that point. (context 'OBS) (new Class) (define (OBS:OBS POINTS) (cons (context) POINTS)) ;;new constr...
by electrifiedspam
Sun Nov 28, 2010 11:05 am
Forum: newLISP in the real world
Topic: Class instantiation
Replies: 5
Views: 1870

Re: Class instantiation

I have read Lutz's paper again. I think that my hang up is that I need to think in functional terms. So storing anything in a class is a bad idea unless it is a true constant like 3.14. So a class is really just all of the rules and methods for handling the data. Anyway I just wanted to say that thi...
by electrifiedspam
Sun Nov 28, 2010 9:37 am
Forum: newLISP in the real world
Topic: Class instantiation
Replies: 5
Views: 1870

Class instantiation

I am a little confused. I can have a class -------------------------------- (context aClass) (new Class) (context 'MAIN) -------------------------------- now--- (set 'aClass:x 5) 5 (set 'foo aClass) (aClass) AND---- foo:x 5 So my question is, is it possible to instantiate a new class, or am I simply...
by electrifiedspam
Mon Nov 15, 2010 2:46 am
Forum: newLISP in the real world
Topic: gs:key-event
Replies: 9
Views: 2479

Re: gs:key-event

I have found a fix for the aforementioned problems.

I won't post the code again until I have some major revisions.

Thank you for your help
Chris
by electrifiedspam
Mon Nov 15, 2010 1:18 am
Forum: newLISP in the real world
Topic: gs:key-event
Replies: 9
Views: 2479

Re: gs:key-event

Well, this is as far as I have gotten so far. Problems: 1) Snake does not detect when it has hit itself. 2) 'Apples' can instantiate on the snake causing an effective end to game play. I just thought that you all would like to see how far I have come with your help. Thank you Chris -----------------...
by electrifiedspam
Sun Nov 14, 2010 10:13 pm
Forum: newLISP in the real world
Topic: gs:key-event
Replies: 9
Views: 2479

Re: gs:key-event

Is there a way in GS to get the color of a point on the canvas?

I was just going to check the colors in front of the head of the snake to know if there has been a collision.

Thank you.

Chris
by electrifiedspam
Sun Nov 14, 2010 5:24 pm
Forum: newLISP in the real world
Topic: gs:key-event
Replies: 9
Views: 2479

Re: gs:key-event

Thank you all. I have made it this far. Those examples helped my understand what was going on. Thank you again. Chris ---------------------------------------------------------------------------------------------------------------------- (set 'up 38) (set 'down 40) (set 'left 37) (set 'right 39) (set...
by electrifiedspam
Sun Nov 14, 2010 4:08 am
Forum: newLISP in the real world
Topic: gs:key-event
Replies: 9
Views: 2479

gs:key-event

Could anyone post something or point me to an example where this is in use?

I am trying to make a simple snake game and I can do all of it except tell when a certain key is pressed.

Thank you in advance for your help.

Chris