Log in

View Full Version : Little help please



LordRaven
06-25-2010, 11:01 PM
I am using a matchfind to assign variableX (usage: ? just arrived.). Then I try using variableX.id to cast spells at that person and am getting the "Cast at what?" messaging.

Does matchfind not return a usable GameObj?

Example...

blah blah blah

target = matchfind "? just arrived."

blah blah blah and more blah

fput("prep 101")
fput("cast ##{target.id}")

Tillmen
06-25-2010, 11:11 PM
Right, matchfind returns a string, not a GameObj. But in this case, character names are unique, why do you want to cast at the id?

LordRaven
06-25-2010, 11:32 PM
In shattered the names sometimes are also names of items in rooms. So the id is the safest way to make sure you do not cats at say a knife, when the player knife is who you meant to cast at.

I solved it a moment ago by adding:
possible_target = variableX;
target = GameObj.pcs.find { |pc| pc.name == possiblie_target }