You can check for the length of the input string with "string length(ID)". I guess you'd probably want to do it in a while loop to make sure it doesn't let you move on until a valid input has been entered.
script, new name, begin
while(true) do(
input string(1, 7, true, true)
if(string length(1) > 0) then(
set hero name(1, me)
break # breaks out of the while loop and moves on
)
)
# script will continue here after break
end
kylekrack's script will work. But there is actually a builtin command to show a prompt to edit a hero's name. It doesn't allow you to enter a blank name, but it does let you cancel by pressing ESC, in which case the name isn't changed.
Actually there are two commands, "rename hero" takes the hero ID, eg "rename hero(hero:bob)" or "rename hero(leader)"; and "rename hero by slot" takes the party slot number.
"rename hero" shows a proper box and prompt whereas "input string" shows nothing on the screen except the string, that's why you might prefer "rename hero"
If you don't want to let the player cancel, you can use a while loop very similar to the one kylekrack posted.