SphereCommunity
no == ? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: no == ? (/Thread-no)



no == ? - x77x - 09-27-2016 06:06 AM

PROBLEM#1
Code:
[events e_army_soldier]
ON=@NPCLookAtChar//TO INTERACT WITH NPCS
IF (<SRC.TAG0.MILITARY>)
    IF !(<SRC.TAG.ARMYNUMBER>==<TAG.ARMYNUMBER>)
    ATTACK <SRC>
    ELIF (<SRC.FLAGS>&statf_criminal) || (<SRC.KILLS> >= 3 ) || (<SRC.KARMA> <= -2000 )//ATTACK MILITARY CRIMINALS
    Say Beat it military criminal!
    ATTACK <SRC>
    ELIF (<SRC.MEMORYFINDTYPE.0400.LINK>>040004010)//ATTACK every PLAYER made guild
    ATTACK <SRC>
    ENDIF
ELSEIF (<SRC.FLAGS>&statf_criminal) || (<SRC.KILLS> >= 3 ) || (<SRC.KARMA> <= -2000 )//ATTACK CIVILIAN CRIMINALS
    Say Beat it civilian criminal!
    ATTACK <SRC>
ENDIF

ON=@GetHit
IF (<SRC.TAG0.MILITARY>)
    IF (<SRC.TAG.ARMYNUMBER>==<TAG.ARMYNUMBER>)
    src.criminal 1
    ENDIF
ENDIF

ON=@NotoSend//2 ALLY 5 ENEMY 6 RED    
IF (<SRC.TAG0.MILITARY>)
    IF !(<SRC.TAG.ARMYNUMBER>==<TAG.ARMYNUMBER>)
    ARGN1=5
    ELIF (<SRC.TAG.ARMYNUMBER>==<TAG.ARMYNUMBER>)
    ARGN1=2
    ENDIF
ENDIF

ERRORS

16:01:ERROR:(3kuo_E_ARMYLIFE_NPCS.scp,6)Undefined symbol ''
16:01:ERROR:(3kuo_E_ARMYLIFE_NPCS.scp,21)Undefined symbol '' ['==040004000)']
16:01:ERROR:(3kuo_E_ARMYLIFE_NPCS.scp,28)Undefined symbol '' ['==040004000)']

PROBLEM #2
Code:
ON=0 Sun Quan [Wu]
TAG.ARMY wu
COLOR color_wu
LINK 01fda
MORE 32
SERV.ALLCLIENTS SYSMESSAGE @021 <NAME> is now controlled by Sun Quan [Wu]
foritems 200
    if (<type>==t_spawn_char)
        if (<isevent.t_<tag.cityname>>) || (<isevent.t_<tag.cityname>_BOSS1>) || (<isevent.t_<tag.cityname>_BOSS2>) || (<isevent.t_<tag.cityname>_BOSS3>)
            stop
            start//timer=2
        endif
    endif
endfor
SERV.ALLCLIENTS f_city_change <uid>

ERROR

16:00:ERROR:(sphere_items_townstones.scp,78)Undefined symbol 't_' ['t_']
16:00:ERROR:(sphere_items_townstones.scp,78)Undefined symbol 't__BOSS1' ['t__BOSS1']
16:00:ERROR:(sphere_items_townstones.scp,78)Undefined symbol 't__BOSS2' ['t__BOSS2']
16:00:ERROR:(sphere_items_townstones.scp,78)Undefined symbol 't__BOSS3' ['t__BOSS3']


RE: no == ? - rastrero - 09-27-2016 07:55 AM

if <SRC.TAG.ARMYNUMBER> --> if <SRC.TAG0.ARMYNUMBER>


(<SRC.MEMORYFINDTYPE.0400.LINK> > 040004010) //why not if <guild> ??




////2 problem
if (<isevent.t_<tag.cityname>>) || (<isevent.t_<tag.cityname>_BOSS1>) || (<isevent.t_<tag.cityname>_BOSS2>) || (<isevent.t_<tag.cityname>_BOSS3>)

are u sure tag.cityname have a value?


RE: no == ? - Coruja - 09-27-2016 10:17 AM

you must debug the code to check tag values, because probably these tags are empty

quick example: lets suppose that you have an TAG.City="minoc", so you expect an event 'e_<TAG.City>_city' will be 'e_minoc_city'. But if for some reason the TAG.City is empty, the event name will be e_[nothing here]_city --> e__city

that's exactly whats happening on your code. An easy way to find these problems is debbuging the values, making it display the tag value somewhere (SAY, SYSMESSAGE, SERV.B, etc) just to make it easy to check if values are correct, like this:
Code:
SERV.B SRC.TAG.ArmyNumber: <SRC.TAG.ARMYNUMBER> / TAG.ArmyNumber: <TAG.ARMYNUMBER>
this will make everything readable and easy to check if there's something wrong on this next line:
Code:
IF !(<SRC.TAG.ARMYNUMBER>==<TAG.ARMYNUMBER>)



RE: no == ? - x77x - 09-28-2016 06:11 AM

