iprintlnbold Script

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
User avatar
R4d0xZz
CJ Fan
CJ Fan
Posts: 199
Joined: August 24th, 2009, 2:08 am
Location: Berlin
Contact:

iprintlnbold Script

Post by R4d0xZz » April 29th, 2010, 7:43 pm

hey i have 10 tiggers and want to get a msg on my screen with iprintlnbold.


i´ve made that script ( im realy bad at scripting so dont laught at me ;D)

Code: Select all

main()

{
	thread one();
	thread two();
	thread three();
	thread four();
	thread five();
	thread six();
	thread seven();
	thread eight();
	thread nine();
	thread ten();

}

one()
{
	trigger = getent ("one", "targetname");
		while(1)
{
	trigger waittill ("trigger",user);
		user iprintlnbold ("^2600 ^7Units.");
		wait(120);
	}
}

two()
{
	trigger = getent ("two", "targetname");
		while(1)
{
	trigger waittill ("trigger",user);
		user iprintlnbold ("^21500 ^7Units.");
		wait(120);
	}
}

three()
{
	trigger = getent ("three", "targetname");
		while(1)
{
	trigger waittill ("trigger",user);
		user iprintlnbold ("^22500 ^7Units.");
		wait(120);
	}
}

four()
{
	trigger = getent ("four", "targetname");
		while(1)
{
	trigger waittill ("trigger",user);
		user iprintlnbold ("^23500 ^7Units.");
		wait(120);
	}
}

five()
{
	trigger = getent ("five", "targetname");
		while(1)
{
	trigger waittill ("trigger",user);
		user iprintlnbold ("^24500 ^7Units.");
		wait(120);
	}
}

six()
{
	trigger = getent ("six", "targetname");
		while(1)
{
	trigger waittill ("trigger",user);
		user iprintlnbold ("^25500 ^7Units.");
		wait(120);
	}
}

seven()
{
	trigger = getent ("seven", "targetname");
		while(1)
{
	trigger waittill ("trigger",user);
		user iprintlnbold ("^26500 ^7Units.");
		wait(120);
	}
}

eight()
{
	trigger = getent ("eight", "targetname");
		while(1)
{
	trigger waittill ("trigger",user);
		user iprintlnbold ("^27500 ^7Units.");
		wait(120);
	}
}

nine()
{
	trigger = getent ("nine", "targetname");
		while(1)
{
	trigger waittill ("trigger",user);
		user iprintlnbold ("^28500 ^7Units.");
		wait(120);
	}
}

ten()
{
	trigger = getent ("ten", "targetname");
		while(1)
{
	trigger waittill ("trigger",user);
		user iprintlnbold ("^29500 ^7Units.");
		wait(120);
	}
}
also i get that error:

http://screenshot.xfire.com/s/96581129-4.jpg

can anyone help me with that bitch of a script? ;D
Image|Image
Image|Image
Image|Image

mr-x
CJ Newbie
CJ Newbie
Posts: 61
Joined: March 7th, 2010, 3:33 pm

Re: iprintlnbold Script

Post by mr-x » April 29th, 2010, 8:25 pm

why laught its right but make sure about targetnames and values plz

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: iprintlnbold Script

Post by Drofder2004 » April 29th, 2010, 8:26 pm

I suggest checking you map targetnames. I also would use "trig" isntead of trigger, just to stop any confusion with the trigger event.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
R4d0xZz
CJ Fan
CJ Fan
Posts: 199
Joined: August 24th, 2009, 2:08 am
Location: Berlin
Contact:

Re: iprintlnbold Script

Post by R4d0xZz » April 30th, 2010, 5:56 am

it wont even work if i use just 1 trigger:
i also renamed the targetname.
trigger = multiple

Code: Select all

iprint.gsc:

main()
{
	thread ski1();
}

ski1()
{
	trig = getent ("ski1", "targetname");
		while(1)
{
	trig waittill ("trig",user);
		user iprintlnbold ("^2600 ^7Units.");
		wait(120);
	}
}

Code: Select all

mp_ib_glass.gsc :

	maps\mp\iprint::main();
Error:
http://screenshot.xfire.com/s/96603720-4.jpg

i dont know whats wrong O.O
Image|Image
Image|Image
Image|Image

mr-x
CJ Newbie
CJ Newbie
Posts: 61
Joined: March 7th, 2010, 3:33 pm

Re: iprintlnbold Script

Post by mr-x » April 30th, 2010, 6:00 am

Code: Select all

iprint.gsc:

main()
{
   thread ski1();
}

ski1()
{
   trig = getent ("ski1", "targetname");
      while(1)
{
   trig waittill ("trigger",user);
      user iprintlnbold ("^2600 ^7Units.");
      wait(120);
   }
}
replace trig waittill ("trig",user);
to
trig waittill ("Trigger",user):
also try add that in main GSC
or make sure u add that line to zone file
rawfile,maps/mp/inprintln.gsc

