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
Quest repeat
Author Message
WRWR
Journeyman
*

Posts: 212
Likes Given: 30
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 1



Post: #11
RE: Quest repeat
using FOR you are far away from perfectionism Smile
08-14-2012 11:35 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: #12
RE: Quest repeat
(08-14-2012 11:35 AM)WRWR Wrote:  using FOR you are far away from perfectionism Smile
Think better, FOR is for things that are not common.
If you don't want to store lots of TAGs, the best way is using FOR.
But, each one knows what is better for them.
If you see my FOR, its breakable by RETURN 1 if the quest is already completed.
Or just use defnames or mysql or whatever...
I know one thing: for this problem, FOR is faster than MYSQL requests.
FOR is for standards, if you know the template, FOR is the best thing to use.

But of course, I can be wrong or not, just my opinion.

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-14-2012 11:49 AM
Find all posts by this user Like Post Quote this message in a reply
Wap
Journeyman
*

Posts: 138
Likes Given: 6
Likes Received: 7 in 6 posts
Joined: Mar 2012
Reputation: 3

UORPG.net

Post: #13
RE: Quest repeat
If you have a religious necessity to use one variable, i think the better way is LISTs. There you have FINDELEM and don't need to to handreds of loops. But really, I think my method(above) is the best one - the simple IF check and minimal use of memory. 10 tags? But what harm do 10 tags? Smile My 10 tags will use less memory, than your 1 tag. Smile
08-14-2012 01:47 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #14
RE: Quest repeat
(08-13-2012 11:22 AM)Extreme Wrote:  Or you can store the Number ID of all completed quests in only one tag.
And check if the Number ID is in the tag to avoid repeat it.

When complete:
Code:
TAG.COMPLETEDQUESTS .= ",<QUESTNUMBER>"
To check if the quest is already completed:
Code:
[FUNCTION F_QUESTS_CHECKCOMPLETE]
LOCAL.QUESTNUMBER <ARGS>
ARGS <TAG.COMPLETEDQUESTS>
FOR 0 <EVAL <ARGV>-1>
IF STRMATCH(<LOCAL.QUESTNUMBER>,<ARGV[<LOCAL._FOR>]>)
  RETURN 1
ENDIF
ENDFOR
RETURN 0
Usage F_QUESTS_CHECKCOMPLETE <QUESTNUMBER>

I´m updating my scripts with this system.

What is the best method to repeat a completed quest?
How do you extract a single <LOCAL.QUESTNUMBER> from all TAG.COMPLETEDQUESTS string?
10-05-2012 08:55 PM
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: #15
RE: Quest repeat
(10-05-2012 08:55 PM)Gil Amarth Wrote:  
(08-13-2012 11:22 AM)Extreme Wrote:  Or you can store the Number ID of all completed quests in only one tag.
And check if the Number ID is in the tag to avoid repeat it.

When complete:
Code:
TAG.COMPLETEDQUESTS .= ",<QUESTNUMBER>"
To check if the quest is already completed:
Code:
[FUNCTION F_QUESTS_CHECKCOMPLETE]
LOCAL.QUESTNUMBER <ARGS>
ARGS <TAG.COMPLETEDQUESTS>
FOR 0 <EVAL <ARGV>-1>
IF STRMATCH(<LOCAL.QUESTNUMBER>,<ARGV[<LOCAL._FOR>]>)
  RETURN 1
ENDIF
ENDFOR
RETURN 0
Usage F_QUESTS_CHECKCOMPLETE <QUESTNUMBER>

I´m updating my scripts with this system.

What is the best method to repeat a completed quest?
How do you extract a single <LOCAL.QUESTNUMBER> from all TAG.COMPLETEDQUESTS string?
<GETARGVX X,<TAG.COMPLETEDQUESTS>>
Where x is the position.

PHP Code:
[FUNCTION GETARGVX]
IF <
ARGV[0]> == -1
 
RETURN <EVAL <ARGV>-1>
ELSE
 RETURN <
ARGV[<ARGV[0]>]>
ENDIF 

To get the position :
PHP Code:
[FUNCTION GETARGVPOS]
FOR 
P 1 <EVAL <ARGV>-1>
 IF 
STRMATCH(<ARGV[0]>,<ARGV[<dLOCAL.P>]>)
  RETURN <
dLOCAL.P>
 ENDIF
ENDFOR
RETURN -

<GETARGVPOS <STRINGTOSEARCH>,<STRING>>

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.
10-05-2012 10:19 PM
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: #16
RE: Quest repeat
If you are making repeatable quests... why would you write their value into a tag that records which quests have been completed and prevents players from repeating them?

[Image: 2nis46r.jpg]
10-06-2012 12:19 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #17
RE: Quest repeat
Really I don´t want this script for quests, but the code it´s the same for other projects which I want store in only one tag. Tongue

Thank you very much, Extreme. I owe you one. Veryhappy
10-06-2012 02:47 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: #18
RE: Quest repeat
(10-06-2012 12:19 AM)Mordaunt Wrote:  If you are making repeatable quests... why would you write their value into a tag that records which quests have been completed and prevents players from repeating them?
It can be used in many systems, just need know what system is better to use hehe
(10-06-2012 02:47 AM)Gil Amarth Wrote:  Really I don´t want this script for quests, but the code it´s the same for other projects which I want store in only one tag. Tongue

Thank you very much, Extreme. I owe you one. Veryhappy
Nope!

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.
10-06-2012 03:03 AM
Find all posts by this user Like Post Quote this message in a reply
Avatar
Journeyman
*

Posts: 172
Likes Given: 6
Likes Received: 27 in 12 posts
Joined: Apr 2012
Reputation: 5

The North Shield

Post: #19
RE: Quest repeat
I think you dont need even for argv and for cycle to check whether your tag consist of what you want to seeking for. That is so simple Smile

Whether you check for argn or argv or even args , it is up to you.

IF STRMATCH(*<argn>*,<TAG.COMPLETEDQUESTS>)
RETURN 1
ENDIF
ENDFOR
RETURN 0
(This post was last modified: 10-06-2012 06:03 AM by Avatar.)
10-06-2012 05:57 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: #20
RE: Quest repeat
(10-06-2012 05:57 AM)Avatar Wrote:  IF STRMATCH(*<argn>*,<TAG.COMPLETEDQUESTS>)
RETURN 1
ENDIF
ENDFOR
RETURN 0

I think you dont need even for argv and for cycle to check whether your tag consist of what you want to seeking for.
Sure, but, looking for quest 1, it will match in quest 10, so isn't perfect.

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.
10-06-2012 06:03 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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