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
Variables in Defname
Author Message
alexpetro
Apprentice
*

Posts: 14
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #1
Variables in Defname
I'm working on quest system, and i would use variables in the quest dialog (defname), does it possible?
05-05-2012 07:36 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: #2
RE: Variables in Defname
well you can't directly use variables on defnames, but can use when calling them like:

local.quest_loot=<def.quest_<eval <tag.questno>>_loot>
05-06-2012 01:01 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
jeem
Apprentice
*

Posts: 33
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Mar 2012
Reputation: 3



Post: #3
RE: Variables in Defname
Shaklaban is right. Though it is possible to create workarounds depending on how you call the defname. Using double brackets is the first thing that pops into my mind:

Code:
def.lol = "gold"

sysmessage i have <<def.lol>> gold.

Give us an example of how you plan to use them.
(This post was last modified: 05-06-2012 03:51 AM by jeem.)
05-06-2012 03:51 AM
Find all posts by this user Like Post Quote this message in a reply
alexpetro
Apprentice
*

Posts: 14
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #4
RE: Variables in Defname
Thanks but, this is not what i'm serching. The primary scope of my request is have dynamic dialogs in the quest system, like in the following example:

QUEST_13204_TEXTLOCALIZED "<SRC.NAME> I nedd... and you have to go to the blacksmith here in <src.region.name>"

Could be a great feature, if is it possible to implement.

Thanks.
05-17-2012 01:09 AM
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: #5
RE: Variables in Defname
its a definition, definitions are generally fixed values in programming. you can use functions for that purpose like:

PHP Code:
[function QUEST_13204_TEXTLOCALIZED]
return <
SRC.NAMEI nedd... and you have to go to the blacksmith here in <src.region.name

it is possible to use variables in function names like:

PHP Code:
local.questnum=13204
src
.sysmessage <quest_QUEST_<eval <local.questnum>>_TEXTLOCALIZED

you can also add arguments to text when you calling function.

or you can use clilocs.
(This post was last modified: 05-17-2012 01:31 AM by Shaklaban.)
05-17-2012 01:27 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Ben
Sphere Developer
*****

Posts: 612
Likes Given: 2
Likes Received: 123 in 70 posts
Joined: Mar 2010
Reputation: 18

SphereCommunity

Post: #6
RE: Variables in Defname
There is always workarounds like this one...

Code:
[FUNCTION DEFVAL]
LOCAL.STRING Ð<ARGS>
WHILE (<STRPOS 0 60 <LOCAL.STRING>> > -1)
LOCAL.LAST <STRLASTPOS 60 <LOCAL.STRING>>
LOCAL.NEXT <EVAL <STRPOS <LOCAL.LAST> 62 <LOCAL.STRING>>+-<LOCAL.LAST>>
LOCAL.STRING <STRSUB 0 <LOCAL.LAST> <LOCAL.STRING>><<STRSUB <EVAL <LOCAL.LAST>+1> <EVAL <LOCAL.NEXT>+-1> <LOCAL.STRING>>><STRSUB <EVAL <LOCAL.LAST>+<LOCAL.NEXT>+1> 0 <LOCAL.STRING>>
ENDWHILE
LOCAL.STRING <STRSUB 1 0 <LOCAL.STRING>>
RETURN <LOCAL.STRING>

[FUNCTION STRLASTPOS]
LOCAL.CHAR <STRARG <ARGS>>
LOCAL.NEWSTRING <STREAT <ARGS>>
WHILE (<STRPOS 0 <dLOCAL.CHAR> <LOCAL.NEWSTRING>> > -1)
LOCAL.LASTCHAR <EVAL <STRPOS 0 60 <LOCAL.NEWSTRING>>>
LOCAL.NEWSTRING <STRSUB 0 <STRPOS 0 <dLOCAL.CHAR> <LOCAL.NEWSTRING>> <LOCAL.NEWSTRING>>#<STRSUB <EVAL <STRPOS 0 <dLOCAL.CHAR> <LOCAL.NEWSTRING>>+1> 0 <LOCAL.NEWSTRING>>
ENDWHILE
RETURN <EVAL <LOCAL.LASTCHAR>>

Not sure if it still works, but I created this to emulate the PHP function eval().
So you can do something like this... <defval <def0.lol>> and it will evaluate any variables inside the def Smile

Use at your own risk Big Grin

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
05-17-2012 09:56 AM
Visit this user's website 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)