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
Need help in general Scripting
Author Message
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #41
RE: Need help in general Scripting
src.newitem sets as ACT the item created, the same goes for src.makeitem ... the crafted item becomes act, you can use REFx to store UIDs and work with them to avoid this and some other conflicts, eg:

Code:
SERV.NEWITEM <TAG.ID>
REF1=<NEW>
if ( (<REF1.TYPE> == t_potion) && (<SRC.RESTEST i_bottle_empty> == 0) )
SRC.SYSMESSAGE You have no bottles for your potion.
elseif (<SRC.RESTEST <REF1.RESOURCES>> == 0 )
SRC.SYSMESSAGE You need <REF1.RESMAKE> to produce <REF1.NAME>.
elseif ( !<SRC.CANMAKE <REF1.BASEID>> )
SRC.SYSMESSAGE You haven't got the faintest idea on how to produce <REF1..NAME>.
else
SRC.SYSMESSAGE You start producing <REF1.NAME>.
SRC.MAKEITEM = <TAG.ID>
SRC.TAG.MAKEITEM.LEVEL = <TAG.SKILL>
endif
REF1.REMOVE
return 1
05-03-2016 01:09 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes XuN's post
Fronz
Apprentice
*

Posts: 36
Likes Given: 2
Likes Received: 0 in 0 posts
Joined: Apr 2016
Reputation: 0



Post: #42
RE: Need help in general Scripting
You Sir are a Lifesaver.

It works flawlessly.

I can't thank you enough. I'm going to read and learn more about that!

Many Many Thanks,
Fronz
05-03-2016 01:40 AM
Find all posts by this user Like Post Quote this message in a reply
Fronz
Apprentice
*

Posts: 36
Likes Given: 2
Likes Received: 0 in 0 posts
Joined: Apr 2016
Reputation: 0



Post: #43
RE: Need help in general Scripting
Is it something wrong with this script? Every things works fine as it should. But some mobs don't attack me. Like I can attack them but they won't attack me.

[REGIONTYPE r_newbiedungeon]
ON=@ENTER
SRC.EVENTS=+e_dungeonnewbie
SRC.EVENTS=+e_dungeonnewbie2
ON=@EXIT
SRC.EVENTS=-e_dungeonnewbie
SRC.EVENTS=-e_dungeonnewbie2

[EVENTS e_dungeonnewbie]
On=@hittry
if (<src.isplayer>)
sysmessage You can't attack other players in this dungeon.
return 1
endif

[EVENTS e_dungeonnewbie2]
ON=@SpellEffect
if ( <ISPLAYER> && <SRC.ISPLAYER> )
f_spell_is_aggressive <ARGN>
IF (<VAR0.f_spell_is_aggressive> = 1)
SRC.SYSMESSAGE You cannot harm players in this dungeon.
RETURN 1
ENDIF
ENDIF

ON=@SpellCast
If ( <Argn> == 33 )
src.message " You can't use that spell in this dungeon"
return 1
Endif
If ( <Argn> == 40 )
src.message " You can't use that spell in this dungeon"
return 1
Endif
If ( <Argn> == 58 )
src.message " You can't use that spell in this dungeon"
return 1
Endif
If ( <Argn> == 60 )
src.message " You can't use that spell in this dungeon"
return 1
Endif
If ( <Argn> == 61 )
src.message " You can't use that spell in this dungeon"
return 1
Endif
If ( <Argn> == 62 )
src.message " You can't use that spell in this dungeon"
return 1
Endif
If ( <Argn> == 63 )
src.message " You can't use that spell in this dungeon"
return 1
Endif
If ( <Argn> == 64 )
src.message " You can't use that spell in this dungeon"
return 1
endif



[FUNCTION f_spell_is_aggressive]
VAR.f_spell_is_aggressive = 1
VAR.is_dispel = 0
if ( 0 )
elseif ( <argn> == 1 ) // clumsy
elseif ( <argn> == 3 ) // feeblemind
elseif ( <argn> == 5 ) // magic arrow
elseif ( <argn> == 8 ) // weaken
elseif ( <argn> == 12 ) // harm
elseif ( <argn> == 18 ) // fireball
elseif ( <argn> == 20 ) // poison
elseif ( <argn> == 27 ) // curse
elseif ( <argn> == 28 ) // - Fire Field
elseif ( <argn> == 30 ) // lightning
elseif ( <argn> == 31 ) // mana drain
elseif ( <argn> == 33 ) // - Blade of Spirits
elseif ( <argn> == 37 ) // mind blast
elseif ( <argn> == 38 ) // paralyze
elseif ( <argn> == 39 ) // - Poison Field
elseif ( <argn> == 40 ) // - Summon Creature
elseif ( <argn> == 41 ) // dispel
VAR.is_dispel = 1
elseif ( <argn> == 42 ) // energy bolt
elseif ( <argn> == 43 ) // explosion
elseif ( <argn> == 46 ) // mass curse
elseif ( <argn> == 47 ) // paralyze field
elseif ( <argn> == 49 ) // chain lightning
elseif ( <argn> == 51 ) // flamestrike
elseif ( <argn> == 53 ) // mana vampire
elseif ( <argn> == 54 ) // mass dispel
VAR.is_dispel = 1
elseif ( <argn> == 55 ) // meteor swarm
elseif ( <argn> == 57 ) // - Earthquake
elseif ( <argn> == 58 ) // - Energy Vortex
elseif ( <argn> == 60 ) // - Air Elemental
elseif ( <argn> == 61 ) // - Summon Daemon
elseif ( <argn> == 62 ) // - Earth Elemental
elseif ( <argn> == 63 ) // - Fire Elemental
elseif ( <argn> == 64 ) // - Water Elemental
else
VAR.f_spell_is_aggressive = 0
endif


