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

0 Members and 2 Guests are viewing this topic.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #60 on: July 21, 2010, 11:51:18 pm »
ok, ive added in if get player stat active  but its still hanging
check out my server! click here

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

DarkCrusade

  • Guest
Re: Frosty's scripting thread
« Reply #61 on: July 22, 2010, 02:33:43 am »
Grrr Grrrr Grrrr


RAWR



/ragequit

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Frosty's scripting thread
« Reply #62 on: July 22, 2010, 09:42:04 am »
Sleep(5);
Sleep(5);
Sleep(5);
Sleep(5);
Sleep(5);
Sleep(5);
Sleep(5);
FFS DON'T USE SLEEP.
And as the whole fucking code showed you didn't even try to fix your code.
Do it or gtfo here.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #63 on: July 22, 2010, 12:58:46 pm »
/rage

READ BEFORE YOU POST FFS!!!!! YOU PEOPLE DONT f**kING READ THEN WONDER WHY WHY PEOPLE GET f**kING UPSET!!!

Quote
i will fix up the code when this bug is fixed

but fine i have removed sleep from the full code and its still hanging, any other suggestions?

and like i said before, its the fixed parts that are causing the server to hang, the rest of the weapons DONT hang the server, i could mass spawn with the rest of the weapons and i only get a tiny bit of lag
« Last Edit: July 22, 2010, 01:06:32 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 #64 on: July 22, 2010, 01:13:24 pm »
READ BEFORE YOU POST FFS!!!!! YOU PEOPLE DONT f**kING READ THEN WONDER WHY WHY PEOPLE GET f**kING UPSET!!!

Oh, the irony. Oh...

So I told you 3 times that whenever you access an ID in a loop you must check whether the ID is active. Now you get angry over this? Okay. My work is done.

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Frosty's scripting thread
« Reply #65 on: July 22, 2010, 01:17:39 pm »
Btw, why is the 'active' check needed since we check 'alive' too? 'Alive' will not return true if 'active' is false anyway.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #66 on: July 22, 2010, 01:18:32 pm »
Dark when u said that the first time you failed to read what i posted, you then posted that another 2 times and then wonder why im getting angry...

2 words: blame yourself

Quote
do it or gtfo
let me hurt you a bit here, Swompie, only an idiot would say that unless ur a naive -12 who cant even get a single peice of homework done without any help, or unless you a school dropout, since u failed to read what i posted DIRECTLY after Dark said to check if an ID is active and to fix my code, i see that as an epic fail considering how much coding you have "apparently" done, and, didnt your mother teach you any manners?

