Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, 1 invisible), 942 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
entity.string1, How the hell #229378
09/26/08 23:52
09/26/08 23:52
Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Nidhogg Offline OP
Serious User
Nidhogg  Offline OP
Serious User

Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Does entity.string1 work with c-script..

I have a simple code
Code:
string Unit_Type;
function AI_Fight()
str_cpy(Unit_Type,my.string1)
if(Unit_Type == "guard")
{
do_something;
}

It does NOT work, even tried my.string2

AI just stands there looking stupid at me.. grin


Windows XP SP3
Intel Dual Core CPU: E5200 @ 2.5GHz
4.00GB DDR3 Ram
ASUS P5G41T-M LX
PCIE x16 GeForce GTS 450 1Gb
SB Audigy 4
Spyware Doctor with AntiVirus
Re: entity.string1, How the hell [Re: Nidhogg] #229386
09/27/08 04:39
09/27/08 04:39
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
'I' believe, in C-Script, string objects are NOT usually compared in that manner.
functions used for string comparison: str_cmp, str_cmpi, str_cmpni


Re: entity.string1, How the hell [Re: testDummy] #229388
09/27/08 04:58
09/27/08 04:58
Joined: Sep 2008
Posts: 29
L
log2 Offline
Newbie
log2  Offline
Newbie
L

Joined: Sep 2008
Posts: 29
yea testDummy is correct, you can't use string1 == string2, you actually have to use str_cmpi in you if statement

Code:
string Unit_Type;
function AI_Fight()
str_cpy(Unit_Type,my.string1)
if(str_cmpi(Unit_Type, "guard"))
{
do_something;
}


That's also case insensitive, aka GUARD would work just as well as guard, if you don't want that, change str_cmpi, to str_cmp

Re: entity.string1, How the hell [Re: log2] #229394
09/27/08 06:22
09/27/08 06:22
Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Nidhogg Offline OP
Serious User
Nidhogg  Offline OP
Serious User

Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Many thanks, It's works now..


Windows XP SP3
Intel Dual Core CPU: E5200 @ 2.5GHz
4.00GB DDR3 Ram
ASUS P5G41T-M LX
PCIE x16 GeForce GTS 450 1Gb
SB Audigy 4
Spyware Doctor with AntiVirus

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1