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
Problem with renaming
Author Message
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #1
Problem with renaming
Double click the rune, rename it to what you want. But it's not working.

Code:
ON=@DCLICK
IF !<MOREP>
SRC.SYSMESSAGE You can't rename blank runes.
RETURN 1
ELSE
SRC.SYSMESSAGE What would you like to change the name to?
SRC.PROMPTCONSOLE f_change_rune_marker_name
RETURN 1
ENDIF


Code:
[FUNCTION f_change_rune_marker_name]
  IF !(<isempty <ARGS>>)
     TARG.NAME=<ARGS>
     SYSMESSAGE The rune's name has been changed to "<ARGS>".
    ELSE
     SYSMESSAGE Invalid name.
    ENDIF

Only thing I cannot figure out is the "TARG.NAME=<ARGS>" part. What do I need to put there so it will rename the rune? I know targ.name isn't correct, I'm just not sure on what to put there.
11-05-2016 10:39 AM
Find all posts by this user Like Post Quote this message in a reply
pointhz
Journeyman
*

Posts: 148
Likes Given: 1
Likes Received: 55 in 28 posts
Joined: Oct 2013
Reputation: 1



Post: #2
RE: Problem with renaming
The problem is most likely in the PROMPTCONSOLE function.

I never used it, so:

- Is <ARGS> the player response after the PROMPTCONSOLE?

- Is <TARG> the Item being DCLICK'ed?

Doesn't seem like it.

Try this instead:

[FUNCTION rune_rename]
IF (<ISEMPTY <ARGS>>)
SRC.SYSMESSAGE Please type the new name you want to give the rune.
ELSE
SRC.SYSMESSAGE Please target the rune you want to rename to <ARGS>
SRC.TARGETF f_rune_rename <ARGS>
ENDIF
RETURN 1

[FUNCTION f_rune_rename]
IF (<ARGO.ISPLAYER>) || (!(<ARGO.ISPLAYER>) && !(<ARGO.BASEID>==i_rune_marker))
SRC.SYSMESSAGE You must target a Rune with this function.
RETURN 1
ENDIF

IF !(<ARGO.MOREP>)
SRC.SYSMESSAGE You cant rename blank runes.
RETURN 1
ENDIF

ARGO.NAME=<ARGS>
SRC.SYSMESSAGE The rune's name has been changed to "<ARGS>".
RETURN 1
(This post was last modified: 11-05-2016 10:56 AM by pointhz.)
11-05-2016 10:53 AM
Find all posts by this user Like Post Quote this message in a reply
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #3
RE: Problem with renaming
Yeah I was thinking of doing it by having a target, but is there anyway to do it like sphere has it set default? The default rune, when double clicked, allows you to type into chat right after you dblclick the rune, without having to target anything. I'd leave the default way, but it sets the rune to "a recall runevesper". Doesn't really look nice.
11-05-2016 05:02 PM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #4
RE: Problem with renaming
although ACT/TARG/ARGO works with PROMPTCONSOLE, this is not a secure way to store the rune UID since ACT/TARG/ARGO can change if you start another action while PROMPTCONSOLE callback is not sent/aborted yet

to make a fully working and secure PROMPTCONSOLE you must store the ref UID in some way that it won't change, like using TAG or CTAG:
Code:
ON=@DClick
SRC.CTAG.RenamingRuneUID=<UID>
SRC.PROMPTCONSOLE f_change_rune_marker_name

[FUNCTION f_change_rune_marker_name]
REF1=<CTAG.RenamingRuneUID>
CTAG.RenamingRuneUID=
IF (<isempty <ARGS>>)
  SYSMESSAGE Invalid name
ELSE
  REF1.NAME=<ARGS>
  SYSMESSAGE The rune's name has been changed to "<ARGS>".
ENDIF
11-05-2016 05:08 PM
Find all posts by this user Like Post Quote this message in a reply
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #5
RE: Problem with renaming
Thanks man, that worked perfectly.

One last thing, how would I go about setting the durability of the rune? I noticed while tampering with the MORE1 of a rune in-game, it decreases as I recall with the rune, once it hits 0 the rune is faded. How would I go about increasing that number?

I have tried increasing the MORE1 in the script but it just doesn't seem to work.



Code:
ON=@SPELLEFFECT
IF (<ARGN>==45)
IF (<REGION.FLAGS>&02000)||(<REGION.FLAGS>&04000)||(<REGION.FLAGS>&08000)
COLOR=color_blue
MORE1={25 35}
ELSE
COLOR=color_red
MORE1={25 35}
ENDIF
SRC.SYSMESSAGE You mark the rune.
NAME=<REGION.NAME>
(This post was last modified: 11-05-2016 05:49 PM by Leonidas.)
11-05-2016 05:12 PM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #6
RE: Problem with renaming
I can't remember exactly, but I think this rune charge value comes from EFFECT on Mark spell (sphere_spells.scp)
11-06-2016 02:55 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)