as for you: Dark, you should know better than that as you ALSO failed to read what i had posted resulting in you having to post it 3 times, bad, bad, bad :(
« Last Edit: July 22, 2010, 01:32:23 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 #67 on: July 22, 2010, 01:54:34 pm »
I don't know whether to laugh or to cry. Get the facts straight, frosty. You want us to help you, yet you are raging against us. It's not very admirable that you put it the way that your errors are ours instead of taking critique like a man.

The only person that is blaming itself is you. As you fail to understand the basics of Soldat's most usual syntax (and the most common English grammar) I am quit bothered about your mental abilities, that - not to sound rude - needs attention of a good doctor.

I don't attempt to troll or insult you, but you didn't leave it open to me as you apparently decided that it'd be the best to piss me off as much as you can (and you did), so I don't see any reason why I should be gentle.

To be frank: As you lack basic programming skills and enough maturity to take critique I will not respond  in this thread anymore and ignore personal requests, too. Learn from your failures and hopefully grow up soon.   

Once and for all: Learn to take critique.
« Last Edit: July 22, 2010, 08:17:56 pm by DarkCrusade »

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: Frosty's scripting thread
« Reply #68 on: July 22, 2010, 04:24:48 pm »
Btw, why is the 'active' check needed since we check 'alive' too? 'Alive' will not return true if 'active' is false anyway.
i think that "Active" checks that player is IN GAME, but "Alive"... i think you understand it, checks that you are dead or not... so what is different? ask yourself

btw, this topic is funny...  ^^
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #69 on: July 22, 2010, 07:57:31 pm »
ok. fine, was just pointing out a fact, i didnt mean to piss you off but i was quite irritated at the time, and i apologize for pissing you off
end of argument

but could you plz help me with one last thing
Quote
i have come accross a wierd bug, i made this script: (attached) which logs everything to a single log file, (Text, Commands, Team Joins and Exceptions)

only problem is, with the OnCommand Section there, instead of the command going through, it just logs the command and then does nothing, how do i get around this? (not released yet due to this bug so dont go searching)

For your info the section i am having trouble with is commented out

edit: just so you know, ive fixed the code and its still hanging, but if i replace dodamgeby with createBullet then it doesnt hang but most of the time it misses, so why dodamageby isnt working...idk and i dont care cuz all its done is caused an argument, i knew, i KNEW that fixing the code wouldnt have made any difference, cuz if the ONE section that im triggering that is "fixed" isnt working, then why would any other section with the same code work when, my code doesnt make the server hang, idfk and i dont care, like i said earlier, i give up on dodamgeby

ive done everything everyone has suggested and its still not working, so then you all blame me, its not my fault that dodamageby isnt working, idfk why it isnt working. all i know is when i dont use it, my server doesnt hang

« Last Edit: July 22, 2010, 08:32:56 pm by frosty »
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 #70 on: July 23, 2010, 01:43:13 am »
Btw, why is the 'active' check needed since we check 'alive' too? 'Alive' will not return true if 'active' is false anyway.
i think that "Active" checks that player is IN GAME, but "Alive"... i think you understand it, checks that you are dead or not... so what is different? ask yourself

btw, this topic is funny...  ^^

If you can't understand the question, don't answer or read it a few times more please.
« Last Edit: July 23, 2010, 01:45:16 am by tk »

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Frosty's scripting thread
« Reply #71 on: July 23, 2010, 02:36:36 am »
Quote
i have come accross a wierd bug, i made this script: (attached) which logs everything to a single log file, (Text, Commands, Team Joins and Exceptions)

only problem is, with the OnCommand Section there, instead of the command going through, it just logs the command and then does nothing, how do i get around this? (not released yet due to this bug so dont go searching)

You can disable commands from going through by setting result to true, therefore make sure it is set to false right before the end of the onCommand function.
« Last Edit: July 23, 2010, 02:38:43 am by chutem »
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Frosty's scripting thread
« Reply #72 on: July 23, 2010, 02:40:14 pm »
Btw, why is the 'active' check needed since we check 'alive' too? 'Alive' will not return true if 'active' is false anyway.
apparently getplayerstat likes to touch the memory in inappropriate places if you request any info about an inactive player (and that includes 'Alive' as far as im concerned)

Edit: forgot to add - "your results may vary" (ofc it's more intense on some systems than on others)

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #73 on: July 23, 2010, 07:09:01 pm »
thanks :D


Great, looks like File Uploading is down on my host, cant upload anything at all so now i gotta wait, sent the host a message, still waiting for a reply, Great now im screwed for the day, always the way, i go to test something and it doesnt work due to host issues, or when im not in the mood its working perfectly, whenever i want to do some coding theres a problem with the host so i cant do much, and i cant start a server on my comp cuz it doesnt like the soldatserver for some bizzarre reason, whenever i try it i get a blue screen, obviously my comp cant handle the epicness that is soldatserver, grrr....

From: July 24, 2010, 03:23:12 am
question, how do i set result? "unknown identifier "result""

Code: (pascal) [Select]
procedure OnPlayerCommand(ID: Byte; Text: string);
begin
WriteLnFile('PlayerSpeech/PlayerSpeechLog-'+FormatDate('dd')+'-'+FormatDate('mm')+'-'+FormatDate('yyyy')+'.txt',FormatDate('hh:mm am/pm')+'::'+IDtoname(ID)+'::'+Text);
Result:=False;
end;
« Last Edit: July 24, 2010, 03:23:12 am by frosty »
check out my server! click here

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

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Frosty's scripting thread
« Reply #74 on: July 24, 2010, 04:32:42 am »
http://pascalprogramming.byethost15.com/lesson7.php

http://enesce.com/help/html/Events/OnPlayerCommand.html

You made nine (9) spelling errors in the word "function" and forgot to declare the result var

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #75 on: July 24, 2010, 08:56:30 pm »
thanks dnmr :D

From: July 25, 2010, 01:40:05 am
wow that has also solved the lagging issue ive been having, now createbullet hits no matter what, just from setting the main part of code into its own procedure instead of constantly repeating, thanks dnmr :D

i will test this with DoDamageBy a bit later and post my results, but for now my procedure is this, its so much more effective than my old code :)

Code: (pascal) [Select]
procedure RangeKill(Owner, Victim, Range, VelX ,VelY, HitMult, BulletType:Integer);
var i:Byte;
begin
     x := GetPlayerStat(Victim,'x');
     y := GetPlayerStat(Victim,'y');
      for i := 1 to 32 do begin
       x2 := GetPlayerStat(i,'x');
       y2 := GetPlayerStat(i,'y');
       if (RayCast(x,y,x2,y2,Dist,Range)) AND (i <> Owner) AND (GetPlayerStat(i,'Active') = true) AND (GetPlayerStat(i,'Team') <> GetPlayerStat(Owner,'Team')) then begin
         CreateBullet(GetPlayerStat(i,'x'), GetPlayerStat(i,'y') - 0, VelX,VelY,HitMult, BulletType, Owner);
BioKills[Owner]:=BioKills[Owner]+1;
       end;
     end;
     WriteConsole(Owner,'Bio-Kills: '+Inttostr(BioKills[Owner]),$EE81FAA1);
     BioKills[Owner] := 0;
end;

From: July 25, 2010, 01:56:45 am
ok i have tried with DoDamageBy, but its still not quite working, first off it kills me even it says not o if i isnt owner of kill, bit odd, its not hanging as much, or causing the script to crash as much, now it only crashes once per use, and its only causing lag, maybe im getting somewhere here

procedure seems to work better than function, but, should it be function?

anyways, full code attached

From: July 25, 2010, 02:03:40 am
edit, lol i just changed procedure to function and swapped i for Owner in DoDamageBy now it works perfect :D, reuploaded working file :D



From: July 25, 2010, 02:06:51 am
nvm its still lagging like a dumbshit, i give up, does teh code work alrite for everyone else? if yes then the problem lies in one of my other scripts, need to refine them if thats the case
« Last Edit: July 25, 2010, 02:06:51 am by frosty »
check out my server! click here

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

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Frosty's scripting thread
« Reply #76 on: July 25, 2010, 04:37:18 am »
Code: [Select]
(GetPlayerStat(i,'Team') <> GetPlayerStat(Owner,'Team'))Hold the team of owner in a variable since it won't change in that loop.
Code: [Select]
Team := GetPlayerStat(Owner, 'Team');
for i := 1 to 32 do
if (..) and (Team <> GetPlayerStat(i, 'Team') then

Also why -0 here?
Code: [Select]
GetPlayerStat(i,'y') - 0
Quote
other scripts
Just disable them to see if they cause the errors.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #77 on: July 25, 2010, 09:32:58 pm »
thanks swompie, im getting an access violation error after testing this script on its own which caused the server to crash, here it is:

Code: [Select]
(12:30:34)  [*] [Error] Achievement -> OnPlayerKill: Access violation at address 0808AD0E, accessing address 0160000C
and once again i got spammed with script crashes, first the server hung, then the script crashed 5 times in a row before i got a CP and CT

i also got spammed with kills (got to 100 in just a few seconds) just before the server hung, very, very interesting, wth is causing such a loop?

so whats wrong with the OnplayerKill section?

« Last Edit: July 28, 2010, 12:57:49 pm 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 #78 on: July 28, 2010, 01:22:29 am »
i really dont get this, its doing nearly 10 createbullets, if not more for every kill, if theres 6 kills theres 6 createbullets done on each victim, give or take, some of these createbullets are being done when the victim is dead, wtf?? look at the attachment, Function RangeKill

would someone mind shedding some light on the problem as the only loop im seeing is to check if the zombies are in range, or is it becuase im using Shotgun Shells on the barret? o.0, maybe its my wep mod? (also attached, named Onehit.ini)

also does anyone have the original weapons.ini unchanged? i want to revert back to original wep settings without reinstalling soldat in order to get the file

edit: found a mistake, fixed the mistake but its still doing the same thing, reuploaded
« Last Edit: July 28, 2010, 12:59:22 pm 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 #79 on: August 06, 2010, 08:32:26 pm »
hi guys, i want to do something a little advanced here using code thats repeated quite a bit and i was wondering if its possible or how to get around this

Code: (pascal) [Select]
procedure ForceAchUpdate(ID:Byte; Ach:String); //will update current accounts with new achievements to get as the players join (going to use in OnJoinTeam)
begin
if ReadINI('Players/'+IDtoname(ID)+'.ini','achievements',Ach,'*ERROR*') = '*ERROR*' then iniWrite('Players/'+IDtoname(ID)+'.ini','achievements',Ach,'0');
      if ReadINI('Players/'+IDtoname(ID)+'.ini','achievements',Ach,'*ERROR while loading achievement*') = '1' then Ach:=True; //Replaces Ach with the string in the sytax so say if i use ForceAchUpdate(ID, 'yeahyeah')'; it should make Ach[ID] into yeahyeah[ID] where i want to use the code, but i get a type mismatch error here as Ach isnt an array
      if ReadINI('Players/'+IDtoname(ID)+'.ini','achievements',Ach,'*ERROR while loading achievement*') = '0' then Ach[ID]:=False;
end;

will defining Ach as an array of string work here? or will it give me other results? just curious

edit: nvm, maybe i should just experiment more before asking stuff, worked it out, this works perfect

Code: (pascal) [Select]
procedure ForceAchUpdate(ID:Byte; Ach:String; Boolvar:array [1..32] of Boolean);
begin
if ReadINI('Players/'+IDtoname(ID)+'.ini','achievements',Ach,'*ERROR*') = '*ERROR*' then iniWrite('Players/'+IDtoname(ID)+'.ini','achievements',Ach[ID],'0');
      if ReadINI('Players/'+IDtoname(ID)+'.ini','achievements',Ach,'*ERROR while loading achievement*') = '1' then Boolvar[ID]:=True;
      if ReadINI('Players/'+IDtoname(ID)+'.ini','achievements',Ach,'*ERROR while loading achievement*') = '0' then Boolvar[ID]:=False;
end;

edit2: no its not, need some help here, its not setting the Boolvar correctly so should i try something else?
« Last Edit: August 07, 2010, 12:01:48 am by frosty »
check out my server! click here

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