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
FORITEMS doesn´t work right?
Author Message
admin phoenix
Master
**

Posts: 354
Likes Given: 1
Likes Received: 23 in 13 posts
Joined: Mar 2012
Reputation: 3



Post: #1
FORITEMS doesn´t work right?
For a resurrect script, I write a new script, so when you die you will be teleported to the next and nearest shrine.
this should work with foritems 6144
this doesn´t work as I wish because the players will not teleport to the nearest one.

I wrote a little script and checked it again. here is the script and the result... see the screenshot.
something is wrong there.

[FUNCTION test]
FORITEMS 6144
IF (<type> == t_gold)
local.x +=1
say <dlocal.x>
ENDIF
ENDFOR


Attached File(s) Thumbnail(s)
   
07-06-2012 06:46 AM
Find all posts by this user Like Post Quote this message in a reply
Anarch Cassius
Master
**

Posts: 273
Likes Given: 19
Likes Received: 10 in 9 posts
Joined: Mar 2012
Reputation: 2



Post: #2
RE: FORITEMS doesn´t work right?
Who ever said FORITEMS went in a certain order? Looks like it's scanning the potentially affected area left to right and top to bottom. Makes sense to me.

You need to manually find he closest shrine then teleport.

[FUNCTION nearest_shrine]
FORITEMS 6144
local.lowdistance=50000 //any shrine should be closer than this
IF (<type> == t_shrine)
IF (<src.distance <I>> < <local.lowdistance>) //if this is the closest one so far
local.lowdistance= <src.distance <I>>
obj = <I>
ENDIF
ENDIF
ENDFOR
SRC.P = <OBJ.P>
SRC.FIX
//and you should be at the closet shrine

That's totally untested but should get the idea
(This post was last modified: 07-06-2012 06:54 AM by Anarch Cassius.)
07-06-2012 06:53 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: #3
RE: FORITEMS doesn´t work right?
I think the best way, without use foritems is something like this:
Code:
[DEFNAMES SHRINES_P]
SHRINES 5
SHRINE_1 100,100
SHRINE_2 200,200
SHRINE_3 300,300
SHRINE_4 400,400
SHRINE_5 500,500

[FUNCTION GOTONEARESTSHRINE]
LOCAL.SHRINEDIST 10000
FOR 1 <DEF.SHRINES>
IF <SRC.DISTANCE <DEF.SHRINE_<dLOCAL._FOR>> < LOCAL.SHRINEDIST>
LOCAL.SHRINEDIST <SRC.DISTANCE <DEF.SHRINE_<dLOCAL._FOR>>
LOCAL.SHRINE <dLOCAL._FOR>
ENDIF
ENDFOR
SRC.GO <DEF.SHRINE_<dLOCAL.SHRINE>>
SRC.FIX
RETURN 1
I didn't test it, but I think its okay.

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.
07-06-2012 07:25 AM
Find all posts by this user Like Post Quote this message in a reply
Anarch Cassius
Master
**

Posts: 273
Likes Given: 19
Likes Received: 10 in 9 posts
Joined: Mar 2012
Reputation: 2



Post: #4
RE: FORITEMS doesn´t work right?
Extreme's wins. Smile

Much faster script if you have a reasonable number of shrines to define. Faster even if you don't really, but the defs might get tedious
(This post was last modified: 07-06-2012 07:29 AM by Anarch Cassius.)
07-06-2012 07:29 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: #5
RE: FORITEMS doesn´t work right?
(07-06-2012 07:29 AM)Anarch Cassius Wrote:  Extreme's wins. Smile

Much faster script if you have a reasonable number of shrines to define. Faster even if you don't really, but the defs might get tedious
Hehe, or can just use VARs Smile
(07-06-2012 06:46 AM)admin phoenix Wrote:  For a resurrect script, I write a new script, so when you die you will be teleported to the next and nearest shrine.
this should work with foritems 6144
this doesn´t work as I wish because the players will not teleport to the nearest one.

