Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: Bydlak on July 23, 2013, 02:24:30 pm

Title: Scripts on 1.6.4 version
Post by: Bydlak on July 23, 2013, 02:24:30 pm
Hi

Do scripts which worked well on 1.6.3 version have to be updated or reconstructed to use them on 1.6.4?

After moving serv from old version to 1.6.4 some of scripts didn't work or worked in other way than before. Dunno is that the scripts issue or the serv problem.
Title: Re: Scripts on 1.6.4 version
Post by: DarkCrusade on July 23, 2013, 02:58:26 pm
The old scriptcore (SC2, that is) is still working. Scripts that use the new scriptcore differ in structure, so your scripts should be running perfectly fine. Could you post some log files that give us some insight on what's actually bothering the server?
Title: Re: Scripts on 1.6.4 version
Post by: Vos on July 23, 2013, 03:11:58 pm
I also have and had allot of trouble with the scripts on my servers.

To be honest I find it kind of strange that there is nothing mentioned in the changelog regarding scriptcore changes and whatever else changed regarding the scripts.

But, it's being worked on for now.
Title: Re: Scripts on 1.6.4 version
Post by: DarkCrusade on July 23, 2013, 03:52:49 pm
From my understanding, Falcon spend a lot of time to finish SC3 for it to be ready for the release and with all the new fancy stuff, we need a thorough documentation, which is being worked on. Just give it some time! After all, how long have we waited for this release? ;)
Title: Re: Scripts on 1.6.4 version
Post by: Silnikos on July 23, 2013, 03:58:37 pm
"Exception: Invalid variant type cast" all day, all night.

Everything worked fine before the patch, now I get above error for lines defining variables, like this:

 alpha_players := alpha_players+idtoname(i)+' ('+GetPlayerStat(i,'Kills')+'/'+GetPlayerStat(i,'Deaths')+', F:'+GetPlayerStat(i,'Flags')+'); ';
Title: Re: Scripts on 1.6.4 version
Post by: DarkCrusade on July 23, 2013, 04:48:17 pm
This should be working:

Code: (pascal) [Select]
var alpha_players:string;
alpha_players := alpha_players+idtoname(i)+' ('+inttostr(getplayerstat(i,'kills'))+'/'+inttostr(getplayerstat(i,'deaths'))+', F:'+inttostr(getplayerstat(i,'flags')+'); ';

I do not even know why that should have been working in the older script core. Something like what you typed above works in newer programming languages, but you have to turn your integer values to string values to save them in 'alpha_players' ;)
Title: Re: Scripts on 1.6.4 version
Post by: Falcon` on July 23, 2013, 04:48:39 pm
tl;dr: If your script was written without obvious bugs like missing semicolons, it should work on new server without problems.

I did everything i could to preserve backward compatibility but unfortunately it's not complete. This is a result of various things, mostly because of updating Pascal Script (scriptcore's engine) to newest version and switching from Delphi 7 to Free Pascal Compiler. Those are things that i couldn't influence by much and i couldn't also fix without putting some serious amount of work into it.
Errors you'll see appearing mostly:

If you encounter any other problems which you cannot solve yourself then please either reply here, or ask on #soldat.devs. Or if the errors seems to be API related, report it on bugtracker (http://bugs.soldat.pl)

Sorry for the inconvenience.
Title: Re: Scripts on 1.6.4 version
Post by: No-Mercy on July 23, 2013, 07:30:08 pm
70 % of old scripts don't work now!
Title: Re: Scripts on 1.6.4 version
Post by: Silnikos on July 24, 2013, 12:38:59 am
This should be working:

I do not even know why that should have been working in the older script core. Something like what you typed above works in newer programming languages, but you have to turn your integer values to string values to save them in 'alpha_players' ;)

Yeah that's my mistake, I didn't even checked that because it used to work in the old server version somehow.
Title: Re: Scripts on 1.6.4 version
Post by: DarkCrusade on July 24, 2013, 08:01:56 am
These 'errors' are but mere reminders of variables or comparisons that are not needed. Float conversion is bugged, though, but will be fixed soon.
Title: Re: Scripts on 1.6.4 version
Post by: Mittsu on July 24, 2013, 09:12:12 am
check at ARSSE what errors those scripts give when compiling, it will tell you what to do (at least it did for me)
Title: Re: Scripts on 1.6.4 version
Post by: Falcon` on July 24, 2013, 10:47:09 am
perhaps paste that wrong line here so we can help you sort it out.
Title: Re: Scripts on 1.6.4 version
Post by: skrX on July 24, 2013, 01:01:27 pm
@Akinaro: This script, stats with rank was not tested the current version core (2.7.4) for this reason, there are complications.
It is intended only for version 2.7.3. I'll probably have to update the script.
Title: Re: Scripts on 1.6.4 version
Post by: Hubiq on July 24, 2013, 03:46:28 pm
On the new version does not work all the scripts? Or just some?
Title: Re: Scripts on 1.6.4 version
Post by: Bydlak on July 24, 2013, 04:01:14 pm
Well I have a problem with that scripts:

1. Nextmap Voting: http://forums.soldat.pl/index.php?topic=13382.msg150372#msg150372
   Server Visits    :  http://forums.soldat.pl/index.php?topic=35003.msg453082#msg453082
   Stats and rang : http://forums.soldat.pl/index.php?topic=35944.msg437083#msg437083

The problem is that plenty of figures "0" are added after comma. example: 25.00000000000000% voted on next map or daily server visits: 162,00000000000000.
It doesn't looks good :)
Stats and rang are complitely broken couse there are only zeros everywhere

2. The script which is called "Spawn Shield" doesn't work as well



Anybody knows how to rewrite these scripts to the new soldat version?  ;)
Title: Re: Scripts on 1.6.4 version
Post by: skrX on July 24, 2013, 04:23:35 pm
Don't panic :P
Comming soon, some scripts will be updated. But, not all. Most scripts have a few years, a lot of change not enough ... so, this is problem.

The problem is usually rate, split ... or something :S
Title: Re: Scripts on 1.6.4 version
Post by: No-Mercy on July 24, 2013, 04:27:03 pm
I have problems whit: Kdratio, Publictools! Stats whit rank works fine for me!
Title: Re: Scripts on 1.6.4 version
Post by: skrX on July 24, 2013, 04:30:53 pm
@No-Mercy: Yes, I must update publictools and stats with rank. The issue lies in rate. I think that, make it to the end of the week.
Title: Re: Scripts on 1.6.4 version
Post by: No-Mercy on July 24, 2013, 05:43:06 pm
@No-Mercy: Yes, I must update publictools and stats with rank. The issue lies in rate. I think that, make it to the end of the week.

For publictools I solved whit Basics and edit something.
In Stats whit rank, yes the problem it is whit Kd ratio, thanks in advance.
Will be able to create even a k/d top permanently?
Title: Re: Scripts on 1.6.4 version
Post by: Bonecrusher on July 25, 2013, 06:45:10 am
I wish we could choose between old and 'new' scriptcore
Title: Re: Scripts on 1.6.4 version
Post by: Bonecrusher on July 25, 2013, 07:15:58 am
Also this: http://forums.soldat.pl/index.php?topic=42758.0
Title: Re: Scripts on 1.6.4 version
Post by: Falcon` on July 25, 2013, 07:26:09 am
I wish we could choose between old and 'new' scriptcore
I wish people were writing their scripts with common sense. Then they'd notice that there actually is a choice between "new" and "old" scriptcore.

Most of those errors are because scripts were poorly written. What new compiler does is simply being more restrictive. I'm not saying that this is allright because it's clearly not, i'm just saying that it's not only me to blame. If you're looking for the 2nd guilty person, look into the mirror.

Also absolutely nobody dared to test scriptcore in any of 4 released RC versions. Maybe if you did, we could together do something to prevent it earlier. But you didn't. Now live with it.
Title: Re: Scripts on 1.6.4 version
Post by: Vos on July 25, 2013, 09:43:05 am
NVM

edit: was everyone able to test the new scriptcore? or just the beta team
Title: Re: Scripts on 1.6.4 version
Post by: Falcon` on July 25, 2013, 09:58:28 am
Were RC releases public? I think they were. At least three of them.
Title: Re: Scripts on 1.6.4 version
Post by: Vos on July 25, 2013, 10:13:54 am
Didn't know they were working with the new scriptcore already tbh, didnt read that anywhere either.. but might have missed that
Title: Re: Scripts on 1.6.4 version
Post by: Falcon` on July 25, 2013, 10:40:31 am
It's not about new scriptcore, as i mentioned above it's about changing compiler to FPC and PascalScript to newest. New scriptcore is seperated.
Title: Re: Scripts on 1.6.4 version
Post by: Hubiq on July 25, 2013, 02:24:53 pm
Which scripts do not work? Only the more complicated? e.g. killing sprees, track, awards, ratio, stats etc.?
Title: Re: Scripts on 1.6.4 version
Post by: skrX on July 26, 2013, 05:25:06 am
Most scripts that have 'ratio' or split something.
Title: Re: Scripts on 1.6.4 version
Post by: Vos on July 26, 2013, 05:44:38 am
basically every script that has percentages and numbers rolling
Title: Re: Scripts on 1.6.4 version
Post by: JotEmI on July 26, 2013, 10:05:53 am
I don't know if anyone else noticed but apparently some object styles in SpawnObjet() and GetObjectStat() have changed.
E.g. knife used to have ObjTyp=12 in SpawnObject() and now it's 13, 12 is chainsaw now.
Title: Re: Scripts on 1.6.4 version
Post by: Falcon` on July 26, 2013, 11:16:12 am
It wasn't desired. Report it on mantis maybe so i don't forget about it.
Title: Re: Scripts on 1.6.4 version
Post by: skrX on July 26, 2013, 01:33:06 pm
2.7.3

