Author Topic: Create vars in a Parser Hook  (Read 3677 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Create vars in a Parser Hook
« on: April 19, 2011, 12:45:01 pm »
I am now trying to get BatLib to create variables like programs and that isn't much of a problem. The problem is that when creating programs or appvars, it throws an error, even if it successfully creates the var! So, I was wondering if there is a special method that I have to go about to create programs and whatnot... ?

Thanks in advance!

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Create vars in a Parser Hook
« Reply #1 on: April 19, 2011, 07:12:05 pm »
Can you give your code?

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Create vars in a Parser Hook
« Reply #2 on: April 19, 2011, 09:26:06 pm »
bcall(_closeEditEqu)

The edit buffer is probably open. If the hook intercepts from the homescreen then you need to close the edit buffer before you can do anything. When you are done, make sure to bcall(_jForceCMDNoChar) or else bad things will happen. Of course you'll have to watch for the cases where the hook is being run from a basic program, then you don't need to do bcall(_closeEditBuffer), and you most certainly don't what to do bcall(_jForceCMDNoChar)
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Create vars in a Parser Hook
« Reply #3 on: April 19, 2011, 09:29:40 pm »
bcall(_closeEditEqu)

The edit buffer is probably open. If the hook intercepts from the homescreen then you need to close the edit buffer before you can do anything. When you are done, make sure to bcall(_jForceCMDNoChar) or else bad things will happen. Of course you'll have to watch for the cases where the hook is being run from a basic program, then you don't need to do bcall(_closeEditBuffer), and you most certainly don't what to do bcall(_jForceCMDNoChar)

So is this not a consideration for creating strings?  I haven't had this issue when creating temporary strings

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Create vars in a Parser Hook
« Reply #4 on: April 19, 2011, 10:39:07 pm »
No, I have no issues with creating temporary strings or temp lists or any thing like that. Again, this is for BatLib, so it is during the parser hook that I have this problem and it is only when I create named vars that it has a problem. I have known for some time about this issue, I just haven't gotten around to tackling it :) The same code you would use in a program will not work in a parser hook to create vars, so I was just curious about what I had to do...

An example of code that won't work is:
Code: [Select]
ld hl,3         ;The size of the var to create
bcall(_CreateProg)
You can change the size or the bcall to another similar bcall and it has the same issue.

EDIT: Also, please note that it does make the program, it just throws a syntax error when the parser hook finishes

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Create vars in a Parser Hook
« Reply #5 on: April 19, 2011, 11:05:45 pm »
The same code you would use in a program will not work in a parser hook to create vars, so I was just curious about what I had to do...


Xeda, throw a bcall(_closeEditEqu) in front of your parser hook code and it will work fine. The problem is that there are 0 bytes of free ram because the home screen edit buffer is open. All of the problems you are having are caused by Err:Memory's.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Create vars in a Parser Hook
« Reply #6 on: April 19, 2011, 11:13:57 pm »
It isn't a memory error, it was a syntax error. I just tried it and again, it created the var, but threw a syntax error. That being said, I think I am going to check if I need to adjust the program counter because that might cause a problem.

EDIT: Yeah, that was the problem XD My problem is resolved just by readjusting a few pointers, but thanks much!
EDIT2: Wait, maybe not x.x New error with displaying the program menu after creating the program
EDIT3: So I checked calcsys and it seams that it is really messing with the vat entries, too x.x