The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Strain.
Author Message
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #1
Strain.
Yes it's a strange title but bear with me.

Looking into changing the way my environmental script runs it's checks on players, currently it's this:

Code:
ON=@Environchange
        if <isplayer>
            f_environ_calc
            if <def.tempaffect>
                if !(<restest 1 i_tempaffect>)
                    serv.newitem i_tempaffect
                    new.equip
                endif
                local.layer=3
                for 14
                    if (<dlocal.layer>==8)
                        local.layer=12
                    elif (<dlocal.layer>==14)
                        local.layer=17
                    elif (<dlocal.layer>==18)
                        local.layer=19
                    elif (<dlocal.layer>==21)
                        local.layer=22
                    endif    
                    if (<findlayer(<dlocal.layer>)>)
                        tag0.temp = <fval <tag0.temp>+1.0>
                    endif
                    local.layer +=1
                endfor
                if (<tag0.temp> < 32.0)
                    tag0.temp = <fval (<tag0.temp> + <eval (<src.rescold>/2)*10)>)>
                elif (<tag0.temp> > 80.0)
                    tag0.temp = <fval (<tag0.temp> - <eval (<src.resfire>/2)*10)>)>
                endif
            endif
        endif

While this is a simple check to see what the current region temperature is and a check to see what the player is wearing it does create problems on a populated server with the @environchange trigger firing quite often (something I was never encountered on my private test server)

This script already runs a seperate timekeeping function under the f_onserver_timer function firing each minute. Would including a player check under this timer create a bunch of lag?
That's my question

And my noob question of the day because it's slipped my mind....

someone please remind me what value fval returns.Blush

[EDIT:]Wow looking at this on my server NONE of the weather effects even seem to work anymore which is a tad bit disappointing, has anyone using these forums run this script on the latest nightly builds?....
Thinking this could be a complete rebuild from scratch deal here

[Image: 2nis46r.jpg]
(This post was last modified: 08-17-2012 01:43 PM by Mordaunt.)
08-17-2012 01:15 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #2
RE: Strain.
Im using similar thing on @Environchange with maximum of 80 players, never had lag issue. But if you want a faster method you can store players layer on=@itemequip and on=@itemunequip in a tag, then you don't need to use for loop in every @environchangemethod.

You can get detailed information about your functions with enabling script profiler from sphere.ini. then when you write p# on console sphere writes all data about triggers and functions inti profiler_dump.txt.
(This post was last modified: 08-17-2012 01:46 PM by Shaklaban.)
08-17-2012 01:44 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #3
RE: Strain.
Still need to run the check for the temperature though....

is weather broken or something? Been going through checking bits and pieces seems as though sector.rain and sector.snow don't do anything anymore, though it does cause @environchange to fire

[Image: 2nis46r.jpg]
(This post was last modified: 08-17-2012 01:53 PM by Mordaunt.)
08-17-2012 01:52 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #4
RE: Strain.
hmm i never tried with weather, mine is basic thing only controls for terrain and if there is a snow if (<isneartype t_snow>) and player has not weared clothes player get cold like:
Code:
[function getcold]
if (<body> = c_woman)
    dorand 2
        sound 817
        sound 818
    enddo
else
    dorand 2
        sound 1091
        sound 1092
    enddo    
endif    
sayua 075,6,6,0 *brr*
(This post was last modified: 08-17-2012 02:00 PM by Shaklaban.)
08-17-2012 02:00 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #5
RE: Strain.
I'm thinking in about something like this:
One handler that have a timer, 60 seconds, and send serv.allclients a function to check if where the player is with the right environ. The first time, the script looks what should be the environ in the moment and set it and set one tag in the region/sector i don't know, preventing it to get evaluated again for some time.

Example:

Code:
[ITEMDEF BLA BLA]
ON=@TIMER
SERV.ALLCLIENTS TIMERF <R10>,F_CHECK_ENVIRON
TIMER 60
RETURN 1

[FUNCTION F_CHECK_ENVIRON]
IF <REGION.TAG.CHECKED> && <SECTOR.TAG.CHECKED> // Can we set tag in sector?
RETURN 1
ENDIF

// It's not checked for some time then check it and set
// Now preventing it be rechecked in few time

REGION.TAG.CHECKED 1
SECTOR.TAG.CHECKED 1 // ?? =D
TIMERF <R30,45>,REGION.TAG.CHECKED 0
TIMERF <R30,45>,SECTOR.TAG.CHECKED 0 // ??
Assuming that lots of sector/regions will not update everytime unless players are there.
If 2+ players in the same sector/region, it will be checked only one time.

This is the best idea that I had.
Using the 'serv.rtime' would be very very nice too.
Right now we need get USE for the GameMinuteLength in sphere.ini =D

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
08-17-2012 02:32 PM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #6
RE: Strain.
FVAL returns a floating point result (it puts a decimal point right before the last digit)
08-18-2012 01:00 AM
Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #7
RE: Strain.
A small fix and suggestion to your Environ System Mord:

Quote:[FUNCTION f_lightning_strike]
if (<isgm>) || (<flags> & statf_indoors) || (<flags> & statf_dead) || (<flags> & statf_freeze)
return 1
else
if (<r<ddef.lightning_strike>> == 1)
effect 1,1,1,1,1
sysmessage @,,1 You have been struck by lightning!
hits-=<eval <hits>/2>
if <flags> & statf_onhorse
dismount
anim 21
endif
if <hits> == 0
serv.log EnvironSystem: <name> killed by a lightning strike
endif

endif
endif
Falling from horse and anim 21 is nice hahahaha looks real!

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
(This post was last modified: 08-18-2012 01:04 AM by Extreme.)
08-18-2012 01:03 AM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #8
RE: Strain.
@Extreme, that's not a bad idea lol

Even without my system on the older versions of the server you could change the weather in a sector with

sector.snow
sector.rain

and I beleive

sector.weather <x value>

Checking on it last night before I went to bed, regardless what I entered sector.weather always returned a value of 255.
I am assuming it is currently broken

[Image: 2nis46r.jpg]
08-18-2012 03:19 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #9
RE: Strain.
*facepalm*

helps if i have weather turned on in sphere.ini

[Image: 2nis46r.jpg]
08-18-2012 05:32 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #10
RE: Strain.
NoWeather = 0 or 1?
1 disables weather, 0 enables...
I set 0 and don't tested with set 1.

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
08-18-2012 09:43 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)