I'm trying to use the set_var command to change the value of the frame coordinates written to the system variable, but nothing works. How to write the code correctly??
I'm trying to use the set_var command to change the value of the frame coordinates written to the system variable, but nothing works. How to write the code correctly??
Hi A_ghost,
SET_VAR is the correct routine.
- Figure out the correct sysvar name e.g. '$XY_VAR[2].$A_Value'
- set prog_name to '*SYSTEM*'
- use the status var (with POST_ERR) to debug your code and get more information about your error(s)
- check the information the compiler/translater gives you
Best regards
The system variable "$EADER_FRM " you are are using doesn't seem to be a standard system variable, could you show the path you are taking to get to your screen?
Below is an example of how you can use the SET_VAR instruction in a Karel Routine (note: the parameter name might not be correct):
PROGRAM VAR_SET
--Translation Directive to work with system variables
%ENVIRONMENT sysdef
--Variable Definitions
VAR
status: INTEGER
tempInteger:INTEGER
parameter: STRING[40]
value: REAL
--Program Logic
BEGIN
parameter = '$EADER_FRM[1].$X'
value = 563.000
SET_VAR(tempInteger, '*SYSTEM*',parameter, value,status)
END VAR_SET
Display MoreThe system variable "$EADER_FRM " you are are using doesn't seem to be a standard system variable, could you show the path you are taking to get to your screen?
Below is an example of how you can use the SET_VAR instruction in a Karel Routine (note: the parameter name might not be correct):
PROGRAM VAR_SET
--Translation Directive to work with system variables
%ENVIRONMENT sysdef
--Variable Definitions
VAR
status: INTEGER
tempInteger:INTEGER
parameter: STRING[40]
value: REAL
--Program Logic
BEGIN
parameter = '$EADER_FRM[1].$X'
value = 563.000
SET_VAR(tempInteger, '*SYSTEM*',parameter, value,status)
END VAR_SET
I wrote the code, but when executing, the value of X does not change (((
Is the system variable locked??
Hi
as I wrote in my first answer:
Quote- use the status var (with POST_ERR) to debug your code and get more
information about your error(s)
e.g.
SET_VAR(.....,status)
IF status <> 0 THEN POST_ERR(status, '', 0, 2) ENDIF
And, are you sure you have to set these vars via karel?
I think it might be dangerous to edit the COORD-Frames directly, unless you really know what you're doing...
best regards
Display MoreHi
as I wrote in my first answer:
e.g.
SET_VAR(.....,status)
IF status <> 0 THEN POST_ERR(status, '', 0, 2) ENDIF
And, are you sure you have to set these vars via karel?
I think it might be dangerous to edit the COORD-Frames directly, unless you really know what you're doing...
best regard
When executing the program, it writes an unknown variable name. Why??
Hello A_ghost,
I have similar problem with another sys var
B.R.