Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
2 registered members (3run, AndrewAMD), 667 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Text Editor? #127001
04/28/07 18:09
04/28/07 18:09
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
I was wondering...

How do you make it so that the user can input letters into a string that has been previously defined (without hitting F11)?


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Text Editor? [Re: MrCode] #127002
04/28/07 19:18
04/28/07 19:18
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline
Expert
Error014  Offline
Expert

Joined: Jul 2002
Posts: 3,208
Germany
You mean, like "inkey(yourstringhere)"? Nah, you don't. That's certainly too easy.


Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
Re: Text Editor? [Re: Error014] #127003
04/28/07 19:25
04/28/07 19:25
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
Code:

function text_input()
{
while(1)
{
inkey(new_line);
wait(1);
}
}



Is this right? I already defined string new_line, and I called the function in main(), it's just not putting anything in.

Sorry for the noob question, I just want to clarify how to use inkey().


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Text Editor? [Re: MrCode] #127004
04/28/07 19:27
04/28/07 19:27
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline
Expert
Error014  Offline
Expert

Joined: Jul 2002
Posts: 3,208
Germany
No while-loop.

Code:

function text_input() {
inkey(new_line); //won't continue until we're done
IF(result==13) { //Enter pressed
//WHATEVER
}
}




Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
Re: Text Editor? [Re: MrCode] #127005
04/28/07 19:44
04/28/07 19:44
Joined: Aug 2006
Posts: 652
Netherlands
bstudio Offline
User
bstudio  Offline
User

Joined: Aug 2006
Posts: 652
Netherlands
the while is not neccesary. because the inkey would be visible all the time.

Edit:
error posted just a tad earlier then me XD

Last edited by bstudio; 04/28/07 19:53.

BASIC programmers never die, they GOSUB and don't RETURN.
Re: Text Editor? [Re: bstudio] #127006
04/28/07 19:49
04/28/07 19:49
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
The whole shebang, because it STILL won't do anything!

Code:

var video_mode= 8;
var video_screen= 1;
var video_depth= 32;
var screen_color[3]= 255,255,255;

string test= "this is a black color setting";
string new_line;

string file_options= "New...\nOpen...\nSave...\nSave As...\nPreferences...\nCode Access...\n\nFiler...\nExit";
string edit_options= "Font...\nColor...\nParagraph...\nNotes...\nBullets/Numbering...\nGraph...\n\n3D Text...\nText FX...";
string options_options= "GUI Color...\nWorkspace...\nGimmeMoreFonts...\nScreen Resolution...\nSpecial Features...\nTextToSpeech...\n\nPimpMyProject...\nFontMaker...";
string help_options= "Contents...\nOnline Help...\nFontMaker Tutorial...\nInstalling Plugins...\nAbout...\n(ndef)\n(ndef)\n(ndef)";
string font_picker= "Microsoft Sans Serif\nTimes New Roman\nArial\nFixedsys\nLucida Console";

bmap gui_pcx= "gui.pcx";
bmap cursor_pcx= "wcursor.pcx";
bmap select_pan= "gui_dropdown.pcx";
bmap about_pcx= "about.pcx";
bmap not_done_yet_pcx= "nofeature.pcx";
bmap tut_info= "tut_info.pcx";
bmap exit_prompt= "exit_prompt.pcx";

function main()
{
mouse_map= cursor_pcx;
mouse_mode= 2;
while(1)
{
mouse_pos.x= pointer.x;
mouse_pos.y= pointer.y;
wait(1);
}
text_input();
}

panel gui
{
pos_x= 0;
pos_y= 0;
bmap= gui_pcx;
button (0,0,"file_on.pcx","file_off.pcx","file_ovr.pcx",swap_gui_panel,null,null);
button (32,0,"edit_on.pcx","edit_off.pcx","edit_ovr.pcx",swap_gui_edit,null,null);
button (1008,0,"x_on.pcx","x_off.pcx","x_ovr.pcx",quitter_switch,null,null);
button (64,0,"options_on.pcx","options_off.pcx","options_ovr.pcx",swap_gui_options,null,null);
button (96,0,"help_on.pcx","help_off.pcx","help_ovr.pcx",swap_gui_help,null,null);
flags= visible;
}

