1. A few simple questions...
I have a few simple questions that are just questions about a few
Euphoria commands. I included a few examples if you dont understand what
I mean from the text:
1. Does anybody know a command that makes it so at ANY time during the
ENTIRE program (such as a game) you can assign a few different keys to
hotkeys for the user that will always do a certain command and ALWAYS
work until you tell them not to or reasign them(not just after that one
if statement or while loop)?
2. Do you know of anyway to do a wrap function that wraps the text for
long sentences but not at whatever letter the side of the screen ends at
but then goes back to the last Word and wraps it?
Example:
Instead of:
- Hello Scott h- (Screen End
-ow are you? - at Dashes)
- -
It would be:
- Hello Scott -
-how are you? -
- -
3.( And last) Do you know anyway to get out of the computer puting that
annoying \n after every prinf?
Example:
object name
puts(1, "What is your name?\n"
name = gets(0)
printf(1, "Hello %s! How are you???", {name})
On my computer that apears when you run the program as:
What is your name?
Hello (name)
! How are you?
I want it to be:
What is your name?
Hello (name)! How are you???
I hope you are able to answer a majority of my questions.
Thanks,
Scott Husen
P.S. If you don't feel like or can't answer all of my questions please
answer #1. Im dieing for the answer to that one!
2. Re: A few simple questions...
Scott Husen wrote:
<snip>
Do you know of anyway to do a wrap function that wraps the text for
> long sentences but not at whatever letter the side of the screen ends at
> but then goes back to the last Word and wraps it?
>
</snip>
The following code will do it on DOS or Linux, printing a given text string
with word wrapping:
include graphics.e
global procedure wrap_text(sequence theText)
-- For DOS and Linux
-- Wraps text at end of last word in line.
-- Honors newlines in the text, replaces tabs with 5 spaces.
-- Assumes that theText is a valid string
sequence vidconf,pos
integer cols,col,index
vidconf=video_config()
cols=vidconf[VC_COLUMNS]
pos=get_position()
col=pos[2]-1
theText=repeat(' ',col)&theText
while 1 do
index=find('\t',theText)
if index=0 then exit end if
theText=theText[1..index-1]&repeat(' ',5)
&theText[index+1..length(theText)]
end while
while length(theText)>cols do
index=find('\n',theText)
if index>0 and index<=cols then
puts(1,theText[col+1..index])
theText=theText[index+1..length(theText)]
col=0
else
for i=cols to 1 by -1 do
if theText[i]=' ' then
theText[i]='\n'
exit
end if
if i=1 then
end if
end for
end if
end while
if length(theText)>0 then
puts(1,theText)
end if
end procedure