August 17, 2018, 10:23:50 PM

Author Topic: Error script compilation Daiquiri Shot  (Read 4279 times)

MikeVLC

  • Recently Bitten
  • **
  • Posts: 77
  • Karma: 1
    • View Profile
Error script compilation Daiquiri Shot
« on: March 18, 2015, 06:58:53 PM »
Trying to reduce radius of laser I added these lines
Code: [Select]
deadshot()
{
while(1)
{
if(self hasperk("specialty_bulletaccuracy"))
self setClientDvar( "cg_laserForceOn", 1 );
self setClientDvar( "cg_laserRadius", 0.1 );
self setClientDvar( "cg_laserLightRadius", 0.4 );
else
self setClientDvar( "cg_laserForceOn", 0 );
wait .1;
}
}
And launching mod an error of scpript compilation is shown.
How can I recuced correctly the radius of laser in daiquiri shot?

WinCat

  • Founder
  • ***
  • Posts: 1094
  • Karma: 86
    • View Profile
    • My Site
Re: Error script compilation Daiquiri Shot
« Reply #1 on: March 18, 2015, 10:21:06 PM »
you need to add braces for code run on condition that is more than one line / statement.

Code: [Select]
if()
{
  // multiple lines of code
}
else
{
    // one or more lines of code, or empty.
}

Code: [Select]
if()
 // single line of code
else
 // single line of code

MikeVLC

  • Recently Bitten
  • **
  • Posts: 77
  • Karma: 1
    • View Profile
Re: Error script compilation Daiquiri Shot
« Reply #2 on: March 19, 2015, 12:43:26 AM »
Code: [Select]
if(self hasperk("specialty_bulletaccuracy"))
// self setClientDvar( "cg_laserForceOn", 1 );
// self setClientDvar( "cg_laserRadius", 0.1 );
// self setClientDvar( "cg_laserLightRadius", 0.4 );
else
// self setClientDvar( "cg_laserForceOn", 0 );
wait .1;
}
}
If I understood your fixes for this problem, I must to add // when the function would be if and then else. I am not an expert, really a beginner and I wouldnt try to contradict your fixes but these lines of code are added to your script "bam_bo_mod_bo1_perks_standalone.gsc" and in this script there are If and then else without // for example
Code: [Select]
staminup()
{
while(1)
{
if(self hasperk("specialty_longersprint"))
self setClientDvar("player_sprintTime", 10);
else
self setClientDvar("player_sprintTime", 4);
wait .5;
}
}
with these // is not for deactivate or delete lilnes of code?
with these now the code is shown in grey.
Thank you for trying to help me but It didnt work


WinCat

  • Founder
  • ***
  • Posts: 1094
  • Karma: 86
    • View Profile
    • My Site
Re: Error script compilation Daiquiri Shot
« Reply #3 on: March 19, 2015, 07:09:21 AM »
lol they where just comments for where the code should go.

If you read my example correct you would end up with  :-*

Code: [Select]
deadshot()
{
while(1)
{
if(self hasperk("specialty_bulletaccuracy"))
{
self setClientDvar( "cg_laserForceOn", 1 );
self setClientDvar( "cg_laserRadius", 0.1 );
self setClientDvar( "cg_laserLightRadius", 0.4 );
}
else
{
self setClientDvar( "cg_laserForceOn", 0 );
}
wait .1;
}
}

MikeVLC

  • Recently Bitten
  • **
  • Posts: 77
  • Karma: 1
    • View Profile
Re: Error script compilation Daiquiri Shot
« Reply #4 on: March 19, 2015, 06:37:40 PM »
I launched the map with the new fixes in developer 1 mode and was impossible to open console for the insistent error windows


WinCat

  • Founder
  • ***
  • Posts: 1094
  • Karma: 86
    • View Profile
    • My Site
Re: Error script compilation Daiquiri Shot
« Reply #5 on: March 19, 2015, 08:17:52 PM »
Load it without developer 1.

the stock code will produce them if you have things not quite right in your map.

You can look at the erros and fix them if you wish tho, but it is unrelated to this snipped of code.

MikeVLC

  • Recently Bitten
  • **
  • Posts: 77
  • Karma: 1
    • View Profile
Re: Error script compilation Daiquiri Shot
« Reply #6 on: March 21, 2015, 06:32:35 PM »
Perfect  :D

Thank you!
One question more: I found commands for trace bullets, but I dont know the correct place to insert this code and I only want that trace bullets would be only in shotguns, It is possible to apply only in shotguns and where would be the correct place to insert the code?
Code: [Select]
( "cg_tracerSpeed", "500" );
( "cg_tracerwidth", "1" );
( "cg_tracerlength", "500" );
( "cg_firstPersonTracerChance", "1" );