Join us on Discord!
You can help CodeWalrus stay online by donating here.

Jarvis Artificial Intelligence

Started by alexgt, March 17, 2015, 09:45:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Snektron

The StrN (and PicN etc) are Static pointers. You can only assign them one time, because they get added to the program memory.
You can use the dynamic strings, but you'll have to get your own freeram area. There's a trick in axe you can use to gove variables
their own name though:

L1->°Name

where "Name" can be any string, and then you can use it like a regular variable :)

If you want to put individual characters into a string you have to use {StrN+index}, because StrN is only a static pointer.
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


CKH4

#91
Quote from: alexgt on March 25, 2015, 07:50:20 PM
Yeah that would be cool, I haven;t implemented the calculator feature yet but it will be in there soon!
Quote from: DJ Omnimaga on March 25, 2015, 03:28:38 AM
I like it. By the way do you use a Doors CS mouse routine or is it your own?
No I do not, can you help though - I just have it changing the pixels around the mouse sprite like:
If getKey(1)
Pt-Change(X,Y,Pic1)
Y+1->Y
Pt-Change(X,Y,Pic1)
End

So if you hover over an icon it looks all garbled up because it is just changing pixels but in Doors you can see the mouse clearly every where, how wold you do that in Axe?
I'd actually suggest clearing and redrawing the screen. The code would be.
[black mouse mask hex]->Pic1
[White of mouse picture hex

Repeat getKey(15) or whatever your loop is
.Draw stuff here
Pt-On(X,Y,Pic1
Pt-Change(X,Y,Pic1+8
.getKey stuff
DispGraphClrDraw
End
  • Calculators owned: TI-83+, TI-84+


alexgt

Thank you @Cumred_Snektron ! @CKH4 thanks but wouln't that lag? any way I will try it :)
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Snektron

IIRC you can also use pixel masks, but i don't really know how
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


alexgt

I attempted those with testing and I just came up with grayscale :(. maybe I can find a tutorial...
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

CKH4

You'd only run dispgraph^^r if you changed the mouse position.
  • Calculators owned: TI-83+, TI-84+


alexgt

And that would do all the pixel changing?

Y++
Pt-Mask(X,Y,Pic1)
dispGraph^^r
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Snektron

Okay so i've done a little reaseach for you on Pt-Mask()...
Basically, it's a picture, but with 2 bit per pixel instead of just 1.
The way this works is the bits on "layer 1" are on the first 8 bytes, and the ones on "layer 2" are on the 8 bytes behind.
If the combination of the two on a pixel make 0 it will be transparant, 1 will be white, 2 will be invert and 3 will be black.
Then, you can use Pt-Mask()^^r to draw to the main buffer only, so no grayscale.
i've shamelessly stolen DCS' mouse sprite as example, and used http://clrhome.org/pix/ to create a quick hex.
(just insert [80C0A09088D0A818][80C0E0F0F8F0B818] and put it on "axe mask" mode.
Now if i use

[80C0A09088D0A818][80C0E0F0F8F0B818]->Pic0
ClrDraw
For(I,0,47)
  VLine(I*2,0,63)    . draw some lines as background for testing transparent...
End
Pt-Mask(10,10,Pic0)^^r
DispGraph
getKey^^r

it will draw a mouse cursor, with black lines and everything inside the cursor white, while leaving
evenrything outside transparent (the weird gray-ish texture thing on ClrHome.org/pix).
Hope this helps! :)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


alexgt

#98
Oh, ok I was just using a single hex code. Thanks and a like :)

EDIT: Is that two "r"s in front of getkey^^r and Pt-Mask(10,10,Pic0)^^r ?
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Snektron

That's the single r modifier, but i don't know you to do it in CW, so i just type it how you would use it in Token :)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


alexgt

Yeah I do the same just like "^r" so I was confused! but thanks I didn't know that Pixel Scape had different modes!!! Thanks :) :)
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Snektron

  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


alexgt

How could you re-draw the pixels behind it?
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

CKH4

You wouldn't. The pointer would go on ^^r but I'm not sure if you can do overwrite for displaying multiple buffers. Otherwise you could redraw it every time which would be slower but take up less space. Its really up to you although I think redrawing it would be easier. What does the source look like for the drawing?
  • Calculators owned: TI-83+, TI-84+


Snektron

Quote from: alexgt on March 26, 2015, 01:32:12 AM
How could you re-draw the pixels behind it?


That's the magic: you don't have to :)
The pixels behind the transparent layer will stay how they are, though if you meanwhen you move the cursor, you just have to redraw the screen
or something (basically the same you did with your last cursor)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Powered by EzPortal