3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: Input Text  (Read 804 times)

« on: July 30, 2013, 05:50:35 AM »
Hi.

I see inputText sample in 3dRad. Now I add Blinking cursor before type any character. I want after type any character The cursor move to right. I tried to move it with iStringRight(string,string,int) function but I can't do it.

Code: [Select]
string strText;
string strI = "I";

void Main()
{
   OUT_22=iFloatRand(0,1.5);
   iPrint(strI,-3,-1.2,OBJ_22);

   if (iInitializing())
   {
      strText = "";
   }
   
   int c = iTypedChar(true);
   if (c > 0)
   {
      strText += " ";
      strText[iStringLen(strText)-1] = c;
   }

   if (c == -2)
   {
      //back-space was pressed
      iStringLeft(strText,strText,iStringLen(strText)-1);
   }
   if (c == -1)
   {
      //enter was pressed
      strText = "";
   }
   iObjectTextSet(OBJ_66,strText);
}

I need more Explanation about this Line:

Code: [Select]
     
strText += " ";
strText[iStringLen(strText)-1]
Thanks
« Last Edit: July 30, 2013, 06:00:38 AM by behdadsoft »
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0

possible way, if we found will make a way.
« Reply #1 on: July 30, 2013, 06:21:24 AM »
What happens, is that first the string is made one character, a space, longer (strText += " "). Then, the newly added symbol is changed to the character which is pressed.
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
« Reply #2 on: July 30, 2013, 02:02:06 PM »
I don't Understand Your Mean. ???
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0

possible way, if we found will make a way.
« Reply #3 on: July 30, 2013, 02:17:50 PM »
He is not mean, he's a very nice man  ;D
« Reply #4 on: July 30, 2013, 02:53:48 PM »
I Mean:
I do not understand what you mean. ;D

Quote
He is not mean, he's a very nice man 

Not very nice man, very very nice man. ;D
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0

possible way, if we found will make a way.
« Reply #5 on: July 30, 2013, 04:40:27 PM »
The puns... Make... It... Stop...  ::)


Oh, wait, damn... I got it wrong. That's not what it does.
The first part was correct, the following line increases the string by one character:

strText += " ";

But this line...

iStringLeft(strText,strText,iStringLen(strText)-1);

...Removes the last character. This line is executed when backspace is pressed.

iStringLeft(string,string,int) creates a new string with the first x character of an existing string. In this case, 'x' is the length of the entire string minus one. Thus creating the backspace effect.
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
« Reply #6 on: July 31, 2013, 12:45:50 PM »
I need some help.

I want move Blinking cursor to right after type a character.(Mean after type a character move Blinking cursor to right it)

I add another textPrint object and add these two lines for make Blinking cursor:

Code: [Select]
   
OUT_22=iFloatRand(0,1.5);
iPrint(strI,-3,-1.2,OBJ_22);

and added 3 line in this if statement, But don't work my script.
Code: [Select]
 
 if (c > 0)
   {
      strText += " ";
      strText[iStringLen(strText)-1] = c;

      strI += " "; //Line 1
      strI[iStringLen(strI)-1] = d; //Line 2
      iStringRight(strI,strI,iStringLen(strI)-1); //Line 3
   }

I know I know that my script is the problem.
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0

possible way, if we found will make a way.
« Reply #7 on: July 31, 2013, 12:59:29 PM »
I edited the default "InputText.3dr" demo to get what you want. See below.

You might want to replace the "|" with a custom made symbol and put it under "&" or "�".
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
« Reply #8 on: July 31, 2013, 01:50:20 PM »
Thanks Robertoo. :D

I really want to know how you got so good programming? ???
can you guide me?
« Last Edit: July 31, 2013, 01:58:39 PM by behdadsoft »
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0

possible way, if we found will make a way.
« Reply #9 on: July 31, 2013, 02:08:16 PM »
Quote
I really want to know how you got so good programming?
can you guide me?

1- he refuses to believe in magic...
2- he refuses to accept that there is something that he cannot learn how to do...
3- he doesn't wait around for someone to spoon feed him what he needs to know...
4- he uses his brain to think logically...
5- he accepts criticism and is his own harshest critic...

i'm sure there's a lot more i could come up with... but i think these'll do for now...

--Mike
« Reply #10 on: July 31, 2013, 02:29:24 PM »
Funny but true
practice and hard work, the only way to get good at anything
« Reply #11 on: July 31, 2013, 02:59:32 PM »
Well, Mike, that was actually accurate.  ;D
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
« Reply #12 on: August 01, 2013, 06:10:55 AM »
Perhaps you are right. ;)
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0

possible way, if we found will make a way.
Pages: [1]