Keyboard 如何修复这个gnuplot错误来处理按键?

Keyboard 如何修复这个gnuplot错误来处理按键?,keyboard,gnuplot,mouse,numeric,Keyboard,Gnuplot,Mouse,Numeric,我试图为我的gnuplot脚本提供基本的键盘交互。 使用gnuplot 5.4 patchlevel 1我使用的是鼠标字符,我相信,但是使用下面最简单的脚本,无论按什么键,我都会出错 while (1) { pause mouse keypress show variable MOUSE_ if (exists("MOUSE_CHAR")) { if (MOUSE_CHAR == "w") {

我试图为我的gnuplot脚本提供基本的键盘交互。 使用
gnuplot 5.4 patchlevel 1
我使用的是鼠标字符,我相信,但是使用下面最简单的脚本,无论按什么键,我都会出错

while (1) {
    pause mouse keypress
    show variable MOUSE_

    if (exists("MOUSE_CHAR")) {
        if (MOUSE_CHAR == "w") {
            print "w"
        }
    }             # <-- line 114

    replot
}

但在我得到

"hrtp.gp" line 114: Non-numeric string found where a numeric expression was expected

字符串相等性的测试是
eq
而不是
=
,因此您希望
如果(鼠标字符eq“w”){print“w”}
,您就可以避免我这样做-
        MOUSE_KEY = 114
        MOUSE_CHAR = "r"
"hrtp.gp" line 114: Non-numeric string found where a numeric expression was expected