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
strcmpi issue
Author Message
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #1
strcmpi issue
Looking at world gembits with spawn groups attached.

This:

if !(strcmpi(*<more1>*,*spawn*))

Never returns true while:

if (strcmpi(*<more1>*,*spawn*))

returns true even when it's not.

<more1> contains "spawn_<dungeonname><lvl>"
So with the wildcards it should technically return true if the word spawn appears under more1.
So why doesn't it?

[Image: 2nis46r.jpg]
11-15-2012 10:35 AM
Visit this user's website 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: #2
RE: strcmpi issue
try:
Code:
if (<serv.spawn.<more1>>) //true if it's a [spawn x] block
  //code
else
  //code
endif

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

Marchadium :: http://www.marchadium.ca/ :: Join us!
11-15-2012 10:48 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #3
RE: strcmpi issue
The value in MORE1 is numeric... you cant compare a string to a numeric result.
11-15-2012 11:30 AM
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: #4
RE: strcmpi issue
And yet returns a string on t_spawn_char gembits

[Image: 2nis46r.jpg]
11-15-2012 11:51 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #5
RE: strcmpi issue
Think of it like a defname which maps a name to a number... Things like spawn_orcs will resolve to a number of some sort... but spawn_* cannot be looked up.
11-15-2012 12:06 PM
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: strcmpi issue
I thought I told you this before... you can't use a wild card with strcmpi!
Have a look at this page http://wiki.sphere.torfo.org/index.php/I..._Functions

what you need is strmatch or strregex.

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
11-15-2012 10:02 PM
Visit this user's website 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: #7
RE: strcmpi issue
Strmatch also doesn't function on it

[Image: 2nis46r.jpg]
11-15-2012 10:58 PM
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: #8
RE: strcmpi issue
IF (STRMATCH("*spawn*","<more1>")) should be what you are looking for.

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
11-16-2012 09:08 AM
Visit this user's website 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: #9
RE: strcmpi issue
well if <more1> is giving you some hex like number, why not resolve it?
Code:
if (strmatch(*spawn*,<serv.spawn.<more1>.defname>))

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

Marchadium :: http://www.marchadium.ca/ :: Join us!
11-16-2012 01:14 PM
Visit this user's website 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: #10
RE: strcmpi issue
It never was giving a number...
Ben's method resolved it anyway

[Image: 2nis46r.jpg]
11-16-2012 11:05 PM
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: 4 Guest(s)