font gui_fnt= "Microsoft Sans Serif",1,14;
font font1_fnt= "Times New Roman",1,14;
font font2_fnt= "Arial",1,14;
font font3_fnt= "Fixedsys",1,9;
font font4_fnt= "Lucida Console",1,14;


text file_txt
{
pos_x= 0;
pos_y= 16;
font= gui_fnt;
string= file_options;
}

text edit_txt
{
pos_x= 32;
pos_y= 16;
font= gui_fnt;
string= edit_options;
}

text options_txt
{
pos_x= 64;
pos_y= 16;
font= gui_fnt;
string= options_options;
}

text help_txt
{
pos_x= 96;
pos_y= 16;
font= gui_fnt;
string= help_options;
}

text test_color
{
pos_x= 0;
pos_y= 32;
red= 0;
green= 0;
blue= 0;
font= gui_fnt;
string= new_line;
flags= visible;
}

panel gui_dropdown
{
pos_x= 0;
pos_y= 16;
bmap= select_pan;
button (0,0,"selector_on.tga",null,"selector_ovr.tga",null,null,null);
button (0,16,"selector_on.tga",null,"selector_ovr.tga",null,null,null);
button (0,32,"selector_on.tga",null,"selector_ovr.tga",null,null,null);
button (0,48,"selector_on.tga",null,"selector_ovr.tga",null,null,null);
button (0,64,"selector_on.tga",null,"selector_ovr.tga",null,null,null);
button (0,80,"selector_on.tga",null,"selector_ovr.tga",null,null,null);
button (0,96,"selector_on.tga",null,"selector_ovr.tga",null,null,null);
button (0,112,"selector_on.tga",null,"selector_ovr.tga",quitter_switch,null,null);
}

