Author Topic: Scripting Engine Suggestions  (Read 25386 times)

0 Members and 1 Guest are viewing this topic.

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
Re: Scripting Engine Suggestions
« Reply #160 on: October 13, 2007, 08:16:35 pm »
...Maybe enabled only with -safe 0, to avoid noobs to post scripts that delete important files.

I think a good scripter (or one learnded wit soldatserverscript) would recognise scripts like that, but is a good idea for server owners who aren't so good with scripting (they might notice DeleteFile('Soldat.exe') somewhere in there and think something is wrong tho ;) )
"Be mindful of fame, show a mighty courage, watch against foes. Nor shalt thou lack what thou desirest, if with thy life thou hast comest out from that heroic task."

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Scripting Engine Suggestions
« Reply #161 on: October 13, 2007, 09:44:02 pm »
..... Because scripts run in folders where Soldat.exe is located. Totally.

Offline sai`ke

  • Camper
  • ***
  • Posts: 318
  • Can't be arsed to remove christmas avatar
Re: Scripting Engine Suggestions
« Reply #162 on: October 14, 2007, 08:00:38 am »
@enesce:
Is setplayerdeaths so hard to write?

Also, what do you mean by threadfunc being incompatible?
#soldat.ttw #ttw.gather --- Quakenet!
http://ttwforums.com

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Scripting Engine Suggestions
« Reply #163 on: October 14, 2007, 08:12:26 am »
Also, what do you mean by threadfunc being incompatible?
The script engine I use wasn't designed to run threads. It was just meant to be a simple "run once" system.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Scripting Engine Suggestions
« Reply #164 on: October 14, 2007, 06:41:05 pm »
So what is the main reason for ThreadFuncs to crash and is there a way to avoid it?
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Scripting Engine Suggestions
« Reply #165 on: October 14, 2007, 09:28:36 pm »
if I knew I would tell you... It has something to do with declaring variables in the thread, then when another procedure is called that declares variables too while the other thread is still running results in the thread going bonkers and throwing up various errors like invalid type, too many vars, access violation etc etc.

Offline chrisgbk

  • Moderator
  • Veteran
  • *****
  • Posts: 1739
Re: Scripting Engine Suggestions
« Reply #166 on: October 14, 2007, 11:57:09 pm »
So what is the main reason for ThreadFuncs to crash and is there a way to avoid it?
if I knew I would tell you... It has something to do with declaring variables in the thread, then when another procedure is called that declares variables too while the other thread is still running results in the thread going bonkers and throwing up various errors like invalid type, too many vars, access violation etc etc.

Basically the scripting engine isn't thread safe, so if there are multiple threads it ends up corrupting the internal state of the engine; you see errors like invalid op codes, or other error messages that appear randomly.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Scripting Engine Suggestions
« Reply #167 on: October 15, 2007, 05:12:48 pm »
just a thought ..
procedure OnJoinTeam(ID, var Team: byte);
function OnJoinTeam(ID, Team: byte): boolean;
or something.. mayb dont get rid of the current OnJoinTeam, and create a new event? :P

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Scripting Engine Suggestions
« Reply #168 on: October 15, 2007, 08:48:15 pm »
Dont suggest: Adding/Changing new parameters to any functions/events

Offline spkka

  • Camper
  • ***
  • Posts: 469
Re: Scripting Engine Suggestions
« Reply #169 on: October 15, 2007, 09:21:39 pm »
@enesce:
Is setplayerdeaths so hard to write?

so hard to answer?  :-*
« Last Edit: October 16, 2007, 04:26:55 am by spkka »

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Scripting Engine Suggestions
« Reply #170 on: October 16, 2007, 03:15:56 pm »
Dont suggest: Adding/Changing new parameters to any functions/events
Which is why I added "create a new event" :P it won't break anything :)

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
Re: Scripting Engine Suggestions
« Reply #171 on: October 17, 2007, 12:37:43 pm »
CreateSpark
creates some optical effects, if those aren't done completely clientside.

YES!!!

I think the syntax should be:
function CreateSpark(Name: string; X, Y, SpanX, SpanY: single; Scale: double; Delay, Damage: integer; Owner: Byte);

where...
Name is the file name
X and Y is where it appears at
SpanX and SpanY are the Damage radius (maybe set to 0,0 to use image boundaries)
Scale is the scale of image (to make it bigger) (0.50 is half normal size, 1.00 is normal size, 1.50 is 150% normal size
Delay is how long it takes to appear and fade (in ticks or ms) (60 ticks makes it dissapear by the end of one sec)
Damage is how much it hurts (same as weap damage)
Owner is owner of damage (player number)

good, bad, or impossible?

(Example: CreateSpark(*name of flame arrow spark*,100,-500,0,0,1.00,60,50000,1);
    Creates a flame arrow spark at 100,-500 for 1 sec. that does 50000 damage to person standing there)

would be useful for animated flames, sparks would use same "models" as their file name does in-game
« Last Edit: October 17, 2007, 12:42:46 pm by Kavukamari »
"Be mindful of fame, show a mighty courage, watch against foes. Nor shalt thou lack what thou desirest, if with thy life thou hast comest out from that heroic task."

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 703
Re: Scripting Engine Suggestions
« Reply #172 on: October 17, 2007, 07:07:43 pm »
It has something to do with declaring variables in the thread.

Is it possible to avoid the bugs if you don't declare variables in the thread and use only global variables? Or am I dreaming? :(
urraka

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Scripting Engine Suggestions
« Reply #173 on: October 17, 2007, 09:30:07 pm »
I am pretty sure it will still cause problems. And DorkeyDear, you should know you can't have duplicate events.

Regarding CreateSpark, such a thing can be created however the sparks only last for like 0.5 seconds on the client screen, to create any even half-decent effects you would need to call CreateSpark like 20 times in one go.... This is really bad as there will be uncontrollable ms delay (ping) between each call (Because each call has to be sent to the client one by one) which means the effect will be f**ked up between players. Also, high ping players will get ping spikes every time you send so many packets. I don't think CreateSpark will be very useful at all in the scripting engine.

And LOL @ Kavukamari, sparks don't do damage. They are just particles.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Scripting Engine Suggestions
« Reply #174 on: October 18, 2007, 05:37:47 am »
I am pretty sure it will still cause problems. And DorkeyDear, you should know you can't have duplicate events.
sry, thought renaming it was obvious, should have mentioned it :)
Regarding CreateSpark, such a thing can be created however the sparks only last for like 0.5 seconds on the client screen, to create any even half-decent effects you would need to call CreateSpark like 20 times in one go.... This is really bad as there will be uncontrollable ms delay (ping) between each call (Because each call has to be sent to the client one by one) which means the effect will be f**ked up between players. Also, high ping players will get ping spikes every time you send so many packets. I don't think CreateSpark will be very useful at all in the scripting engine.
Looks like we have to look forward to Soldat 1.4.3 with something in it that makes it draw the spark for a specified amount of time (either its a loop, or actually changing the length of until when spark dies) (if mm actually implements it, which is questionable) and getting server 2.6.4 to call that :P

Offline sai`ke

  • Camper
  • ***
  • Posts: 318
  • Can't be arsed to remove christmas avatar
