Welcome to the Builder Academy

Question Question about using char.varexists

More
23 Apr 2017 17:28 #6647 by Tratillo
Is there a way to use the value of a remote variable when using varexists for a player? For example lets say I am doing a 10 step quest. Is there a way to change the value of one remote quest variable (set quest_0 1) (set quest_0 2) remote that to the players pfile, which is all possible, and then use varexits to search for the value of quest_0 instead of just if quest_0 exists (this is what I can't figure out if possible). It would make it so much more efficient if I didn't have to send 10 different remote variables to the pfile and could just track it with the value of one remote variable.

I have not been able to get this to work thought it seems varexists will just search and see if that variable exists in the pfile not search for if the variable exists with a specific id value. Thanks for any help.


Tratillo

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

More
25 Apr 2017 21:22 - 25 Apr 2017 21:22 #6660 by thomas
Code:
if %actor.varexists(xxx)% %echo% %actor.xxx% end
echoes the value of %actor.xxx%
Code:
set xxx varname if %actor.varexists(%xxx%)% %echo% %%actor.%xxx%%% end
Echos the value of %actor.varname%
Last edit: 25 Apr 2017 21:22 by thomas.

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

More
28 Apr 2017 01:45 #6666 by Tratillo
Not quite what I am trying to do. I am trying to have one trigger check to see if a variable exists with the value of 1, if so then change it to the value of 2. Then have a different trigger that only fires if the variable has a value of 2, not if it just exists.

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

More
28 Apr 2017 02:14 #6667 by Parnassus
I know that I'm pointing to a very complicated trigger, since I wrote it myself to be very complicated:
Parna's Elevator

This isn't quite the same thing but if you look for the variables targfl and CurFl (current floor), you can see the response changing as the trigger compares the floor you want to get to against the floor you're on now.

Example:
Code:
if %targfl% == g set dir down eval length %Curfl% elseif %targfl% > %Curfl% set dir up eval length %targfl% - %Curfl% elseif %targfl% < %Curfl% set dir down eval length %Curfl% - %targfl% else set dir nowhere set length 0 end

If you use the elevator on the test port, it might be easier to understand but you can see that I'm using a variable named CurFl and changing it as my virtual elevator moves up or down. The trigger then takes that number and uses it to change the response.

You'll see it again here:
Code:
if %Curfl% == 0 set displaymsg the ground floor else set displaymsg floor %Curfl% end %send% %actor% The elevator is on %displaymsg%. halt * if look is not noarg or display else return 0 end

This one is actually much simpler because it basically says, if you look at the elevator display (which is something most people do most days in real life) it will tell you which floor the elevator is on. If you look at it a few seconds later, you'll see if the elevator is standing still, moving up or moving down, just by checking changes in the variable.

I hope this helps you.

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

More
28 Apr 2017 16:15 #6669 by thomas

Tratillo wrote: Not quite what I am trying to do. I am trying to have one trigger check to see if a variable exists with the value of 1, if so then change it to the value of 2. Then have a different trigger that only fires if the variable has a value of 2, not if it just exists.


Exactly. If you remote the var X to the player, you can read the value with %actor.X%

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

Time to create page: 0.239 seconds