Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
How to combine strings?
Old
Dj Tech42
Senior Member
 
Dj Tech42's Avatar
 
Status: Offline
Posts: 203
Join Date: Feb 2011
Default How to combine strings? - 08-16-2011, 12:50 PM

Is there a way to combine string variables? Like a concatenation operator in programming?

I want to add a string to part of another string.


Flight Simulator with Dogfight Modes:
http://www.alice.org/community/showthread.php?t=6840
   
Reply With Quote
Old
InsertName
Senior Member
 
InsertName's Avatar
 
Status: Offline
Posts: 341
Join Date: Jun 2011
Location: In a house
Default 08-16-2011, 12:54 PM

I've been wondering about this too. I think we can just do series of variables.


__№_₤⅞__
Handguns: http://www.alice.org/community/showthread.php?p=45349
MINECRAFT IN ALICE: http://alice.org/community/showthread.php?p=48208
My Stupid Animations: http://alice.org/community/album.php?albumid=119
   
Reply With Quote
Old
legolizard
Senior Member
 
legolizard's Avatar
 
Status: Offline
Posts: 242
Join Date: Jan 2011
Location: Aboard the Hyperion escaping the zerg.
Default 08-16-2011, 01:10 PM

Why don't you just make 3 vairbales add text to the first two and then set the third one eqaul to variable 1 joined with variable 2?


"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."-Albert Einstein
   
Reply With Quote
Old
Dj Tech42
Senior Member
 
Dj Tech42's Avatar
 
Status: Offline
Posts: 203
Join Date: Feb 2011
Default 08-16-2011, 01:21 PM

Quote:
Originally Posted by legolizard View Post
set the third one eqaul to variable 1 joined with variable 2?
How do you do that?


Flight Simulator with Dogfight Modes:
http://www.alice.org/community/showthread.php?t=6840
   
Reply With Quote
Old
Nighthawk0973
Senior Member
 
Nighthawk0973's Avatar
 
Status: Offline
Posts: 240
Join Date: May 2011
Location: In front of my computer.
Default 08-16-2011, 02:41 PM

Say you have a variable called 'ScoreDisplay Part 1' and it's value is "Score: " with the space included. Next you have an interget named 'Score' and it's value is 25 cause that's the users score. Now you have a string called 'ScoreDisplay' and you set it's value to 'default string' inside of a method. After that you need to go and replace 'default string' with the function 'A joined with B' under the world section, A is going to be 'ScoreDisplay Part 1' and B is going to be 'Score'. This makes 'ScoreDisplay' == "Score: 25".

Anyways mess with it and you'll learn more. If you odn't know how to do something try searching through the world functions and camera functions, they can prove to be really helpful and self explanitory.
   
Reply With Quote
Old
Dj Tech42
Senior Member
 
Dj Tech42's Avatar
 
Status: Offline
Posts: 203
Join Date: Feb 2011
Default 08-16-2011, 03:30 PM

Quote:
Originally Posted by Nighthawk0973 View Post
Say you have a variable called 'ScoreDisplay Part 1' and it's value is "Score: " with the space included. Next you have an interget named 'Score' and it's value is 25 cause that's the users score. Now you have a string called 'ScoreDisplay' and you set it's value to 'default string' inside of a method. After that you need to go and replace 'default string' with the function 'A joined with B' under the world section, A is going to be 'ScoreDisplay Part 1' and B is going to be 'Score'. This makes 'ScoreDisplay' == "Score: 25".

Anyways mess with it and you'll learn more. If you odn't know how to do something try searching through the world functions and camera functions, they can prove to be really helpful and self explanitory.
Thanks! Never knew about that function!


Flight Simulator with Dogfight Modes:
http://www.alice.org/community/showthread.php?t=6840
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 08-16-2011, 03:40 PM

Good eye, nighthawk.
   
Reply With Quote
Reply

Tags
combine, concatenation, operator, strings, variables

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.