Code:
[MENU TOWNCONTROL]
WHO OWNS THIS TOWN?
ON=0 Cao Cao [Wei]
TAG.ARMY wei
COLOR color_wei
LINK 01ffd
MORE 3//COLOR FOR WARMAP
SERV.ALLCLIENTS SYSMESSAGE @04 <NAME> is now controlled by Cao Cao [Wei]
foritems 200
    if (<type>==t_spawn_char)
        if (<isevent.t_<tag.cityname>>) || (<isevent.t_<tag.cityname>_BOSS1>) || (<isevent.t_<tag.cityname>_BOSS2>) || (<isevent.t_<tag.cityname>_BOSS3>)
            stop
            start//timer=2
        endif
    endif
endfor
SERV.ALLCLIENTS f_city_change <uid>
//




Code:
[TYPEDEF t_xuchang]
ON=@Timer
tag.cityname xuchang
IF (STRMATCH("*infantry_light_c","<more1>")==1)
tag.spawn=infantry_light_c
ELIF (STRMATCH("*infantry_light_f","<more1>")==1)
tag.spawn=infantry_light_f
ELIF (STRMATCH("*infantry_archer","<more1>")==1)
tag.spawn=infantry_archer
ELIF (STRMATCH("*infantry_ambush_f","<more1>")==1)
tag.spawn=infantry_ambush_f
ELIF (STRMATCH("*infantry_ambush_a","<more1>")==1)
tag.spawn=infantry_ambush_a
ELIF (STRMATCH("*infantry_heavy","<more1>")==1)
tag.spawn=infantry_heavy
ELIF (STRMATCH("*infantry_elite","<more1>")==1)
tag.spawn=infantry_elite
ELIF (STRMATCH("*infantry_commander","<more1>")==1)
tag.spawn=infantry_commander
ELIF (STRMATCH("*calvary_light","<more1>")==1)
tag.spawn=calvary_light
ELIF (STRMATCH("*calvary_heavy","<more1>")==1)
tag.spawn=calvary_heavy
ELIF (STRMATCH("*calvary_elite","<more1>")==1)
tag.spawn=calvary_elite
ELIF (STRMATCH("*calvary_commander","<more1>")==1)
tag.spawn=calvary_commander
ELIF (STRMATCH("*elite_guard","<more1>")==1)
tag.spawn=elite_guard
ELIF (STRMATCH("*general","<more1>")==1)
tag.spawn=general
ENDIF
//
REF1=<UID.040004100.LINK>
IF (<REF1>==01ffd)//townstone owner is cao cao lord of wei
    color=color_wei
    tag.army wei
    more=c_wei_<tag.spawn>
ELSEIF (<REF1>==01fda)//sunquan
    color=color_wu
    tag.army wu
    more=c_wu_<tag.spawn>
ELSEIF (<REF1>==01fd1)//liubei
    color=color_shu
    tag.army shu
    more=c_shu_<tag.spawn>
ELSEIF (<REF1>==01fd5)//yuanshao
    color=color_ys
    tag.army ys
    more=c_ys_<tag.spawn>
ELSEIF (<REF1>==01fc5)//lubu
    color=color_lb
    tag.army lb
    more=c_lb_<tag.spawn>
ELSEIF (<REF1>==01ff7)//zhangjiao
    color=color_yt
    tag.army yt
    more=c_yt_<tag.spawn>
ELSEIF (<REF1>==01fdc)//menghuo
    color=color_mh
    tag.army mh
    more=c_mh_<tag.spawn>
ENDIF

Code:
[TYPEDEF t_xuchang_boss1]
ON=@Timer
tag.cityname xuchang
REF1=<UID.040004100.LINK>
IF (<REF1>==01ffd)//townstone owner is cao cao lord of wei
    color=color_wei
    tag.army wei
    more1=wei_xuchang_BOSS1
ELSEIF (<REF1>==01fda)//sunquan
    color=color_wu
    tag.army wu
    more1=wu_xuchang_BOSS1
ELSEIF (<REF1>==01fd1)//liubei
    tag.army shu
    color=color_shu
    more1=shu_xuchang_BOSS1
ELSEIF (<REF1>==01fd5)//yuanshao
    color=color_ys
    tag.army ys
    more1=ys_xuchang_BOSS1
ELSEIF (<REF1>==01fc5)//lubu
    color=color_lb
    tag.army lb
    more1=lb_xuchang_BOSS1
ELSEIF (<REF1>==01ff7)//zhangjiao
    color=color_yt
    tag.army yt
    more1=yt_xuchang_BOSS1
ELSEIF (<REF1>==01fdc)//menghuo
    color=color_mh
    tag.army mh
    more1=mh_xuchang_BOSS1
ENDIF

[TYPEDEF t_xuchang_boss2]
ON=@Timer
tag.cityname xuchang
REF1=<UID.040004100.LINK>
IF (<REF1>==01ffd)//caocao
    color=color_wei
    tag.army wei
    more1=wei_xuchang_BOSS2
ELSEIF (<REF1>==01fda)//sunquan
    color=color_wu
    tag.army wu
    more1=wu_xuchang_BOSS2
