ID:452371
 
(See the best response by Stephen001.)
Code:
obj
Test
verb
Testing()
set src in oview(1)
var/x1 = ""
Check(x1)
usr << "[x1]"
obj
proc
Check(var/M)
var/I = rand(1,8)
switch(I)
if(1)
M = "Eevee"
if(2)
M = "Flareon"
if(3)
M = "Jolteon"
if(4)
M = "Vaporeon"
if(5)
M = "Umbreon"
if(6)
M = "Espeon"
if(7)
M = "Glaceon"
if(8)
M = "Leafeon"
return M


Problem description: I know it probably looks weird, I started learning about C coding and stuff and I was wondering if I could use a proc to send a variable into it, calculate stuff or w/e and then send that variable back into the verb I'm using?

Basically sending that x1 variable into the proc, random would define what out of the 8 things it could be and then send it back so I can use it in the verb later on

Best response
x1 = Check(x1)


Is the magic you are missing there, as x1 is a text string and so not a complex object. If you alter complex objects (atoms, datums, mobs, objs etc) variables, that is reflected in the code you run after the proc has finished. Like if I set obj.name = "Hello" in a proc, and I can expect obj to still have the name "Hello" after the proc is done. However if I set obj = "Hello" in the proc, I can't expect that to be the value outside the proc afterwards just because I set it inside.