The Daily Click ::. Forums ::. Klik Coding Help ::. Extremely newbish question.....
 

Post Reply  Post Oekaki 
 

Posted By Message

ReiKGT



Registered
  09/08/2007
Points
  46
2nd December, 2007 at 19:22:36 -

I've been avoiding this question because i've been trying to figure it out myself. I know it's probably pretty dumb, but here it goes....

How do i make an alterable string that will change when i click a button in game?


 
"last one left to die, please turn out the light."
The human child body template used in my avatar was made by Show Kaizer who can be found on rmxp.org forums.

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
2nd December, 2007 at 19:38:23 -

how do you mean?? is it someones name or a set string?? you could have it read from an ini or an array....

 
n/a

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
2nd December, 2007 at 19:44:45 -

DaVince's Amazing Step-By-Step Tutorial

1. On button click > set alterable string to "blah".
2. Done!

Image Edited by the Author.

 
Old member (~2004-2007).

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
2nd December, 2007 at 21:24:57 -

I'm not sure what you mean.

If you want simply to have a button that sets an alterable string to "XXXXXX" when pressed, simply have:

+Button is Pressed
*Text Object: Set Alterable String to "XXXXXX"

changing the alterable string via "Set Alterable String" will ALSO make it display the alterable string.

Meanwhile, if you want to have a string concatenation; if you want the alterable string to be "HELLO" + an "X" every time you press a button (so first press would result: "HELLOX", 2nd: "HELLOXX") you must use the basic "+" operator in the editor

The + operator is overloaded to do both string and math addition. Used on two string objects, it will concatenate them. However, you will run into extreme problems depending on the extensions you use. Sometimes, a custom string object might return the wrong kind of input when called in a function, so then what the editor assumed was a "String" + "String" evaluation, will really end up as a "Pseudostring" + "String" or something. For example, if you are using the 1000 Global Strings object for TGF, it will not return a proper string value when called in a function. While it will be returned overall as a string normally, you cannot add it to a normal string. It will instantly crash the game.

If this is the problem you've been running into, a quick work around is to put the string from your extension into the alterable value of a default text object. Then add the text objects value and whatever string you wanted to add, instead of calling directly from the extension.


Just a minor problem you often find in the TGF/MMF extensions.

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

ReiKGT



Registered
  09/08/2007
Points
  46
3rd December, 2007 at 18:05:00 -

What i wanted to know was how to make it so when i press a button an alterable string changes.

For the sake of the next question lets say that the button im going to press is z and the alterable string will change to read z.
I wanted to know how to make it trigger an event when the string reads "z".
^ forgot to post it in the original post. Sorry .

BTW: I use mmf2, thanks.

Image Edited by the Author.

Image Edited by the Author.

 
"last one left to die, please turn out the light."
The human child body template used in my avatar was made by Show Kaizer who can be found on rmxp.org forums.

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
3rd December, 2007 at 18:37:52 -

Put two objects offscreen. Make one an edit box, and the other a string object. On the edit box, turn on "Always Uppercase". Next, create these events:

+Always
Edit Box: Control --> Focus --> On

AND

+Edit Box--> Has edit zone been modified?
String Object: Set Alterable String to (Edit Box--> Get Text)
Edit Box: Set Text to ("")


Then your string will always be a single character which was just typed on the keyboard, always in uppercase.
To tell if say "Z" has been tapped, do this command:

+Special: Compare Two General Values: (String Object: Alterable String) = ("Z")
(actions)

You can simply compare if the alterable string is equal to "Z". Make sure to include the parentheses.

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

ReiKGT



Registered
  09/08/2007
Points
  46
3rd December, 2007 at 19:38:41 -

What would i do to that if i wanted to make a fighting game and I wanted to use this for combos?

Ex I press z,s,a,z in that order
and when the string reads ZSAZ i would need it to trigger an event.

and i know how to make the string reset so the string doesnt continue on forever but i dont know how to make it so the string resets after X seconds of no button input. Guess i need to know that too..

Because I originaly intended this for a fighting game.

Image Edited by the Author.

Image Edited by the Author.

 
"last one left to die, please turn out the light."
The human child body template used in my avatar was made by Show Kaizer who can be found on rmxp.org forums.

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
3rd December, 2007 at 20:21:08 -

Keep the events almost exactly the way they are.

Except, change this event:

+Edit Box--> Has edit zone been modified?
String Object: Set Alterable String to (Edit Box--> Get Text)
Edit Box: Set Text to ("")

to:

+Edit Box--> Has edit zone been modified?
String Object: Set Alterable String to (Edit Box--> Get Text)
"Some Arbitrary Value you store somewhere on some object": Set Value A to (X seconds * 50)

ie, you could have it be
Global Value 1: Set Global Value to 300

which would result in a 6 second delay.


Then, add an event:

+(Arbitrary Value "Global Value 1") > (0)
Arbitrary Value: Subtract from Value (1)

And another event to finish it:

+Arbitrary Value = 1
Set Edit box to ""



That way, after a X second delay, the box would be reset to null input. Every time you hit a key, the box would be reset, and the string would grow one character longer.


Image Edited by the Author.

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

ReiKGT



Registered
  09/08/2007
Points
  46
6th December, 2007 at 19:50:31 -

Thanks! That helped alot.

 
"last one left to die, please turn out the light."
The human child body template used in my avatar was made by Show Kaizer who can be found on rmxp.org forums.
   

Post Reply



 



Advertisement

Worth A Click