- Posts: 13
- Thank you received: 1
re: echoing object variables
- zi
-
Topic Author
- Offline
- New Member
-
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!
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Making 3M Great Again!
telnet://3m.funcity.org:3000
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Please Log in or Create an account to join the conversation.
- zi
-
Topic Author
- Offline
- New Member
-
- Posts: 13
- Thank you received: 1
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!
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Making 3M Great Again!
telnet://3m.funcity.org:3000
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Please Log in or Create an account to join the conversation.
- Parnassus
- Offline
- Administrator
-
- Posts: 366
- Thank you received: 54
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.
- zi
-
Topic Author
- Offline
- New Member
-
- Posts: 13
- Thank you received: 1
*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)
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Making 3M Great Again!
telnet://3m.funcity.org:3000
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Please Log in or Create an account to join the conversation.
- zi
-
Topic Author
- Offline
- New Member
-
- Posts: 13
- Thank you received: 1
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)
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Making 3M Great Again!
telnet://3m.funcity.org:3000
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Please Log in or Create an account to join the conversation.
- Parnassus
- Offline
- Administrator
-
- Posts: 366
- Thank you received: 54
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.
- zi
-
Topic Author
- Offline
- New Member
-
- Posts: 13
- Thank you received: 1
I think i said it a few times, but i have a quest master mob that is taking in objects, 10 to be exact, and using- sorry- remoting a binary string (1111111111 is complete, 0000000000 is empty) to a player file depending on the objects they turn in.
so I have NO problem writing to the binary string (keeping track of what objects were given to the quest master.
you give object 6? great, your string is now 0000010000
then you give object 10? 0000010001
hey.... objects 1,3,5? 1010110001
that's what i'm doing, and I don't need help with that. I'm trying to get my quest master to calculate the missing objects and then output their short descriptions or names.
To simply it, I asked: can you write a script that prompts the player for a number and then uses that number to output variables for rooms/objects/mobs. Cause that's the only part I need to work.
Conceptually, it looks like this:
Hi, give me a number?
500
that's room: The Cleric's Dressing Room
that's object: the odd sceptre
that's mob: minor demon
again- I'm looking to create a variable, assign it a vnum, identify as an item, and echo its name.
can that be done?
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Making 3M Great Again!
telnet://3m.funcity.org:3000
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Please Log in or Create an account to join the conversation.
- Parnassus
- Offline
- Administrator
-
- Posts: 366
- Thank you received: 54
1) Name : Cyborgparts trigger
2) Intended for : Mobiles
3) Trigger types: Receive
4) Numeric Arg : 100
5) Arguments :
6) Commands:
wait .5s
* We're not a dump. Refuse any other object.
if %object.vnum% < 3081 || %object.vnum% > 3087
return 0
wait .5s
say That doesn't fit in the pattern.
emote returns the item.
halt
end
wait .5s
* Set up the variables and check to see if we already have the piece.
if !%actor.varexists(cyborgparts)%
set cyborgparts 0
remote cyborgparts %actor.id%
end
set cyborgparts %actor.cyborgparts%
eval cyborgpiece %object.vnum%-3000
say Hey, thanks for %object.shortdesc%, %actor.name%!
emote consults a list.
* Accept or reject the part.
if %cyborgparts% /= %cyborgpiece%
say Eh, you already gave me this part.
drop %object.name%
halt
else
say Oh nice, I needed this part!
emote checks the list again.
wait .5s
end
%purge% %object%
* Keep a record of what has already been accepted.
set cyborgparts %cyborgparts%_%cyborgpiece%
remote cyborgparts %actor.id%
* Check to see if quest is finished or not.
if %actor.varexists(cyborgcount)%
say WTF! You did it! Have a gazllion exp or whatever...
rdelete cyborgparts %actor.id%
rdelete cyborgcount %actor.id%
else
say You still have to get me some cyborg parts, such as:
set q 3081
while %q% < 3088
eval cyborgpiece %q%-3000
if !%actor.cyborgparts.contains(_%cyborgpiece%)%
%load% obj %q%
say %lastloaded.shortdesc%
%purge% %lastloaded%
eval cyborgcount %cyborgcount% + 1
end
eval q %q% + 1
done
if %cyborgcount% < 2
remote cyborgcount %actor.id%
say Oh, goodness! That will be the last part!
end
end
I used items from zone 30 as a test. You can see that the list is inefficient but it would have taken me much longer to have worked out a better way to do it. A loop would have saved some lines.
Please Log in or Create an account to join the conversation.
- thomas
-
- Offline
- Administrator
-
- Posts: 751
- Thank you received: 143
Loading the object is probably easiest:
%load% obj %objvnumhere%
%echo% %lastloaded.name%
%purge% %lastloaded%
Please Log in or Create an account to join the conversation.
- Parnassus
- Offline
- Administrator
-
- Posts: 366
- Thank you received: 54
Please Log in or Create an account to join the conversation.
- zi
-
Topic Author
- Offline
- New Member
-
- Posts: 13
- Thank you received: 1
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Making 3M Great Again!
telnet://3m.funcity.org:3000
_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
Please Log in or Create an account to join the conversation.
- Parnassus
- Offline
- Administrator
-
- Posts: 366
- Thank you received: 54
For anyone confused by my mention of frankentriggering, it's my method. If you need more info on it, I explain it here .
Please Log in or Create an account to join the conversation.