Author Topic: Frosty's scripting thread  (Read 18525 times)

0 Members and 1 Guest are viewing this topic.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #140 on: September 13, 2010, 01:27:16 pm »
thanks

From: September 14, 2010, 04:10:25 am
GRR

second attempt at nuke turret, failed miserably, for some reason its arming straight away, should be a 10 second countdown, and it should be firing when armed, its not triggering at all

using arrays, what am i missing? what am i doing wrong? its gotta be something stupid cuz its driving me NUTS, look in Apponidle, not even the writeln message is appearing and i dont get why

plz tell me what im doing wrong here
custom functions available in utils.pas and bang.pas

« Last Edit: September 14, 2010, 04:10:26 am by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #141 on: November 21, 2010, 03:26:28 am »
Enesce server hosting, worst host ever

all i need is one script with a DoDamage and then he claims that my server is using too much CPU, well just for Arguments sake, NO OTHER SCRIPTS are even compiling, (what i wanted)

now i know what half my problems are

and all he (nick) is using is a Quad Core CPU and some other cheap n nasty upgrade, he should be using i7 quad cores fcs

seen quite a few posts on the forum complaining about something similar but all related
Quote
enesce hosting

the hardware is just.....inadequate, little wonder people are having trouble, still waiting on an email from U13 so i can get it set up there
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Frosty's scripting thread
« Reply #142 on: November 21, 2010, 03:51:40 am »
When looking at your "scripts", I'm not surprised why he refuses to host them.
Quad Core CPU is enough for dozen soldat servers.

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Frosty's scripting thread
« Reply #143 on: November 21, 2010, 04:52:41 am »
When looking at your "scripts", I'm not surprised why he refuses to host them.
Quad Core CPU is enough for dozen soldat servers.
what he said ^

You probably had an infinite loop in there or something similar -.-

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Frosty's scripting thread
« Reply #144 on: November 23, 2010, 10:29:35 am »
Dual Quad Core actually, Frosty (like it says on the front page when logging in)... Why are you only just now posting about something that occurred 4 months ago and hasn't been a problem since? But anyway, as I mentioned to you in one of the original emails, your server was the ONLY one using 100% CPU, while the other heavily scripted zombie servers weren't. Your scripts were the cause, not server hardware or "just" DoDamage.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #145 on: November 25, 2010, 12:53:01 am »
well one reason i havent posted is because some idiot decided to get nasty so i gave up on dodamage, that was also 4 months ago just after the upgrade

DarkCrusade if you havent got anything helpful to say then dont say it, please...

well then can someone please go over this script? (attached) whats causing so much cpu usage?, at the moment cpu usage isnt a problem
however, as soon as i add a dodamage to this script, even just as a coommand where its only affecting ID not i out of 1 to 32 or whatever, it jumps to 100%, makes no sense since the average is 15%, thats what im saying, why would one line of dodamage cause so much cpu usage

there must be something seriously retarded with it, please point it out, id be very grateful if you could

just tried out dodamage by itself, not a problem, so there must be something in this script causing it to do that (only one im having trouble with)

please CONSTRUCTIVE criticism only!

Includes.txt also attached
« Last Edit: November 25, 2010, 12:57:59 am by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

DarkCrusade

  • Guest
Re: Frosty's scripting thread
« Reply #146 on: November 26, 2010, 12:31:41 pm »
What the fuck I didn't say anything, but now you make me post something you might don't want to hear. You want "constructive criticism", but for what? If you want features to be discussed, why do you ask for help with fixing bugs? One reason why everyone is pissed and trolling this topic is, that you are one of the worst programmers (if you deserve that title) I have seen in my entire lifetime. Everytime I view one of your buggy scripts I find errors that I have seen months ago somewhere else. You don't learn anything, and that should tell you you should stop. Sorry, but just find a new hobby.

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Frosty's scripting thread
« Reply #147 on: November 26, 2010, 01:34:05 pm »
What the f**k I didn't say anything, but now you make me post something you might don't want to hear. You want "constructive criticism", but for what? If you want features to be discussed, why do you ask for help with fixing bugs? One reason why everyone is pissed and trolling this topic is, that you are one of the worst programmers (if you deserve that title) I have seen in my entire lifetime. Everytime I view one of your buggy scripts I find errors that I have seen months ago somewhere else. You don't learn anything, and that should tell you you should stop. Sorry, but just find a new hobby.
nice rage.
* dnmr approves