Title: Re: Scripts on 1.6.4 version
Post by: JotEmI on July 26, 2013, 07:33:29 pm
It wasn't desired. Report it on mantis maybe so i don't forget about it.

Here you go http://bugs.soldat.pl/view.php?id=346
Title: Re: Scripts on 1.6.4 version
Post by: Mittsu on July 27, 2013, 02:53:16 am
there's this little problem with displaying statistics with too many zeros

(http://img209.imageshack.us/img209/7540/ydor.jpg)
Title: Re: Scripts on 1.6.4 version
Post by: JotEmI on July 27, 2013, 03:11:15 am
there's this little problem with displaying statistics with too many zeros

(http://img209.imageshack.us/img209/7540/ydor.jpg)
Use FormatFloat('format',float_value) instead of FloatToStr() to get rid of them.
http://www.delphibasics.co.uk/RTL.asp?Name=FormatFloat
Title: Re: Scripts on 1.6.4 version
Post by: Mittsu on July 27, 2013, 03:35:06 am
thanks
Title: Re: Scripts on 1.6.4 version
Post by: Bydlak on August 08, 2013, 04:51:55 pm
Well I have no idea how to use the FormatFloat to get rit of the zeros in both scripts and I can't find anybody who has fixed them.
Have anybody fixed this or could show me a way how to do it? I would be grateful
Title: Re: Scripts on 1.6.4 version
Post by: Falcon` on August 08, 2013, 05:16:21 pm
Replace every "FloatToStr(" with "FormatFloat('', "
Title: Re: Scripts on 1.6.4 version
Post by: skrX on August 09, 2013, 07:30:07 am
For those who still have problems with this:

Example:
Code: [Select]
FloattoStr(RoundTo(100 * Total / NumPlayers, 2))

FormatFloat('value',code)
FormatFloat('00',RoundTo(100 * Total / NumPlayers, 2))
Title: Re: Scripts on 1.6.4 version
Post by: Mighty on August 09, 2013, 08:05:02 am
For those who still have problems with this:

Example:
Code: [Select]
FloattoStr(RoundTo(100 * Total / NumPlayers, 2))

FormatFloat('value',code)
FormatFloat('00',RoundTo(100 * Total / NumPlayers, 2))

Code: [Select]
FormatFloat('##0.##',100.00 * Total / NumPlayers);Works fine without RoundTo. Unless that 0.009% makes a difference
Title: Re: Scripts on 1.6.4 version
Post by: dominikkk26 on August 10, 2013, 01:01:40 am
Somewhere on bugtracket, I read that the problem only occurs on servers running Windows. But I do like the falcon wrote in his guide, and you should be fine.