Welcome to the Builder Academy

Question re: echoing object variables

More
27 May 2020 12:45 #8732 by zi
EVERYTHING IS TRIGGERS!

I've tstat'ed * and now I'm turning to you!

Running a quest where the character has to retrieve 10 parts. Using a long elseif seemed wasteful, so I have one variable (cyborgparts) which starts as 0000000000 and when a character gives the questbot a part, he checks cyborgparts and if he accepts the piece, puts a 1 in there.

Here's the hard part. I'm having problems having the script return the shortdesc (or name) of the outstanding parts.

say You still have to get me some cyborg parts, such as:
set q 0 *set timer to 0*
while %q% < 10 * run through all 10 numbers in cyborg parts variable*
if %cyborgparts.charat(%q%)% == 0 *default is 0, the char doesn't have*
eval calc 12825 - %q% *I know this works because I can echo q and match the missing part vnum*
eval stuff %obj.id(%calc%)% *making shit up - get help from pros*
say vnum %calc%... %stuff.name% also known as %stuff.shortdesc% *tell player which parts are missing*
eval q %q% + 1 *roll up counter*
else *already has the part, really means charat found a 1*
eval q %q% + 1 *roll up the counter*
end
done


What am I missing? I THOUGHT trig 308 was the key, but I had a hard time translating it's function.

I'm new to triggers and appreciate any help (and kind words)!!! THANK YOU!

Please Log in or Create an account to join the conversation.

More
04 Jun 2020 13:16 #8746 by zi
Replied by zi on topic re: echoing object variables
Any thoughts on this?

I was very pleased to figure out how to parse a variable to keep track of multiple items in a quest- and very disappointed I couldn't figure out how to take a variable, make it identify as an item, and echo its name.

Any help would be appreciated!

Please Log in or Create an account to join the conversation.

More
07 Jun 2020 18:40 #8768 by Parnassus
I'm surprised that you're using 308 as an example since I've tried it and didn't actually see it doing anything. t1332 uses shortdesc variables and might be more helpful. If you look at t152, you'll see that Angel checks the object type and the vnum of the object and returns an emote using the object shortdesc.

It's hard to see exactly what's going on with your trigger since the clip is so short. You used "say" to see the outcome of the variables and that's really good! You may find it easier to use %echo% since some trigger types don't recognize "say". It would be helpful to see what was returned (what was said).

Please Log in or Create an account to join the conversation.

More
14 Jul 2020 13:40 #8812 by zi
Replied by zi on topic re: echoing object variables
Here's the code:

*TEMP TRIGGER 12899*
set cyborgparts %actor.cyborgparts%

say Hey, thanks for the %object.name%!
eval inside 12825 - %object.vnum%
if %cyborgparts.charat(%inside%)% == 1
say Eh, you already gave me this part.
drop %object%
elseif %cyborgparts.charat(%inside%)% == 0
say Oh nice, I needed this part!
%purge% %object%

*build a new cyborgparts*
eval i 1
eval newflag
while %i% < 11
if %i% == %inside%
eval digit 1
else
eval digit %cyborgparts.charat(%i)%
end
eval newcyborgparts %newcyborgparts%%digit%
eval i %i% + 1
done

eval cyborgparts %newcyborgparts%
remote cyborgparts %actor.id%

if %actor.cyborgparts% == 1111111111
say WTF! You did it! Have a gazllion exp or whatever...
else
say You still have to get me some cyborg parts, such as:
set q 0
while %q% < 10
if %cyborgparts.charat(%q%)% == 0
eval object 12825 - %q%
say %q% %object.name%
eval q %q% + 1
else
eval q %q% + 1
end
done
end

else
return 0
end






My Output from my mortal tester is:

357H 550M 149V > give leg quest
The Quest Cyborg says, 'Hey, thanks for the cyborg right leg!'
The Quest Cyborg says, 'Oh nice, I needed this part!'
The Quest Cyborg says, 'You still have to get me some cyborg parts, such as:'
The Quest Cyborg says, '3 Eastern Edge of the Combat Training Hall '
The Quest Cyborg says, '5 North-East Corner of the Combat Training Hall '
The Quest Cyborg says, '6 Northern Edge of the Combat Training Hall '


SOOOOOOOOoooooooo
how I can I grab a number and output all the variables to that vnum as an object (or a room, or mob for that matter)...

(also - say/echo/send gives me the same result, it's a formatting issue so I'm not fixing it until the core code is sturdy)

Please Log in or Create an account to join the conversation.

More
30 Jul 2020 16:17 #8816 by zi
Replied by zi on topic re: echoing object variables
how I can I grab a vnum and output all the variables to that vnum as an object (or a room, or mob for that matter)????

It doesn't have to be in a 'say' - can be in an echo or send. can this be done?

Another way to approach this is: can YOU write a script that cycles through a list of numbers, 1-10 and then give short descriptions as objects, room names, and mob names (assuming there's a mob, room, and object with a vnum of 1,2,3,4,5,6,7,8,9,10)

Please Log in or Create an account to join the conversation.

More
30 Jul 2020 22:53 #8819 by Parnassus
I think I still don't have enough information. For instance, what are those answers that look like room names? Are they from rvnums? Also, I need to know exactly what he's looking at. You can give me that by adding in says or echos for every variable that changes, showing me the output of the variable before AND after it changes.

This should look something like:
say Variable <variable name> = %whatever the variable is%.
eval <variable name> (add in the eval here)
say Variable <variable name> has changed to : %whatever the variable is now%

If you do this for EVERY variable in your list, I might be able to see something. As it is, you know what they're talking about because you wrote it. I haven't a clue what your code means. This is why I never expect people to understand what my triggers are doing :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.226 seconds