Now for something more or less constructive. frosty.. You are using 6 scripts and you probably don't even realize how they work and if they are compatible at all :/

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #148 on: November 26, 2010, 05:26:50 pm »
dnmr how do i figure out if they are compatable?

and they are all used in the main scripts: Shop.pas and utils.pas

but sofar i have found nothing on the forum about "compatability" maybe i havent looked hard enough

DarkCrusade why did i post that? because all you did was troll for at least half the topic, not helping the situation at all, like you did just then, edit: btw since when is asking for scripting help in the SCRIPTING HELP AND DISCUSSION thread trolling?? u make no sense, going off like an idiot isnt HELPING either, i mean, if youve seen the bugs elsewhere like you claim then why not LINK to them at least?????????

or how other ways can i learn the pascal language, since i cant afford to do any courses for the real ones just yet

maybe i should spend a few months going through all the bugs pages....
« Last Edit: November 26, 2010, 10:57:56 pm by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Frosty's scripting thread
« Reply #149 on: November 26, 2010, 05:55:32 pm »
If your script eats AVERAGE OF 15% of cpu and you think that's low, then you have my personal congratulations sir!
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #150 on: November 26, 2010, 10:49:07 pm »
well, the whole server, im using like 20 scripts all up and the whole server uses an average of 10-15%

but seriously, how much CPU is a server "supposed" to use, and again how can i lower the usage? ive tried putting repeating code into functions and procedures, thats lowered it a little bit, i cant find anything on the net on how to shrink cpu usage of a pascal program, only can find how to write one and what the default syntax is, and a LITTLE bit on troubleshooting
« Last Edit: November 26, 2010, 11:01:19 pm by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

DarkCrusade

  • Guest
Re: Frosty's scripting thread
« Reply #151 on: November 27, 2010, 12:22:47 am »
You didn't understand what I said. My last post (before my rage) was on the 13th September. You replied to it being thankful. Now - months later - you tell me to shut up, because all I do is trolling and not helping. Why? I was the person helping you the most back then, when everyone else refused to because they were driven bonkers by what's making me mad right now. Your understanding of programming is that you put some code here and put some code there and it'll work the way you propose. Even if your code works, putting different code into different scripts won't help in any way, it rather makes everything worse. Many scripts instead of a single big one eat CPU and can cause servercrashs. Besides, it's just dumb, because it's harder to fix bugs, and it's even harder for someone who is starting with Soldat scripting to learn real programming.

Please, learn Pascal. Give it a harder try. There are books in libraries written in your language out there. It's the best for you.
 

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #152 on: November 27, 2010, 02:31:34 am »
ok, thankyou :D
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Frosty's scripting thread
« Reply #153 on: November 27, 2010, 04:47:56 am »
Quote
but seriously, how much CPU is a server "supposed" to use
0-1%

Let's look at one of your scripts
Code: [Select]
    for i:= 1 to 32 do if Getplayerstat(i,'Ping') > 0 then begin
      if SpeedTimer[i] > 0 then Speedtimer[i] := SpeedTimer[i] - 1;
      iniWrite('Players/'+IDtoname(i)+'.ini','stats','kills',inttostr(playerinfo[i].kills));
      iniWrite('Players/'+IDtoname(i)+'.ini','stats','tupred',inttostr(TUPred[i]));
      iniWrite('Players/'+IDtoname(i)+'.ini','stats','barkills',inttostr(barKills[i]));
      iniWrite('Players/'+IDtoname(i)+'.ini','stats','ranknum',inttostr(RankNum[i]));
    end;
