| 
		
	
		| DanielStanley   Junior Member
 
 Posts: 9
 Threads: 2
 Joined: Sep 2011
 Reputation: 
0
 | 
			| I need help with this script 
 
				Hey. So i made this script and i can't get it to work, does anyone know how to fix this? (I'm pretty new to this script thing)
 ////////////////////////////
 // Run first time starting map
 void OnStart()
 {
 GiveItemFromFile("lantern", "lantern.ent");
 
 for(int i=0;i< 10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
 
 // Start of everything!
 
 AddEntityCollideCallback("Player", "introscript", false, 0);
 }
 void introstart(string &in asParent, string &in asChild, int alState)
 {
 
 if(alState == 1)
 {
 PlayMusic("03_puzzle_secret", false, 1.00, 0, 5, true);
 }
 if(alState == -1)
 {
 StopMusic(0, 5);
 }
 }
 |  |  
	| 01-12-2013, 09:18 PM |  |  
	
		| The chaser   Posting Freak
 
 Posts: 2,486
 Threads: 76
 Joined: Jun 2012
 Reputation: 
113
 | 
			| RE: I need help with this script 
 
				 (01-12-2013, 09:18 PM)DanielStanley Wrote:  Hey. So i made this script and i can't get it to work, does anyone know how to fix this? (I'm pretty new to this script thing)
 ////////////////////////////
 // Run first time starting map
 void OnStart()
 {
 GiveItemFromFile("lantern", "lantern.ent");
 
 for(int i=0;i< 10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
 
 // Start of everything!
 
 AddEntityCollideCallback("Player", "introscript", false, 0);
 }
 void introscript(string &in asParent, string &in asChild, int alState)
 {
 
 if(alState == 1)
 {
 PlayMusic("03_puzzle_secret", false, 1.00, 0, 5, true);
 }
 if(alState == -1)
 {
 StopMusic(0, 5);
 }
 }
 
                               THE OTHERWORLD (WIP) ![[Image: k6vbdhu]](http://tinyurl.com/k6vbdhu)  
Aculy iz dolan. |  |  
	| 01-12-2013, 10:59 PM |  |  
	
		| NaxEla   Senior Member
 
 Posts: 415
 Threads: 5
 Joined: Dec 2012
 Reputation: 
28
 | 
			| RE: I need help with this script 
 
				Also, change this line:
 AddEntityCollideCallback("Player", "introscript", false, 0);
 
 To this:
 
 AddEntityCollideCallback("Player", "NAME OF THE ENTITY THE PLAYER COLLIDES WITH",  "introscript", false, 0);
 
 |  |  
	| 01-13-2013, 12:25 AM |  |  
	
		| Damascus   Senior Member
 
 Posts: 646
 Threads: 118
 Joined: Mar 2012
 Reputation: 
29
 | 
			| RE: I need help with this script 
 
				There's a plethora of problems here.  Added script is red, corrected script is blue:  (01-12-2013, 09:18 PM)DanielStanley Wrote:  Hey. So i made this script and i can't get it to work, does anyone know how to fix this? (I'm pretty new to this script thing)
 ////////////////////////////
 // Run first time starting map
 void OnStart()
 {
 GiveItemFromFile("lantern", "lantern.ent");
 
 for(int i=0;i< 10;i++) {
 GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
 }
 }
 
 // Start of everything!
 
 AddEntityCollideCallback("Player", "ENTITY COLLIDED WITH", "introscript", false, 0);
 }
 void introscript(string &in asParent, string &in asChild, int alState)
 {
 
 if(alState == 1)
 {
 PlayMusic("03_puzzle_secret", false, 1, 0, 5, true);
 }
 if(alState == -1)
 {
 StopMusic(0, 5);
 }
 }
 
				
(This post was last modified: 01-13-2013, 05:41 AM by Damascus.)
 |  |  
	| 01-13-2013, 05:39 AM |  |  
	
		| darksky   Member
 
 Posts: 52
 Threads: 8
 Joined: Nov 2012
 Reputation: 
2
 | 
			| RE: I need help with this script 
 
				 (01-13-2013, 05:39 AM)Damascus Wrote:  There's a plethora of problems here.  Added script is red, corrected script is blue:
 
  (01-12-2013, 09:18 PM)DanielStanley Wrote:  Hey. So i made this script and i can't get it to work, does anyone know how to fix this? (I'm pretty new to this script thing)
 ////////////////////////////
 // Run first time starting map
 void OnStart()
 {
 GiveItemFromFile("lantern", "lantern.ent");
 
 for(int i=0;i< 10;i++) {
 GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
 }
 }
 
 // Start of everything!
 
 AddEntityCollideCallback("Player", "ENTITY COLLIDED WITH", "introscript", false, 0);
 }
 void introscript(string &in asParent, string &in asChild, int alState)
 {
 
 if(alState == 1)
 {
 PlayMusic("03_puzzle_secret", false, 1, 0, 5, true);
 }
 if(alState == -1)
 {
 StopMusic(0, 5);
 }
 }
 
it won't work like that, Damascus. the closing bracket for OnStart comes after the collidecallback. your second closing bracket is wrong.
 
(and you don't need brackets when using a for-loop with just one instruction    )
			 
				
(This post was last modified: 01-13-2013, 09:10 AM by darksky.)
 |  |  
	| 01-13-2013, 09:09 AM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: I need help with this script 
 
				////////////////////////////// Run first time starting map
 void OnStart()
 {
 GiveItemFromFile("lantern", "lantern.ent");
 
 for(int i=0;i< 10;i++)
 GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
 
 AddEntityCollideCallback("Player", "ENTITY COLLIDED WITH", "introscript", false, 0);
 }
 
 // Start of everything!
 
 void introscript(string &in asParent, string &in asChild, int alState)
 {
 if(alState == 1)
 {
 PlayMusic("03_puzzle_secret", false, 1, 0, 5, true);
 }
 if(alState == -1)
 {
 StopMusic(0, 5);
 }
 }
 
 Trying is the first step to success. |  |  
	| 01-13-2013, 01:05 PM |  |  |