![]() |
String Contains?
How do I do
NPC Code: in GS2? I checked the basic scripting page and it's not there... Quote:
|
Quote:
PHP Code:
|
Quote:
if(foo.pos("bar") >= 0) { } |
Quote:
|
Quote:
Why the hell is he getting you guys to use it? |
Quote:
|
Quote:
Alright, it's good that you don't use that style. It's just super annoying to see people use it. |
so in the same sense as the Wiki puts it, it would be
if(obj.pos(obj2) >= 0) { } Yeah? |
Quote:
|
It's easier to use .contains()
this.msg = "what npc"; this.findmsg = "npc"; if (this.msg.contains(this.findmsg)) { // whatever } |
Quote:
|
Quote:
|
Quote:
Quote:
|
Quote:
Quote:
Quote:
EDIT: Ogasp, post #1234. I r winnar. |
I use this method, I'm sure it works too.
PHP Code:
|
Quote:
He is trying to compare substrings, not check if a value is in an array, I believe. |
Oh I see, my mistake.
|
Yes the replacement for strcontains(oldstring,oldstring) is contains(string,string)
|
Quote:
|
| All times are GMT +2. The time now is 06:44 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.