DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • December 18, 2018, 12:56:35 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Resource Pages

Pages: [1]   Go Down
Author Topic: Special Vars Tables  (Read 11514 times)
0 Members and 1 Guest are viewing this topic.
« on: February 20, 2004, 05:14:59 PM »

Another way to deal with special vars on your site brought to you by Yippy and released on Sourceforge. For those of you having problems with the Voodoo shop and other mods that require the special vars, this is it.


This is a discussion about this site enhancement between me and Yippy on Sourceforge.net. I've kept this as a text file for a while and I think it's something everyone should know if you're running special vars.

Date: 2003-12-13 19:31
Sender: yippy
Logged In: YES

This patch allows special events to store persistent data.  
You only need it if you are creating events that need to
remember things, none of the original events need it.

If you're not creating your own events, you probably don't
need this.

Date: 2003-11-12 12:34
Sender: yippy
Logged In: YES

The specialvars.php marked (fixed) has the fix I was talking

I haven't worked on this in a few months because my players
started moving on to other things, but these are pretty simple
functions.  I'm not sure if you've looked at the code at all,
yet, but it's very simple.

set_special_var(variable name, value, <event>,
By default it stores the variable with the current event and
current player, but you can manually set them if you want.  If
you set the player to NULL, it will be set for all players
(although if they have the same variable set just for them,
theirs will take precedence)

get_special_var(variable name, <event>, <player>)
By default it looks for the variable with the current event and
the current player, but you can manually set it here, too.

So, lets say you want to have an elf in the forest that you
can pay to be your friend, and you want it to remember how
much each player has given him.  When the player gives him
25 gold, you can:
set_special_var(GoldGiven, 25);

This gets stored in the SpecialVars table like this:
ElfEvent, Player#5, GoldGiven, 25

Then when the player comes back, and you:
It returns 25, because it queries for the player, the event,
and the variable name.

Maybe you can pay the elf to do something mean to a
particular player the next time they come by.  Assuming the
victim is Player#13, set:
set_special_var(BeMean, TRUE, "ElfEvent", 13)
When that player meets the elf the next time, it pulls this
variable and he leaves with hemhorroids.

If someone kills the elf or something else global, you can set:
set_special_vars(Dead, True, "ElfEvent", NULL)
Anything with player NULL is set for all players.  So the next
time a player finds the elf event it can check first if the elf
alive, and since he's dead the event can be different.

After a certain number of people find the elf, he can come
back to life, just by deleting the Dead variable.
set_special_vars(Dead, NULL, "ElfEvent", NULL)
A NULL value deletes the variable.  We have to set the player
to NULL too, because that's how we stored it.

I'm not sure why I put Event before Player in set_special_var,
I think because when I wrote these I was working on an
event that set variables for other events.  You'll probably
more commonly set global variables for the current event, so
for convenience you might want to swap those two in the
set_special_var definition.  That way you don't have to
specify the event name every time.

The good thing about this is you can set as many variables as
you want with whatever names you feel like, and it's easy to
use so php-newbies can still do fun stuff with their events.

Hopefully we get this new module system soon, but it seems
like everyone else has been as busy as I have this fall, so
who knows when it'll appear.

Feel free to do whatever you want with this, though, I'd love
to see it get used by someone besides me Smiley


Date: 2003-11-12 11:18
Sender: lonestrider
Logged In: YES

Hey Yippy, this looks like a better solution to something I was
working on for quest packets. Do you have some examples of how
you're applying the special event data from events?

Or an ideal situation on how it should function.

Also, did you get a chance to fix the silly bug?

Date: 2003-08-27 19:17
Sender: jtraub
Logged In: YES

This hasn't been added to the code yet, but Eric and I plan
on a much more intensive module system for 0.9.8 onward.

We invite you to submit your events and such however so that
we can consider them for inclusion.
Offline Offline

Posts: 30

View Profile
« Reply #1 on: October 04, 2009, 07:20:43 PM »

Does anyone know where this file is now?

Mod God
Offline Offline

Posts: 3598

short, sweet and to the point

View Profile
« Reply #2 on: October 04, 2009, 08:28:08 PM »

the file can be found here

Uuma ma ten rashwe, ta tuluva a lle

Play the latest beta version here on LoGD DragonPrime - Axebridge
Offline Offline

Posts: 30

View Profile
« Reply #3 on: October 04, 2009, 09:32:19 PM »

Thanks. I swear I looked there ><
Pages: [1]   Go Up
Jump to:  

DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
76 Guests, 1 User
Home Forums News Downloads Login Register Advanced Search