I wrote a little script and checked it again. here is the script and the result... see the screenshot.
something is wrong there.

[FUNCTION test]
FORITEMS 6144
IF (<type> == t_gold)
local.x +=1
say <dlocal.x>
ENDIF
ENDFOR
@OFF, this shard, Athoris is yours?
If yes, can I try play there?
I don't know German language, but I just want to know the server.
If you can make me an account I would be happy.
PS: this server looks awesome, I NEVER seen something like it, congrats.

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: 07-06-2012 08:07 AM by Extreme.)
07-06-2012 07:34 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #6
RE: FORITEMS doesn´t work right?
Offtopic :
I would like to try it too ! But I have the same german language problem Big Grin
07-06-2012 10:18 AM
Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #7
RE: FORITEMS doesn´t work right?
just off how I think this should work:
Code:
[function teletonearestshrine]
foritems 9999
if (<type>==t_shrine)
  local.s += 1
  local.shrine<dlocal.s>.p.x=<p.x>
  local.shrine<dlocal.s>.p.y=<p.y>
endif
endfor
for x 1 <dlocal.x>
if (strmatch(<local.p.x>,0)) && (strmatch(<local.p.y>,0))
  local.p.x=<local.shrine<dlocal.x>.p.x>
  local.p.y=<local.shrine<dlocal.x>.p.y>
endif
if (<local.shrine<dlocal.x>.p.x> < <local.p.x>) || (<local.shrine<dlocal.x>.p.y> < <local.p.y>)
  local.p.x=<local.shrine<dlocal.x>.p.x>
  local.p.y=<local.shrine<dlocal.x>.p.y>
endif
endfor
if (<local.p.x>) && (<local.p.y>)
go <local.p.x>,<local.p.y>,<serv.map(<local.p.x>,<local.p.y>,0,<map>).terrain.z>,<map>
endif
that's the function to seek for t_shrine across the whole map, teleports the player to the closest t_shrine, this next part is a @trigger to be placed on the player character
Code:
[event e_seek_shrine]
on=@death
teletonearestshrine

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
07-06-2012 04:40 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
admin phoenix
Master
**

Posts: 354
Likes Given: 1
Likes Received: 23 in 13 posts
Joined: Mar 2012
Reputation: 3



Post: #8
RE: FORITEMS doesn´t work right?
Thanks for helping me guys Smile
At first I will try Extreme code because it looks very nice but I will control the shrine via sql. Putting a new shrine in the world he coordinations will be writen in the sql.

@all
yes, it´s my shard and it is in german so it will be very hard for you to play ingame because all systems are in german too Smile
at the moment we have an on open beta.
if you want an account you have to register because we control all accounts and chars via sql.
for example you have to create a character via homepage ...
In 3 weeks we will finish the open-beta and if we don´t get enough german player maybe I will think for an international shard Smile

but then I also need international gamemasters and developers *g*
07-06-2012 09:14 PM
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: #9
RE: FORITEMS doesn´t work right?
you can read shrines from sql then. i think foritems is not a good idea because its creating giant loops, if a players can use it frequently, even one player can frozen the whole shard with uo loop.
07-06-2012 09:38 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: #10
RE: FORITEMS doesn´t work right?
(07-06-2012 09:14 PM)admin phoenix Wrote:  Thanks for helping me guys Smile
At first I will try Extreme code because it looks very nice but I will control the shrine via sql. Putting a new shrine in the world he coordinations will be writen in the sql.

@all
yes, it´s my shard and it is in german so it will be very hard for you to play ingame because all systems are in german too Smile
at the moment we have an on open beta.
if you want an account you have to register because we control all accounts and chars via sql.
for example you have to create a character via homepage ...
In 3 weeks we will finish the open-beta and if we don´t get enough german player maybe I will think for an international shard Smile

but then I also need international gamemasters and developers *g*
I created the account, I think you must accept it, don't worry when you see what I wrote on the rp boxes Smile
Hope you will let us to try it =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.
07-06-2012 10:24 PM
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)