Set System Variable in a program - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Set System Variable in a program (/thread-3210.html) |
Set System Variable in a program - Angus - 02-27-2015 05:56 AM Apparently I am stuck again and need help.... When in RPN I can change Base Variable as follows: 2 'Base' ► The only question I have HERE is why 2 is still resident on the stack. Is Base being evaluated after storing and can I turn that off? However in a program I encountered serious difficulties with the above. Part of my user keyboard is the following Code:
What I tried to do is set Base to the corresponding value in CASE1..3 instead of the 'base_active' variable. I just can't get it to work... Is it too simple to see atm? So can anybody help here? I remember someone (was it TW?) explained a non-cas program being executed in home Mode. So if you are able to store it in HOME, a program should be, too. Tahnk you very much suggestion: RETURN(30) at the end of a program seems to be still broken. I can't imagine why the people at HP don't see the beauty and the need of having something like above evaluated instantly, but returning ENTER would be, if working, a way to try. RE: Set System Variable in a program - retoa - 02-27-2015 06:37 AM By doing 2 'Base' ► you store the value 2 in the variable 'Base'. When you store a value in a variable it will remain on the stack, this is a normal behavior in RPN. reto RE: Set System Variable in a program - Angus - 02-27-2015 07:22 AM yes, but since there are no stack commands (afaik) like drop I was wondering if it could be avoided. At least when the programming issues are solved I expect that to be the next problem otherwise. ;-) In the case of my Program I could avoid that, but I want to get to a level where I am the master of my calculator. RE: Set System Variable in a program - Didier Lachieze - 02-27-2015 07:31 AM In programming mode you cannot use RPN notation, so instead of: Code: IF btn=4 THEN 3 'Base' ► ; Code: IF btn=4 THEN Base:=3; RE: Set System Variable in a program - Didier Lachieze - 02-27-2015 07:59 AM (02-27-2015 07:22 AM)Angus Wrote: yes, but since there are no stack commands (afaik) like drop I was wondering if it could be avoided.In RPN mode acts as drop. RE: Set System Variable in a program - Angus - 02-27-2015 08:42 AM I didn't know that ja can mix non-rpn assignments. Wenn invoking functions their rpn notation is needed. Like with r->b(). I will dig into that, thanks. Well, backspace acts as drop, however the main questin is about programming. I was initially under the impression that I have to use rpn notation for assignments (calling functions do) which would result in 2 on the stack. Then I would have needed a drop() command. Not a key. If assignments can ideed be done in the a:=b notation that would be no issue. RE: Set System Variable in a program - Angus - 02-27-2015 11:14 AM Thanks a lot so far. Your information about Variable assignment was indeed helpful. I could change my Key to the following which pretty much satifies my needs. Only two points are left on my wishlist: 1) as mentioned numerous times before: getting rid of the needed keystroke <ENTER>. Having the returned String passed to the parser by a new command or RETURN(30) working. :-) (Although you could see a positive aspect: If I just want to change the current Base setting I could e.g. hit F2 and abort. Base has changed and no conversion happens. As said if I try to see a positive side-effect) 2) Activate the Softkey permanently. When I need Integer Base conversions I would like to have my Softkey at hand. The F-Keys in Home are more or less useless anyway. Further ideas and comments are always welcome! See screenshot about what I have in mind. Code:
|