ID:2766704
 
(See the best response by Ter13.)
Ive been trying to make a vending machine that gives you a random soda and it keeps giving me a "257:error: : invalid expression"
obj/vendingMachine
icon = 'interactables.dmi'
density = 1
icon_state = "vm"
verb/insert_credit()
usr << "ding"
set src in view(1)
pick(
new/obj/green_soda(loc),
prob(50)
new/obj/blue_soda(loc),
prob(50)
)<----- error: : invalid expression

Best response
<dm>
code goes here
</dm>

code goes here


The issue is that pick() isn't a valid expression on its own.

obj/vendingMachine
icon = 'interactables.dmi'
density = 1
icon_state = "vm"
verb
insert_credit()
set src in oview(1)
usr << "ding"
var/soda = pick(
/obj/green_soda,
prob(50)
/obj/blue_soda)
new soda(loc)


Probability weights actually need to be before the element they influence.

Also, your setting has to be at the top of the verb.
In response to Ter13
thanks man really helped