ID:148564
 
Ok, I'm designing new DragonBall code using the findtext() proc. It's all working just dandy and all...but, a part of my code is being a beetch. Here's the snippet:

                                    if(findtext(wish,"revive")||findtext(wish,"revival")||findtext(wish,"rev")||findtext(wish,"life"))
var/list/deadpeeps = list()
for(var/mob/characters/M in world)
if(M.dead==1)
deadpeeps+=M
var/obj/P=input("Who do you wish to revive?","Revival","") in deadpeeps
switch(alert("Are you sure you want to wish for the revival of [P]?","[P]","Yes","No"))
if("Yes")
switch(alert(P,"[src] is trying to revive you, do you wish to let him?","Revive?","Yes","No"))
if("Yes")
if(P.revived<=0)
P.revived+=1
world<<"<b>[src] has wished [P] back to the living!"
P<<"<b><b>You feel your body getting revived!!!"
P.powerlevel=P.maxpowerlevel
P.ki=P.maxki
P.str=P.maxstr
P.stamina=150
P.dead=0
P.overlays-=/obj/halo
P.overlays-='halo.dmi'
P.overlays-=/obj/halo
P.overlays-='halo.dmi'
P.overlays-=/obj/halo
P.overlays-='halo.dmi'
break
else
src<<"<b>You tried to revive [P], but [P] has already been revived once by the dragonballs."
P<<"<b>[src] tried to revive you, but you have already been revived once by the dragonballs."
goto WISH
else
var/reason=input(P,"Tell [src] why you don't wish to be revived yet.","Reason") as null|text
src<<"<b>You tried to revive [P], but [P] does not wish to be revived yet, because '[reason]'."
goto WISH
else
src<<"<b>Ok..."
goto WISH
else
src<<"<b>No one is in need of revival."
goto WISH


It does allthe prompts, but...my problem is this, it always says no one is in need of revival even if there's like 100 people dead :-\(Sorry about the indentation, long code.)
Also, my Spirit Bomb tech doesn't work. Even though it doesn't show any errors in the Compilation process. Any help?

obj
SpiritBomb
icon = 'turfs.dmi'
icon_state = "sbomb"
layer=MOB_LAYER +9
var
power = 500

obj
sbomb
tech=1
name="Spirit Bomb"
verb
sbomb(mob/M in oview())
set category="Fighting"
set name="Spirit Bomb"
if(istype(M,/mob/characters)||istype(M,/mob/monsters)||istype(M,/mob/multiform)||M.npp==0)
var/stage=1
var/obj/O=new/obj/SpiritBomb(usr.x,usr.y+1,usr.z)
usr.icon_state="sbomb"
view(10)<<"<font color = green>{{<font color = white>[usr]<font color = green>}}<font color = white>: Spirit Bomb!!!"
for(var/mob/F in world)
if(F.client)
if(F.z==usr.z)
start
switch(alert("Draw more power from those that surround you?","SB","Yes","No"))
if("Yes")
if(stage>=5)
usr<<"<b>SB is fully powered!"
switch(alert("Do you wish to launch the Spirit Bomb now, or later?","SB","Now","Later"))
if("Now")
s_missile(O,usr,M)
M.powerlevel-=(O:power *2)
M.Die()
usr.icon_state=""
del(O)
else
goto start
sleep(5)
else
stage++
if(F.ki>=1)
var/KI=(F.ki*0.10)
O:power+=KI
F.ki-=KI
F.ki=round(F.ki)
O:power=round(O:power)
if(F==usr)
F<<"<b>You slowly drain your energy into the attack."
else
F<<"<b>[usr] gathers energy from you..."
sleep(15)
goto start
else
F<<"<b>[usr] tries to gather energy from you, but you have nothing more to give."
F.ki=0
goto start
if("No")
s_missile(O,usr,M)
M.powerlevel-=(O:power*2)
M.Die()
usr.icon_state=""
del(O)
else
usr<<"<b>You cannot."
P<<"<b><b>You feel your body getting revived!!!"

First, <b><b>... two bold tags? You only need 1, and you should close it. Perhaps you should learn a bit of HTML.

You're very lucky I'm repling... I hate DBZ games.

Okay, you know your else statement, inside the for loop?
else
src<<"<b>No one is in need of revival."
goto WISH

That one. Well, lets say that the first person your for loop chooses isn't dead... that person would trigger the above else statement, and your goto WISH would be executed, thus breaking your if statement. Boom, you're back to the beginning.

-<font color="#ffff00">Nova</font>

PS: Don't put so many tabs. You have the ability within you to take the things out.

In response to Nova2000
Oh, the two bold tags...was a mistake, LOL...I used the find/replace all button...but, that doesn't solve my problem from what you've explained...but, thanks anyways
In response to Goku72
I don't know what the problem is, but just becuase it doesnt work and theres no errors doesn't mean you did it correctly. You put in technically correct code that does nothing.
In response to Goku72
Goku72 wrote:
Oh, the two bold tags...was a mistake, LOL...I used the find/replace all button...but, that doesn't solve my problem from what you've explained...but, thanks anyways

GAH! Did you read anything after the part about two bold tags? Okay, I'll try agian:

Let's pretend that I (Nova) am a player in your happy litte DBZ world (Why I'm there, heh...). Somebody sommons the dragon, and that for(mob/character/M in world) starts. I happen to be the first M chosen by the for loop (Lucky me) and it proceeds to the if(M is dead) statement. Because I'm alive, it skips the if statement, and goes to the else statement. The else statement says, goto WISH, so the DM goes, and BAM! we're back to the start. That is what I think is wrong with your code... follow?

-<font color="#ffff00">Nova</font>