ID:263175
 
Code:
Attack Script
client
Topic(href, href_list [])
switch (href_list["action"])
if("Attack")
src<<"DEBUG"
if (usr.SelectedCommand || !usr.IsTurn || !usr.BattleNum)
return
usr.SelectedCommand = 1
var/list/PlayerList = new()
for (var/mob/M in world)
if (usr.BattleNum == M.BattleNum)
if (usr.TeamNum == 0 || M.TeamNum != usr.TeamNum)
if (usr != M && M.Hp > 0)
PlayerList += M
PlayerList += "Cancel"
var/AttChoice = input("Who do you wish to attack?", "Your Turn", null) in PlayerList
if(AttChoice != "Cancel")
usr.Attack(AttChoice)
usr.IsTurn = 0
usr.SelectedCommand = 0
else
usr.SelectedCommand = 0
else ..()

href script
        for(var/mob/Attacker in TurnOrder)
if (Attacker != null && Attacker.Hp > 0 && Attacker.BattleNum && ContinueBattle)
Attacker.IsTurn = 1
Attacker << "[Server][Attacker], it is now your turn. Attack in 1 minute or your turn will be ended."
Attacker<<browse("<a href='?src=\ref[src];action=Attack'>Attack</a>","window=attack;popup;border=1,can_resize=1")


Problem description:Ok for some reason when i click the Attack href nothing happens it doesnt even get to debug what am i doing wrong?

Try using mob/Topic instead of client/Topic.
In response to A.T.H.K
this still doesnt fix it.
In response to National Guardsmen
Do you have any other Topic() procs in your code?
In response to A.T.H.K
yea i do

mob
Topic(href,list[])
switch(list["action"])
if("boot")
if(src.ckey==usr.ckey)
usr<<"You can not <u>boot</u> yourself."
usr<<browse(null,"window=boot")
return
usr<<browse(null,"window=boot")
var/Reason=input("Why are you booting [src.name]?","") as text|null
if(Reason == "" || Reason == null)
world << "[src.name] has been <u>muted</u> by [usr.name]."
else
world<<"[usr] has <u>booted</u> [src.name] for [Reason]."
del src
usr<<browse(null,"window=boot")
if("mute")
if(src.ckey==usr.ckey)
usr<<"[Server]You can not <u>mute</u> your self."
usr<<browse(null,"window=mute")
return
usr<<browse(null,"window=mute")
var/Reason=input("Why are you muting [src.name]?","") as text|null
var/Time=input("How long would you like to mute [src.name]? {minutes}","") as null|num
src.verbs -= /mob/verb/Say
src.verbs -= /mob/verb/Emote
src.verbs -= /mob/verb/OOC
src.muted=1
if(Time>=200)
Time=200
if(Time == "" || Time == null)
if(Reason == "" || Reason == null)
world << "[Server][usr.name] has <u>muted</u> [src.name]."
else
world << "[Server][usr.name] has <u>muted</u> [src.name] for [Reason]."
else
if(Reason == "" || Reason == null)
world << "[Server][usr.name] has <u>muted</u> [src.name] and will be <u>unmuted</u> in [Time] minutes."
else
world << "[Server][usr.name] has <u>muted</u> [src.name] for [Reason] and will be <u>unmuted</u> in [Time] minutes."
sleep(round(Time) * 600)
if(src.ckey != null)
Unmute(src.ckey)
usr<<browse(null,"window=mute")
if("unmute")
usr<<browse(null,"window=mute")
var/html="<html><head><title>Unmute</title></head>\
<body><table border=1 width=100% cols=2><tr><td align=center width=100%>Unmute who?</td></tr>"

for(var/mob/M in world)
html+="<tr><td algin=center><a href='?src=\ref[M];action=unmutes'>[M]</a></td>"
html+="</table></body></html>"
usr<<browse(html,"window=unmute;size=200x300")
if("unmutes")
Unmute(src.ckey)
usr<<browse(null,"window=unmute")
In response to National Guardsmen
There is your problem then you can only have one mob or client topic proc.. i think .. when ever i have two it screws up on me and won't let me do snything on the other topic .. so add your attack to that Topic()
In response to A.T.H.K
ok i did and still nothing. i think it has to do with how im refing the href.
In response to National Guardsmen
You are referring to other mobs wrongly, if you want to refer to another mob, do like so;

client/Topic(href,h[])
switch(h["action"])
if("boot")
var/client/a=locate(h["a"])//bootee
if(a)
del a

mob/verb/boot_someone()
for(var/client/c)
src<<"<a href=?action=boot&a=\ref[c]>[c]</a>"//this is how you refer in the link
In response to Shoe
I think i am calling it right sense im wanting it to call for the sttacker which is src

heres how i am calling
Attacker<<browse("<a href='?[src];action=Attacks'>Attack</a>","window=attack;popup;border=1,can_resize=1;can_close=1")
In response to National Guardsmen
Sigh... you could of posted that at the start.. lol

thats your problem..
Attacker<<browse("<a href='?src=\ref[src];action=Attacks'>Attack</a>","window=attack;popup;border=1,can_resize=1;can_close=1")


I hope that fixes it.. it should
In response to A.T.H.K
The Topic()
mob
Topic(href,list[])
switch(list["action"])
if("Attack")
usr<<"DeBug"
usr.Attacks()
else
return ..()

The Place im calling it, and this is the only Topic in my source.
for(var/mob/Attacker in TurnOrder)
if (Attacker != null && Attacker.Hp > 0 && Attacker.BattleNum && ContinueBattle)
Attacker.IsTurn = 1
Attacker << "[Server][Attacker], it is now your turn. Attack in 1 minute or your turn will be ended."
Attacker<<browse("<a href='?src=\ref[src];action=Attacks'>Attack</a>","window=attack;popup;border=1,can_resize=1;can_close=1")


I still isnt loading i have no clue why when i click it it does nothing.
In response to National Guardsmen
Umm you are clicking Attack right? and not just loading it and hopeing it does it automatic?
In response to A.T.H.K
i guess im clicking it right or what not.