...
 For z := 1 To ItemID Do begin
    if ItemInfo[z].Name='Massive Flak Gun' then begin
      for i := 1 to 32 do if (CheckPlayerDist(i,ItemInfo[z].x,Iteminfo[z].y,600)) AND (GetPlayerStat(i,'Team')<>ItemOwner[z].Team) then Shoot(ItemInfo[z].x,Iteminfo[z].y,GetPlayerStat(i,'x'),GetPlayerstat(i,'y'),500,1000,4,ItemOwner[z].PlayerID);
    end;
    if ItemInfo[z].Name='Auto Turret' then begin
      for i := 1 to 32 do if (CheckPlayerDist(i,ItemInfo[z].x,Iteminfo[z].y,600)) AND (GetPlayerStat(i,'Team')<>ItemOwner[z].Team) then Shoot(ItemInfo[z].x,Iteminfo[z].y,GetPlayerStat(i,'x'),GetPlayerstat(i,'y'),5000,1000,1,ItemOwner[z].PlayerID);
    end;

  for i := 1 to 32 do if (CheckPlayerDist(i,ItemInfo[z].x,Iteminfo[z].y,50)) AND (idtoname(i) = 'Mr.Zombie') then begin
and so on, and so on...
HORRIBLE way of coding, total lack of optimization, multiple loops with thousands of iterations, spaming with functions such as GetPlayerStat, checking distances and using heavy ini functions every second. How can you even ask why it has so big cpu use?
« Last Edit: November 27, 2010, 04:52:07 am by tk »

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #154 on: January 01, 2011, 04:00:32 am »
could someone please tell me why this is giving me an identifier expected error?

refined and fixed, only thing is i cant find whats causing this error, cant see any missing ';'

no missing begins or ends, otherwise my notepad++ would have told me about it

Quote
Shop -> [Error] (777:25): Identifier expected

maybe theres something else i need to take note of, all help appreciated

error located in Shop.pas (as far as i can tell)

maybe the script is corrupt? :S

btw to answer a previous question, ive got the code split up to make it easier to work on, that way im not scrolling through a thousand lines just to find something, (cant remember the actual code so ctrl+f is out of the question as the search would error "cannot find")

waiting on a few pascal books which i ordered over the net btw :D

another question, in one of my online references, it says that the Case argument is limited, just how "limited" is it exactly:

Pascal for beginners - Part 2

somehow i dont think that page is quite complete, but mind you it is several years old...

i tried using it, but after 4 or 5 case statements in the one Case...of it gives me a syntax error

could someone please enlighten me to exactly how many Case arguments you can fit into a case of statement

Code: (pascal) [Select]
Case Number of
1: ok;
2: ok;
3: ok;
4: maybe;
5: error;
end;
[/randommadeupcode]

:D thanks in advance
« Last Edit: January 01, 2011, 04:18:57 am by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Frosty's scripting thread
« Reply #155 on: January 01, 2011, 05:11:17 am »
btw to answer a previous question, ive got the code split up to make it easier to work on, that way im not scrolling through a thousand lines just to find something, (cant remember the actual code so ctrl+f is out of the question as the search would error "cannot find")
No, it's cause you're combining a number of scripts you don't actually understand and can't combine it. What you really should do is start from scratch and not allow yourself to copy anything from anywhere.

If you actually think about how you could get the information from the line number given by the soldat server the answer is pretty obvious.

(Line 136 in Shop.pas, I should add if I'm gonna be realistic)
« Last Edit: January 01, 2011, 05:15:18 am by Boblekonvolutt »

DarkCrusade

  • Guest
Re: Frosty's scripting thread
« Reply #156 on: January 01, 2011, 05:36:21 am »
Case statements are not limited, and the tutorial doesn't imply that. It just needs to end somewhere, and because you cannot add a ';' at the end you add an 'end;'.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #157 on: January 01, 2011, 06:10:19 pm »
so ill have to make my own ini writing and shooting procedure, i hope that pascal book comes in soon, i wonder how im going to remake that nova..

ill get there eventually i guess :)

thanks guys

From: January 01, 2011, 07:41:13 pm
i have another problem, one of my functions is calling a type mismatch error, compare the working code with the not working code

the function:
Code: (pascal) [Select]
function CheckPlayerAdmin(ID:Byte):Boolean;
begin
if ReadINI('Players/'+IDtoname(ID)+'.ini','stats','admin','0') = '1' then Result:=True;
end;

