ID:891053
 
Keywords: buttons, interface
(See the best response by NNAAAAHH.)
I've a mob that help you levelup & sell attack(/obj/Attacks)
There is his Attack_Shop code:
mob/NPCs/Trainer/verb
Attack_Shop()
set src in oview(1)
set category = "Leveling"
if(length(usr.Attack) == 0)// as you levelup more attacks are added to usr.Attack
usr<<"You can not get anymore attacks at this level"
return
var/obj/Attacks/attack = input("Whict attack do you want to buy?","[src]:")in usr.Attack
var/Price = attack.PBI
switch(alert({"It will cost [Price] gold([usr.Gold]) to level your [attack.name] up.
Are you sure?"}
,"[src]:","Yes","No"))
if("No") return
if("Yes")
if(usr.Gold < Price)
usr<<"You need [Price-usr.Gold] more gold!"
return
usr.Gold -= Price
attack.Lv += 1
usr.Attack -= attack
usr.Attacks += attack
usr.verbs += /obj/Attacks/proc/Use// Use(attackname as text)
attack.suffix = "Lv[attack.Lv]"
gol
var/L = input("","") in list("Atk2","Atk3","Atk4","Atk5","Atk6","Atk7","Atk8","Atk9","Atk10","Cancel")
if(L == "Cancel") return
if(winget(usr,L,"Command") == "true")
switch(alert("You have attack([winget(usr,L,"Command")]) in button [L]","","Yes","No","Cancel"))
if("No") goto gol
if("Cancel") return
if("Yes")
winset(usr,L,"Command=Use \"[attack.name]\"")
winset(usr,L,"text=[attack.name]")
else
winset(usr,L,"Command=Use \"[attack.name]\"")
winset(usr,L,"text=[attack.name]")
world<<"[winget(usr,L,"Command")]"// outputs "Use " not "Use "attack1""

In my interface I've 10 attack buttons ("Atk1"-"Atk10") "Atk1" is peset to a basic attack the others are empty
I'm trying to make it when an attack is bought the user can set it to one of the Atk buttons but I need some help
Thank you for looking & any help be nice
Prf X
You should try out some libaries. Forum Account's HUD Groups libary does what you're looking for.
In response to NNAAAAHH
I look at F_A's HUD Groups library & it does not
I'm using the build-in .dmf interface file
not making a map base interface
In response to Prf X
I apologize, I just read the summery at first and figured you were going for HUDs, why wont you use HUDs anyway?

Buttons have a image setting, you can attach a image to those buttons to represent the attack. There is a command setting where you can change the verb in which is used. You'd simply have to save these settings and load them once the mob logs in.
It the command that not working I'm trying to get "winset(usr,L,"Command=Use \"[attack.name]\"")" to work
Look into text2path() a little bit.

And, lacking experiance with switching commands for controls at runtime, Why would you place 'Use' in this?
In response to NNAAAAHH
NNAAAAHH wrote:
Why would you place 'Use' in this?

/obj/Attacks/proc/Use(name as text)
set src in usr
set hidden = 1
if(findtext("Heal",name))
world<<"Use ([name])"
usr.HP += src.power
else
var/mob/M = input() in oview(src.Range)
if(M)
M.HP -= src.power
return
In response to Prf X
OH, ok. Sorry, I've been lacking sleep a lot lately; but when am I not? Lol.

The name of the obj might be becoming blank somewhere.

I would find it easier to simply attach a attack verb to each button than a obj reference.
It needs to be an obj because the usr have to buy it frist
& no the name is not blank
                    world<<{"[winget(usr,L,"Command")]
winset(
[usr],[L],"Command=Use "[magic.name]"")"}/*outputs "Use
winset(Prf X,Atk2,"Command=Use "Fireball"")"*/
Best response
It only has to be an object orriginaly, you could have the obj.name set to the name of a verb. Then you could use text2path("mob/verb/[obj.name]") to set the verb to the control. Which would cancel out the need for Use "Name"
Thank you
In response to Prf X
No problem, sorry it took me so long to get you the help you needed.
I should have thought of that too