I'm pretty sure it's something I did with the event in Bold.

Sorry for bothering once again,
Fronz
(This post was last modified: 05-04-2016 11:31 AM by Fronz.)
05-04-2016 10:04 AM
Find all posts by this user Like Post Quote this message in a reply
Criminal
Journeyman
*

Posts: 182
Likes Given: 38
Likes Received: 22 in 22 posts
Joined: Jun 2015
Reputation: 0

SantiagoUO.com

Post: #44
RE: Need help in general Scripting
[EVENTS e_dungeonnewbie2]
ON=@SpellEffect
if ( <ISPLAYER> && <SRC.ISPLAYER> )
if (<serv.spell.<argn1>.flags>&spellflag_harm)
SRC.SYSMESSAGE You cannot harm players in this dungeon.
RETURN 1
ENDIF
ENDIF

[Image: mfqAZnj.png]
Discord: SantiagoUO
Skype:
criminaluo
05-04-2016 04:12 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #45
RE: Need help in general Scripting
Use what criminal wrote, it is all that you need.


However i'm going to explain you some things you had wrong on your code in case you can make use of it on the future:
IF (<VAR0.f_spell_is_aggressive> = 1) //WRONG: One = means 'set', in this case you are setting that VAR to 1 everytime so you are forcing Sphere to automatically pass this check always.
IF (<VAR0.f_spell_is_aggressive> == 1) // Double = means compare, this is what you must use when comparing values.

NOTE: Functions can return values, there is no need to store anything on VARs to check them later:

Code:
[FUNCTION f_test]
if (<serv.spell.<argn1>.flags>&spellflag_harm)
return 1
endif
return 0

ON=@SpellEffect
if (<f_test <argn1>> == 1) // So you don't need to set a VAR and check for it later, you can do it all at once.
SRC.SYSMESSAGE You cannot harm players in this dungeon.
return 1
endif
(This post was last modified: 05-04-2016 04:30 PM by XuN.)
05-04-2016 04:29 PM
Find all posts by this user Like Post Quote this message in a reply
Fronz
Apprentice
*

Posts: 36
Likes Given: 2
Likes Received: 0 in 0 posts
Joined: Apr 2016
Reputation: 0



Post: #46
RE: Need help in general Scripting
Many Many thanks guys! Worked as always!

Got a new question, this seems basic but I'm stuck.
I want to open a Dialog using a function like .test . But I want that Dialog to close and open a new one when typing .test again.

Like I type .test opens a dialog and I don't close it. Then I type .test again and closes the previous dialog and opens a new one.

[FUNCTION TEST]
SRC.DIALOG d_TEST
RETURN 1

[DIALOG d_TEST]
0,0
PAGE 0
NODISPOSE
gumppic 160 65...

Silly me,
Fronz
(This post was last modified: 05-10-2016 01:09 PM by Fronz.)
05-10-2016 01:05 PM
Find all posts by this user Like Post Quote this message in a reply
Criminal
Journeyman
*

Posts: 182
Likes Given: 38
Likes Received: 22 in 22 posts
Joined: Jun 2015
Reputation: 0

SantiagoUO.com

Post: #47
RE: Need help in general Scripting
[function test]
sdialog d_test

[dialog d_Test]
0,0
closedialog d_test 0 (not sure if closedialog or dialogclose i dont remember xd
...

[Image: mfqAZnj.png]
Discord: SantiagoUO
Skype:
criminaluo
(This post was last modified: 05-10-2016 09:54 PM by Criminal.)
05-10-2016 09:53 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Criminal's post
Fronz
Apprentice
*

Posts: 36
Likes Given: 2
Likes Received: 0 in 0 posts
Joined: Apr 2016
Reputation: 0



Post: #48
RE: Need help in general Scripting
Guys thank you for everything! All your help was very much needed. I'm going to open the shard very hopefully this week, all errors are gone and all new scripts have been added. Can't thank you guys enough.

For one very final question regarding to a VPS.

I read all what you guys said about Dual Cores, RAM and CPU. But none of you talked about bandwidth, is it not that relevant?


I found a cheap server with these Specs:

2 vCPU - Intel Xeon E5 V3

2gb Ram

40GB SSD

40GB Hard Disk

10TB/m bandwidth = 167mb/s

100mb/s Port Speed


Is it good? How much players can it handle without much hassle? Can it run 50 players? Can it run 100 players?

I'm settling for this VPS if you guys say otherwise.

Tyvm,
Fronz
(This post was last modified: 05-16-2016 10:28 AM by Fronz.)
05-16-2016 10:25 AM
Find all posts by this user Like Post Quote this message in a reply
Kanibal
Master
**

Posts: 255
Likes Given: 6
Likes Received: 30 in 28 posts
Joined: Jun 2012
Reputation: 0



Post: #49
RE: Need help in general Scripting
(05-16-2016 10:25 AM)Fronz Wrote:  100mb/s Port Speed

Is it good? How much players can it handle without much hassle? Can it run 50 players? Can it run 100 players?

Your server can handle more than 1000 players. Woot

Grandmaster Localhost Admin
05-16-2016 10:51 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Fronz
Apprentice
*

Posts: 36
Likes Given: 2
Likes Received: 0 in 0 posts
Joined: Apr 2016
Reputation: 0



Post: #50
RE: Need help in general Scripting
Well I'm settled then xD

Thanks man,
Fronz
(This post was last modified: 05-17-2016 02:35 AM by Fronz.)
05-17-2016 02:34 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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