panel gui_dropdown2
{
pos_x= 32;
pos_y= 16;
bmap= select_pan;
button (0,0,"selector_on.tga",null,"selector_ovr.tga",null,null,null);
button (0,16,"selector_on.tga",null,"selector_ovr.tga",null,null,null);
button (0,32,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,48,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,64,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,80,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,96,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,112,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
}

panel gui_dropdown3
{
pos_x= 64;
pos_y= 16;
bmap= select_pan;
button (0,0,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,16,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,32,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,48,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,64,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,80,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,96,"selector_on.tga",null,"selector_ovr.tga",tut_switch,null,null);
button (0,112,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
}

panel gui_dropdown4
{
pos_x= 96;
pos_y= 16;
bmap= select_pan;
button (0,0,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,16,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,32,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,48,"selector_on.tga",null,"selector_ovr.tga",nofeature_switch,null,null);
button (0,64,"selector_on.tga",null,"selector_ovr.tga",about_switch,null,null);
button (0,80,"selector_on.tga",null,"selector_ovr.tga",null,null,null);
button (0,96,"selector_on.tga",null,"selector_ovr.tga",null,null,null);
button (0,112,"selector_on.tga",null,"selector_ovr.tga",null,null,null);
}

panel about_acknote
{
pos_x= 384;
pos_y= 256;
bmap= about_pcx;
button (240,0,"x_on.pcx","x_off.pcx","x_ovr.pcx",about_switch,null,null);
}

panel nofeature
{
pos_x= 384;
pos_y= 256;
bmap= not_done_yet_pcx;
button (240,0,"x_on.pcx","x_off.pcx","x_ovr.pcx",nofeature_switch,null,null);
}

panel tut_about
{
pos_x= 256;
pos_y= 256;
bmap= tut_info;
button (496,0,"x_on.pcx","x_off.pcx","x_ovr.pcx",tut_switch,null,null);
}

panel quitter
{
pos_x= 384;
pos_y= 256;
bmap= exit_prompt;
button (32,88,"yess_on.pcx","yess_off.pcx","yess_ovr.pcx",exit,null,null);
button (104,88,"no_on.pcx","no_off.pcx","no_ovr.pcx",quitter_switch,null,null);
}

function exit()
{
sys_exit(null);
}

function swap_gui_panel()
{
//gui_dropdown.visible= (gui_dropdown.visible== off);
//file_txt.visible= (file_txt.visible== off);
if (gui_dropdown.visible== off)
{
file_txt.visible= on;
gui_dropdown.scale_y= 0.1;
gui_dropdown.visible= on;
while(gui_dropdown.scale_y < 0.9)
{
gui_dropdown.scale_y+= 0.1 * time_step;
wait(1);
}
}
else
{
gui_dropdown.visible= off;
while(gui_dropdown.scale_y > 0.1)
{
gui_dropdown.scale_y-= 0.1 * time_step;
wait(1);
}
file_txt.visible= off;
}
}

function swap_gui_edit()
{
//gui_dropdown2.visible= (gui_dropdown2.visible== off);
//edit_txt.visible= (edit_txt.visible== off);
if (gui_dropdown2.visible== off)
{
edit_txt.visible= on;
gui_dropdown2.scale_y= 0.1;
gui_dropdown2.visible= on;
while(gui_dropdown2.scale_y < 0.9)
{
gui_dropdown2.scale_y+= 0.1 * time_step;
wait(1);
}
}
else
{
gui_dropdown2.visible= off;
while(gui_dropdown2.scale_y > 0.1)
{
gui_dropdown2.scale_y-= 0.1 * time_step;
wait(1);
}
edit_txt.visible= off;
}
}

function swap_gui_options()
{
//gui_dropdown3.visible= (gui_dropdown3.visible== off);
//options_txt.visible= (options_txt.visible== off);
if (gui_dropdown3.visible== off)
{
options_txt.visible= on;
gui_dropdown3.scale_y= 0.1;
gui_dropdown3.visible= on;
while(gui_dropdown3.scale_y < 0.9)
{
gui_dropdown3.scale_y+= 0.1 * time_step;
wait(1);
}
}
else
{
gui_dropdown3.visible= off;
while(gui_dropdown3.scale_y > 0.1)
{
gui_dropdown3.scale_y-= 0.1 * time_step;
wait(1);
}
options_txt.visible= off;
}
}

function swap_gui_help()
{
//gui_dropdown4.visible= (gui_dropdown4.visible== off);
//help_txt.visible= (help_txt.visible== off);
if (gui_dropdown4.visible== off)
{
help_txt.visible= on;
gui_dropdown4.scale_y= 0.1;
gui_dropdown4.visible= on;
while(gui_dropdown4.scale_y < 0.9)
{
gui_dropdown4.scale_y+= 0.1 * time_step;
wait(1);
}
}
else
{
gui_dropdown4.visible= off;
while(gui_dropdown4.scale_y > 0.1)
{
gui_dropdown4.scale_y-= 0.1 * time_step;
wait(1);
}
help_txt.visible= off;
}
}

function about_switch()
{
about_acknote.visible= (about_acknote.visible== off);
}

function nofeature_switch()
{
nofeature.visible= (nofeature.visible== off);
}

function quitter_switch()
{
quitter.visible= (quitter.visible== off);
}

function tut_switch()
{
tut_about.visible= (tut_about.visible== off);
}

function text_input()
{
test_color.visible= on;
inkey(new_line);
if (result== 13)
{
str_cpy (new_line,"\n");
}
}




Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Text Editor? [Re: MrCode] #127007
04/28/07 19:58
04/28/07 19:58
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
text_input(); is never called because the while loop is endless.
Include text_input(); over the while loop.

Re: Text Editor? [Re: Slin] #127008
04/28/07 20:15
04/28/07 20:15
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
putting it before the while() loop worked, but I cant use Enter to create a new text line while maintaining the previous one.

And, the line stops after about 32 chars. I defined the string to be unlimited! What's up with that!?

Last edited by MrCode; 04/28/07 20:18.

Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Text Editor? [Re: MrCode] #127009
04/29/07 01:24
04/29/07 01:24
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
Sorry for the bump, but does anyone have a workaround for this?


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Text Editor? [Re: MrCode] #127010
04/29/07 20:55
04/29/07 20:55
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
Anyone?


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1