ELSEIF (<REF1>==01fd1)//liubei
    tag.army shu
    color=color_shu
    more1=shu_xuchang_BOSS2
ELSEIF (<REF1>==01fd5)//yuanshao
    color=color_ys
    tag.army ys
    more1=ys_xuchang_BOSS2
ELSEIF (<REF1>==01fc5)//lubu
    color=color_lb
    tag.army lb
    more1=lb_xuchang_BOSS2
ELSEIF (<REF1>==01ff7)//zhangjiao
    color=color_yt
    tag.army yt
    more1=yt_xuchang_BOSS2
ELSEIF (<REF1>==01fdc)//menghuo
    color=color_mh
    tag.army mh
    more1=mh_xuchang_BOSS2
ENDIF

[TYPEDEF t_xuchang_boss3]
ON=@Timer
tag.cityname xuchang
REF1=<UID.040004100.LINK>
IF (<REF1>==01ffd)//caocao
    color=color_wei
    tag.army wei
    more1=wei_xuchang_BOSS3
ELSEIF (<REF1>==01fda)//sunquan
    color=color_wu
    tag.army wu
    more1=wu_xuchang_BOSS3
ELSEIF (<REF1>==01fd1)//liubei
    tag.army shu
    color=color_shu
    more1=shu_xuchang_BOSS3
ELSEIF (<REF1>==01fd5)//yuanshao
    color=color_ys
    tag.army ys
    more1=ys_xuchang_BOSS3
ELSEIF (<REF1>==01fc5)//lubu
    color=color_lb
    tag.army lb
    more1=lb_xuchang_BOSS3
ELSEIF (<REF1>==01ff7)//zhangjiao
    color=color_yt
    tag.army yt
    more1=yt_xuchang_BOSS3
ELSEIF (<REF1>==01fdc)//menghuo
    color=color_mh
    tag.army mh
    more1=mh_xuchang_BOSS3
ENDIF

the spawns changes depending on who owns the town


RE: no == ? - Kanibal - 09-28-2016 09:29 PM

I need some valerian tablets after this code Cry


RE: no == ? - x77x - 10-02-2016 05:09 AM

PROBLEM#2

your right, there are spawns with no event tags.
i deleted them and it went away, so.....

how can i get it to do nothing when it finds one with no tag?


Code:
[MENU TOWNCONTROL]
WHO OWNS THIS TOWN?
ON=0 Cao Cao [Wei]
TAG.ARMY wei
COLOR color_wei
LINK 01ffd
MORE 3//COLOR FOR WARMAP
SERV.ALLCLIENTS SYSMESSAGE @04 <NAME> is now controlled by Cao Cao [Wei]
foritems 200
    if (<type>==t_spawn_char)
        if (<isevent.t_<tag.cityname>>) || (<isevent.t_<tag.cityname>_BOSS1>) || (<isevent.t_<tag.cityname>_BOSS2>) || (<isevent.t_<tag.cityname>_BOSS3>)
            stop
            start//timer=2
        endif
    endif
endfor
SERV.ALLCLIENTS f_city_change <uid>

ELSE
RETURN 0
?


RE: no == ? - n1ghtwish - 10-02-2016 06:33 PM

Code:
foritems 200
   if (!<isempty <tag.whatever>>) // if tag.whatever exists
        ... do stuff here .....
   endif
   // if no tag.whatever, do nothing
endfor

You could also do this...

Code:
if (!<isnum <tag0.whatever>>)

If the tag does not exist, tag0.whatever will translate to 0, making the isnum statement true, but since we don't want it to be a number (we want it to be text, which means the tag has something stored), we use the NOT operator to make the statement false.

If it's not a number, it's a string.

Right?


RE: no == ? - x77x - 10-03-2016 07:02 AM

yes its looking for a spawn tagged with an event (text string)
t_xuchang, t_xuchang_boss1, t_xuchang_boss2, t_xuchang_boss3
anything else, do nothing


RE: no == ? - x77x - 10-06-2016 09:13 PM

i tried something like...
Code:
[MENU TOWNCONTROL]
WHO OWNS THIS TOWN?
ON=0 Cao Cao [Wei]
TAG.ARMY wei
COLOR color_wei
LINK 01ffd
MORE 3//COLOR FOR WARMAP
SERV.ALLCLIENTS SYSMESSAGE @04 <NAME> is now controlled by Cao Cao [Wei]
foritems 200
    if (<type>==t_spawn_char)
        if (<isevent.t_<tag.cityname>>) || (<isevent.t_<tag.cityname>_BOSS1>) || (<isevent.t_<tag.cityname>_BOSS2>) || (<isevent.t_<tag.cityname>_BOSS3>)
            stop
            start//timer=2
        endif
        if !(<isevent.t_<tag.cityname>>) || !(<isevent.t_<tag.cityname>_BOSS1>) || !(<isevent.t_<tag.cityname>_BOSS2>) || !(<isevent.t_<tag.cityname>_BOSS3>)
say no!
return 0//return 1
    endif
endfor
SERV.ALLCLIENTS f_city_change <uid>

but that dont work