Re: Scripting Engine Suggestions
« Reply #175 on: October 18, 2007, 08:44:44 am »
I think EnEsCe is right on this one. Placing single sparks is likely not very wise for bandwidth reasons.

It would be wiser to hard code particle effects or particles that last longer and just send emitter/spawning information back and forth with the server rather than doing them script sided or sending coordinates all the time.
« Last Edit: October 18, 2007, 08:47:18 am by sai`ke »
#soldat.ttw #ttw.gather --- Quakenet!
http://ttwforums.com

Offline Aquarius

  • Soldier
  • **
  • Posts: 234
Re: Scripting Engine Suggestions
« Reply #176 on: October 18, 2007, 11:36:48 am »
That's exactly what I proposed a few pages ago.

Quote from: Aquarius
SpawnParticles( [ParticleImages], ParticlesNum, ParticlesTime, X, Y, MinVelocity, MaxVelocity, MinAngle, MaxAngle )

The particles would be generated randomly client side according to the variables.

Offline xmRipper

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 742
    • Personal
Re: Scripting Engine Suggestions
« Reply #177 on: October 19, 2007, 10:59:14 am »
@EnEsCe:
Using 'result' in OnPlayerSpeak event could be awesome.
« Last Edit: October 19, 2007, 11:02:24 am by xmRipper »
Co-Founder / CTO @ Macellan
Founder Turkish Soldat Community

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Scripting Engine Suggestions
« Reply #178 on: October 19, 2007, 02:34:25 pm »
@EnEsCe:
Using 'result' in OnPlayerSpeak event could be awesome.
OnPlayerSpeak is threaded and cannot have a result..
plus also
Dont suggest: Adding/Changing new parameters to any functions/events
...
but if enesce would add a new OnPlayerSpeak (named something different), then we all could completely ignore the threaded one and make it so we can modify the text that somebody said.. and no scripts will be broken

EnEsCe: is picking up a bonus detected server-side?

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Scripting Engine Suggestions
« Reply #179 on: October 19, 2007, 10:30:46 pm »
Adding another function with a new name just makes scripting look unprofessional and ugly, and would confuse newcomers. Start making proper suggestions or this thread is just a waste of time...