User avatar
R4d0xZz
CJ Fan
CJ Fan
Posts: 199
Joined: August 24th, 2009, 2:08 am
Location: Berlin
Contact:

Re: iprintlnbold Script

Post by R4d0xZz » April 30th, 2010, 6:53 am

Bad syntax.

added it now to my main gsc. still get the error.
i tryed it with trig trigger Trigger Trig :D

Code: Select all

   thread ski1();


ski1()
{
	trigger = getent ("ski1", "targetname");
		while(1)
{
	trigger waittill ("trigger", user );
		user iprintlnbold ("^2600 ^7Units.");
		wait(120);
	}
}
Image|Image
Image|Image
Image|Image

mr-x
CJ Newbie
CJ Newbie
Posts: 61
Joined: March 7th, 2010, 3:33 pm

Re: iprintlnbold Script

Post by mr-x » April 30th, 2010, 11:08 am

R4d0xZz wrote:Bad syntax.

added it now to my main gsc. still get the error.
i tryed it with trig trigger Trigger Trig :D

Code: Select all

   thread ski1();


ski1()
{
	trigger = getent ("ski1", "targetname");
		while(1)
{
	trigger waittill ("trigger", user );
		user iprintlnbold ("^2600 ^7Units.");
		wait(120);
	}
}
change the thread name cause u did trigger =getent ("ski1","targetname");
and thread name ski1 change it to ske

Code: Select all

thread ske();


ske()
{
	trigger = getent ("ski1", "targetname");
		while(1)
{
	trigger waittill ("trigger", user );
		user iprintlnbold ("^2600 ^7Units.");
		wait(120);
	}

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: iprintlnbold Script

Post by Pedsdude » April 30th, 2010, 1:50 pm

Indeed, it is best to keep your thread names different to your entity names.
Image
Image

BatterY
CJ Worshipper
CJ Worshipper
Posts: 238
Joined: January 29th, 2010, 10:27 pm

Re: iprintlnbold Script

Post by BatterY » April 30th, 2010, 2:28 pm

My try: (no guarantee that this is correct)
main()
{
thread ski1();
}

ski1()
{
trigger = getent ("ski1","targetname");
while(1)
{
trigger waittill ("trigger",user);
user iprintlnbold ("^2600 ^7Units.");
wait 120;
}
}
Just copypaste to try it out

mr-x
CJ Newbie
CJ Newbie
Posts: 61
Joined: March 7th, 2010, 3:33 pm

Re: iprintlnbold Script

Post by mr-x » April 30th, 2010, 4:23 pm

BatterY wrote:My try: (no guarantee that this is correct)
main()
{
thread ski1();
}

ski1()
{
trigger = getent ("ski1","targetname");
while(1)
{
trigger waittill ("trigger",user);
user iprintlnbold ("^2600 ^7Units.");
wait 120;
}
u didn't edit anything!!!!!!!! from her script
}
Just copypaste to try it out

User avatar
Xylozi
CJ Fan
CJ Fan
Posts: 104
Joined: November 29th, 2008, 2:16 am
Location: UK
Contact:

Re: iprintlnbold Script

Post by Xylozi » April 30th, 2010, 5:15 pm

Code: Select all

SetupTriggers
{
	triggers = GetEntArray( "message_trigger", "targetname" );
	
	for( i = 0; i < triggers.size; i++ )
	{
		triggers[i] thread MonitorUse();
	}
}

MonitorUse()
{
	distance = self.script_noteworthy; // In Radiant, add the KVP: script_noteworthy | distance, and this line will grab the distance the trigger is at
	
	while(1)
	{
		self waittill( "trigger", player );
	
		player iPrintLnBold( "^2" + distance + "^3 Units." );
		wait 120;
	}
}
This should be far more efficient, just remember to setup the script_noteworthy KVP for each trigger in Radiant. You'll also have to change the targetname of all the triggers to message_trigger

User avatar
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: iprintlnbold Script

Post by waywaaaard » May 1st, 2010, 8:17 am

the error message gave it straight away - that it can't find you entity o.O Why is everyone pasting solutions not for the problem.

Just check if(!isDefined(trig)){iprintln("trig not found");}
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: iprintlnbold Script

Post by Pedsdude » May 1st, 2010, 11:56 am

Also, I generally try to keep all of my scripting for a map in one .gsc file, not multiple files. Easier to spot what's causing the errors that way.
Image
Image

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: iprintlnbold Script

Post by Drofder2004 » May 1st, 2010, 5:02 pm

Lev!athan wrote:the error message gave it straight away - that it can't find you entity o.O Why is everyone pasting solutions not for the problem.

Just check if(!isDefined(trig)){iprintln("trig not found");}
He said he renamed the targetnames.

I suspect a mapping error personally.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest