variable exhaustion

Content and general development discussion, including quest scripts and server code. TMW Classic is a project comprising the Legacy tmwAthena server & the designated improved engine server based on evolHercules.


Forum rules

This forum houses many years of development, tracing back to some of the earliest posts that exist on the board.

Its current use is for the continued development of the server and game it has always served: TMW Classic.

Post Reply
User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

variable exhaustion

Post by o11c »

This is the list of all the variables that are set. There is a hard limit of 96, so any more than that will cause problems!

Note that there may be a few false positives, for occurrences of the word "set" in a string or comment, or when the variable is only set to 0. Also, the new tutorial is safe because they are all set to 0 before you finish.

Edit: add script, which cuts down a bit on false positives in strings and comments; update list

Code: Select all

grep -o -h '\<set \+[A-Za-z_][A-Za-z_0-9]* *,' -r npc/ db/  | sort -u

Code: Select all

set Annual_Quest,
set BOSS_POINTS,
set BankAccount,
set BaseLevel,
set Bugleg,
set Candyman,
set CaveSnakeLamp,
set ChestQuest,
set ChristmasQuest,
set ChristmasQuest2,
set Count_White,
set Count_Yellow,
set DailyQuestBonus,
set DailyQuestPoints,
set DailyQuestTime,
set Easter_2010_EggState1,
set Easter_2010_EggState2,
set Easter_2010_EggState3,
set Easter_2010_EggState4,
set Easter_2010_EggState5,
set Easter_2010_QuestState,
set FLAGS,
set Golbenez_Inn_Cost,
set Golden,
set HEATHIN_QUEST,
set HWQUEST1,
set HWQUEST10,
set HWQUEST11,
set HWQUEST12,
set HWQUEST13,
set HWQUEST14,
set HWQUEST15,
set HWQUEST16,
set HWQUEST17,
set HWQUEST18,
set HWQUEST19,
set HWQUEST2,
set HWQUEST20,
set HWQUEST3,
set HWQUEST4,
set HWQUEST5,
set HWQUEST6,
set HWQUEST7,
set HWQUEST8,
set HWQUEST9,
set Halloween08,
set HellSave,
set HellState,
set Hp,
set Illia_Uniques_Count,
set Inspector,
set Katze,
set KatzeBeenOutside,
set LastHiss,
set MAGIC_EXPERIENCE,
set MAGIC_FLAGS,
set MPQUEST,
set Maze,
set Menhir_Activated,
set Mirak_Bantime,
set Mirak_Questtime,
set Mobpt,
set Naem_Quest_Done,
set Open_Underground_Palace_Barrier,
set OrumQuest,
set OrumQuestBarrier,
set OrumQuestTorch,
set QUEST_Airlia,
set QUEST_Barbarians,
set QUEST_BlueSage,
set QUEST_Christmas09_state,
set QUEST_Easter08_state,
set QUEST_Easter09,
set QUEST_Easter09_slots,
set QUEST_Easter11,
set QUEST_Easter12,
set QUEST_Forestbow_state,
set QUEST_Graveyard_Caretaker,
set QUEST_Graveyard_Inn,
set QUEST_MAGIC,
set QUEST_MAGIC2,
set QUEST_MIRIAM,
set QUEST_MIRIAM_cheat,
set QUEST_MIRIAM_run,
set QUEST_MIRIAM_start,
set QUEST_Mirak,
set QUEST_Nivalis_state,
set QUEST_NorthTulimshar,
set QUEST_Scythe_state,
set QUEST_WG_state,
set QUEST_clothdyer_knowsdye,
set QUEST_clothdyer_state,
set QUEST_demon_mines,
set QUEST_xmas07_cookies,
set QUEST_xmas07_milk,
set QUEST_xmas07_presents,
set QUEST_xmas07_state,
set QUEST_xmas08_state,
set Quest_Halloween,
set ResetA_charstate,
set Rossy_Quest,
set Scorp,
set Silver,
set TMW_Quest,
set TUT_var,
set White,
set XMASQUEST1,
set XMASQUEST10,
set XMASQUEST11,
set XMASQUEST12,
set XMASQUEST13,
set XMASQUEST14,
set XMASQUEST15,
set XMASQUEST16,
set XMASQUEST17,
set XMASQUEST18,
set XMASQUEST19,
set XMASQUEST2,
set XMASQUEST20,
set XMASQUEST3,
set XMASQUEST4,
set XMASQUEST5,
set XMASQUEST6,
set XMASQUEST7,
set XMASQUEST8,
set XMASQUEST9,
set Xmas2010,
set Yellow,
set Zeny,
set cavefights,
set gotcherry,
set hasan,
set hw2011,
set hween10,
set hween10_bonecount,
set hween10_collect,
set hween10_collect_canpump,
set hween10_collect_jelskul,
set hween10_collect_mmallow,
set hween10_collect_tondel,
set hween10_credits,
set hween10_paid,
set kaan,
set maggot,
set sorfina,
set tanisha,
set tvis,
set wolvern_count,
set xmas11,
set xmas2012,
set yet,
Former programmer for the TMWA server.
User avatar
argul
Novice
Novice
Posts: 237
Joined: 08 Aug 2010, 18:43

Re: variable exhaustion

Post by argul »

for a more accurate overview see eathena-data/tools/showvars.py
---
User avatar
Jenalya
TMW Adviser
TMW Adviser
Posts: 717
Joined: 22 Sep 2010, 19:28

Re: variable exhaustion

Post by Jenalya »

I took o11c's list and created an overview of the variables:
variables.txt
(12.98 KiB) Downloaded 106 times
There's a section about the variables actually in use in the scripts and a section with the variables which are deleted in clear_vars.
I identified quite a lot of variables which could be refactored (e.g. some are used as boolean, they could be included in the FLAGS variable and the old one can be added to clear_vars).

PjotrOrial wrote a python script to extract player variables together with amount of occurences from a player save file (save as .txt because the forum doesn't allow .py as extension):
python_showing_vars_in_save_file.py.txt
(940 Bytes) Downloaded 94 times
which I used to get the player variables from a rather recent player save file from the mainserver.
These are in the save file, but not in the scripts:

Code: Select all

EasterQuest: 1
QUEST_Halloween07_state: 52
QUEST_clothdyer_angus: 120
MAGIC_CAST_TICK: 4
PC_DIE_COUNTER: 23303
I wonder if PC_DIE_COUNTER is one of the maximum 96 player variables or if it goes extra? And I wonder what MAGIC_CAST_TICK is? The other ones look like old variables which were forgotten to be added to clear_vars.
User avatar
Nard
Knight
Knight
Posts: 1113
Joined: 27 Jun 2010, 12:45
Location: France, near Paris

Re: variable exhaustion

Post by Nard »

Code: Select all

MPQUEST
// boolean if the player is registered for monster points
// TODO: move to a flag
Mobpt
// amount of Monster Points
tvis
// amount of items gotten from Ishi in exchange of monster points
You could suppress MPQUEST and Make Aidan give 1 monster point (or any non zero amount) to the player, then If Mobpt is non zero, player is registered.
Edit

Code: Select all

// TODO: check if they can be deleted
    Easter_2010_QuestState
Easter 2010 made players who completed it able to reach Easter island with a magic spell (alonzialonzo). Those who began but had not finished it can use Dark Petal to reach it and come back through a portal ( If I a remember well). thus state has to be kept.
User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

Re: variable exhaustion

Post by o11c »

In brief:
MAGIC_CAST_TICK is unconditionally cleared when players log out, in the current version of the server. Therefore, whoever has this has obviously not logged into that character.
Previously, it would count toward the 96. (It was used to prevent casting magic if you logged out before your spell timer ran out)

PC_DIE_COUNTER does count toward the limit of 96.

Note also that some variables may be set in magic.conf (set_script_variable), and not in scripts. Variables set in magic.conf always count toward the 96, even if they start with a sigil like @.
Former programmer for the TMWA server.
User avatar
Jenalya
TMW Adviser
TMW Adviser
Posts: 717
Joined: 22 Sep 2010, 19:28

Re: variable exhaustion

Post by Jenalya »

In the past weeks I did some variable restructuring on some quests.
Here's an updated overview of the variables:
variables.txt
(13.97 KiB) Downloaded 107 times
Post Reply