ID:155743
Mar 29 2011, 8:21 am
|
|
Basically to summarise it, I want the alert() proc to stay on the screen after the mob/usr make his/her selection. Can anyone help me with this?
|
Mar 29 2011, 12:58 pm
|
|
Make a skin and use a window instead of alert
|
Make another alert box display instantly after selection in the right circumstances?
What the are the conditions you want for it to not go away? If I know that I could help you write it. P.S Yes skins are good but there's technically nothing wrong with alert boxes and once you experiment with alert boxes and realize the weaknesses it will often make you want to learn skins anyway. |
In response to Kyle_ZX
|
|
I'll try and read up on the skins.
But what I want to do is make an attack script for AI mobs. So something like this: Click() But I want it so that when I hit "attack", the alert must stay up until "cancel" is chosen |
In response to Saladon
|
|
Click()
var/mob/X = src usr.Attack(X) mob/proc Attack(mob/X) switch(input("What would you like to do?") in list ("attack","cancel")) if("attack") X.hp -= src.dmg src << "you attack [X]" X.deathcheck() src.Attack(X) if("cancel") return |
In response to Kylemark
|
|
Thank you thats one way to do it.
But out of curiosity, how can I call an existing switch statement? is there a way to mark the switch statement or do something where I can bring it up again? or do I have to manually add a thousand switch statements |
In response to Saladon
|
|
That be the correct way to do it... you could use goto and labels though but i would not suggest that
|
In response to Kylemark
|
|
One thing that I can't seem to get right is making it so that the src needs to be in oview(1). no matter how much I play witht the code it doesnt seem to work.
|
In response to Saladon
|
|
Click()
set src in oview(1) var/mob/X = src usr.Attack(X) |
In response to Kylemark
|
|
'set' only works in verbs. You'll have to check that the user is in range yourself (either with get_dist() or by seeing if the object is 'in' the view(1,usr) list)
Also, you're method of re-calling Attack() will eventually overflow the call stack. You could use a spawn() to prevent that, but a while() loop might make more sense here. |
In response to DarkCampainger
|
|
answered this at work. guess i should look at my advise better just wanted to get the ball rolling i guess.
mob Click() if(usr.Attacking==1) return for(var/mob/MM in oview(1)) if(MM) usr.Attacking=1 var/mob/X = src usr.Attack(X) mob/proc Attack(mob/X) if(src.Attacking==1) return switch(input("What would you like to do?") in list ("attack","cancel")) if("attack") X.hp -= src.dmg src << "you attack [X]" X.deathcheck() spawn(src.delay) src.Attacking=0 src.Attack(X) if("cancel") src.Attacking=0 return |