working code:
Code: (pascal) [Select]
function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
  Playerinfo[Shooter].achievements:=strtoint(ReadINI('Players/'+IDtoname(Shooter)+'.ini','stats','tna','0'));
  DamagePerc[Shooter]:=(RankNum[Shooter]*RankDamageMult)+Playerinfo[Shooter].achievements;
  if {CheckPlayerAdmin(Shooter)=True and }Getplayerstat(Victim,'alive') then CreateBullet(GetPlayerStat(Victim,'x'), GetPlayerStat(Victim,'y') - 0, 0,0,1, 10, Shooter);
  RankDam[Shooter]:=Damage+(Damage*(DamagePerc[Shooter]/100));
  result:=Damage + Rankdam[Shooter];
  if IDtoname(Shooter) = '[Warlord]Mr.Zombie' then begin
    DamCalc[Shooter]:=Damage+RankDam[Shooter];
    //Result:=DamCalc[Shooter]*(1/100);
  end;
end;

not working:
Code: (pascal) [Select]
function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
  Playerinfo[Shooter].achievements:=strtoint(ReadINI('Players/'+IDtoname(Shooter)+'.ini','stats','tna','0'));
  DamagePerc[Shooter]:=(RankNum[Shooter]*RankDamageMult)+Playerinfo[Shooter].achievements;
  if CheckPlayerAdmin(Shooter) and Getplayerstat(Victim,'alive') then CreateBullet(GetPlayerStat(Victim,'x'), GetPlayerStat(Victim,'y') - 0, 0,0,1, 10, Shooter);
  RankDam[Shooter]:=Damage+(Damage*(DamagePerc[Shooter]/100));
  result:=Damage + Rankdam[Shooter];
  if IDtoname(Shooter) = '[Warlord]Mr.Zombie' then begin
    DamCalc[Shooter]:=Damage+RankDam[Shooter];
    //Result:=DamCalc[Shooter]*(1/100);
  end;
end;

ALSO not working:
Code: (pascal) [Select]
function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
  Playerinfo[Shooter].achievements:=strtoint(ReadINI('Players/'+IDtoname(Shooter)+'.ini','stats','tna','0'));
  DamagePerc[Shooter]:=(RankNum[Shooter]*RankDamageMult)+Playerinfo[Shooter].achievements;
  if CheckPlayerAdmin(Shooter)=True and Getplayerstat(Victim,'alive') then CreateBullet(GetPlayerStat(Victim,'x'), GetPlayerStat(Victim,'y') - 0, 0,0,1, 10, Shooter);
  RankDam[Shooter]:=Damage+(Damage*(DamagePerc[Shooter]/100));
  result:=Damage + Rankdam[Shooter];
  if IDtoname(Shooter) = '[Warlord]Mr.Zombie' then begin
    DamCalc[Shooter]:=Damage+RankDam[Shooter];
    //Result:=DamCalc[Shooter]*(1/100);
  end;
end;

can anyone expain why this isnt working and why it has all of a sudden decided to error? its always worked up til now, i havent touched that section of code in my clean up so what the f*** :S
« Last Edit: January 01, 2011, 07:41:47 pm by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Frosty's scripting thread
« Reply #158 on: January 01, 2011, 07:54:30 pm »
store this admin value in some variable. With current code you're raping your hard drive each hit. Also 2nd code should work (this w/o =true). if it really doesn't then try "if (CheckPlayerAdmin(Shooter) = true) and ...".

Also admin advantage idea is ingenious. I think i said it already but i guess players hate/try to kick you for that every time you join lol.
« Last Edit: January 01, 2011, 07:57:37 pm by FalconPL »
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #159 on: January 01, 2011, 10:00:03 pm »
wtfffffff???????????
looks like the entire shop script is broke, or do i need to rewrite it (again)

can anyone see whats going on?

Shop -> [Error] (762:39): Type mismatch

i dont have much time to go through it properly

but the thing is, if i comment out OnPlayerCommand, the error automatically points to the next uncommented line

it sems no matter how many lines i comment out, i cant find the error, or is it, like you guys said, an imcompatability in the code = give up on shop and use my own functions?

im sorry about this guys :(
« Last Edit: January 01, 2011, 10:09:28 pm by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D