![]() |
|
|
#1 | |||
|
Архивный участник
Join Date: Oct 2005
Posts: 18
|
(To keep the information in one place I will just continously update this first post - In order for you to know if a significant update took place i will simply make a notifying post in this topic describing the new things that I have added).
Overview ai.obj is used by a stack machine a stack machine is a combination of a specific data structure, a stack and a language that operates on the stack. The Stack Stacks are data structures which maintain the order of last-in, first-out. A good analogy is that of a stack of plates. The first plate you put in the stack is the last one that you get out. If in place of plates we have data objects let's say that we put objects A B C D in the stack in that order then the stack would look after each addition like thus: [php:1:3a88cfacc0] D C C B B B A A A A [/php:1:3a88cfacc0] You can access data objects only from the top of the stack. If you want to access element C then you will have to change where the top of the stack is. You can do that because a stack data structure is combined with an index THE STACK POINTER, which points to the top of the stack + 1. If the stack has no elements then the STACK POINTER is 0. If you add one element is 1 in our example where all 4 elements have been introduced the STACK POINTER has the value 5. So closing this description you have to remember 2 things for a stack data structure, the last-in first out and the stack pointer index. The Language To be able to understand the examples below, i will introduce now the shift_sp command. shift_sp <integer> : moves the stack pointer so many places as described by the integer (it's a signed integer can be positive in that case we are growing the stack, or negative shrinking the stack) The commands of a stack machine affect the top of the stack. They take their values from the stack and they return a value on the stack. If the command needs one value then it removes this value from the stack and returns the result in its place. The top of the stack has remained the same since one value was removed and one value was added. If it needs 2 values then it takes 2 values from the stack and returns the result in its place. The value of the stack pointer is minus one what it was because the command took 2 values and returned one. Every command on the stack affects the stack and the stack pointer. The only exception is the call_func command. The call_func command doesn't affect the stack pointer. It only reads the arguments that needs and returns a value. Specifically it returns a value on the stack position that exists before all its arguments. That is the reason that we see in ai.obj before any func_call code like this: Quote:
the shift_sp -2 after the func_call is to go back 2 stack positions - remember the func call doesn't remove elements from the stack there are still there finally the shift_sp -1 is used to go to the place we reserved with the shift_sp 1 command at the beggining Quote:
push_const <int> : push the value on the stack, increase the stack pointer by one. fetch_i : pop a value from the stack, assume that is an index on the stack data structure (see it like an address), push the value (an integer) that is contained in this address on the stack. Mnemonic Fetch Integer. The stack pointer remains the same since we got one value and returned one value. fetch_d : like fetch_i but it brings back a double. Mnemonic Fetch Double push_reg_sp : it pushes the stack pointer on the stack. Since we didn't use any element from the stack and we returned one the stack pointer increased by one. Why you should do this? For one thing by giving the following code: push_reg_sp fetch_i you make a copy of the value that is on top of the stack. Quite simple and you can see it in many places in ai.obj other commands like mul (multiplication), div(division) etc are self-explanatory. Some (very fast) notes on events: Events are nothing more than structures that contain specific information, in specific places. For example: Quote:
Reserved Words - Statements Code:
(52 reserved words so far) add assign and bit_and bit_or branch_false branch_true buyselllist_begin buyselllist_end call_super class class_end div equal exit_handler fetch_d fetch_i float func_call greater greater_equal handler handler_end int jump less less_equal mod mul negate not not_equal or parameter_define_begin parameter_define_end property_define_begin property_define_end push_parameter push_event push_property push_string push_reg_sp push_const shift_sp string sub telposlist_begin telposlist_end variable_begin variable_end waypointstype waypointdelaystype Handler Reference Code:
(37 handlers so far) 0 NO_DESIRE 1 ATTACKED 2 SPELLED 3 TALKED 4 TALK_SELECTED 5 SEE_CREATURE 10 MY_DYING 11 TIMER_FIRED 12 TIMER_FIRED_EX 13 CREATED 16 SEE_SPELL 17 OUT_OF_TERRITORY 18 DESIRE_MANIPULATION 19 PARTY_ATTACKED 21 PARTY_DIED 23 CLAN_ATTACKED 25 STATIC_OBJECT_CLAN_ATTACKED 28 TELEPORT_REQUESTED 31 QUEST_ACCEPTED 32 MENU_SELECTED 33 LEARN_SKILL_REQUESTED 34 ONE_SKILL_SELECTED 36 CLASS_CHANGE_REQUESTED 42 CREATE_PLEDGE 43 DISMISS_PLEDGE 44 REVIVE_PLEDGE 45 LEVEL_UP_PLEDGE 48 CREATE_ALLIANCE 49 SCRIPT_EVENT 50 TUTORIAL_EVENT 51 QUESTION_MARK_CLICKED 52 USER_CONNECTED 61 MOVE_TO_WAY_POINT_FINISHED 62 USE_SKILL_FINISHED 63 MOVE_TO_FINISHED 75 DOOR_HP_LEVEL_INFORMED 76 CONTROLTOWER_LEVEL_INFORMED Code:
To be populated... Code:
Here is a list of all the function calls for reference, the arguments for each function is given in descriptive form, rv stands for the return value of the function (the argument list isn't yet complete or standardised). Remember that the rv (return value) is the lowest element on the stack.
(130 functions so far)
func_call 0 // func[AddMoveAroundDesire] (rv,int,int)
func_call 1 // func[AddDoNothingDesire] (rv,int,int)
func_call 2 // func[AddAttackDesire] (rv,attacker,int,int)
func_call 3 // func[AddAttackDesireEx]
func_call 6 // func[AddFleeDesire]
func_call 7 // func[AddFollowDesire]
func_call 9 // func[AddMoveToWayPointDesire] (rv, WayPoints, WayPointDelays, int, int)
func_call 10 // func[AddUseSkillDesire] (rv,event[myself][sm],1056001,1,1,4000000)
func_call 11 // func[AddUseSkillDesireEx]
func_call 12 // func[AddMoveToDesire] (rv,x,y,z,100000)
func_call 13 // func[AddEffectActionDesire]
func_call 14 // func[AddPetDefaultDesire_Follow]
func_call 15 // func[RemoveAllAttackDesire] (rv)
func_call 18 // func[MakeAttackEvent]
func_call 20 // func[GetLifeTime]
func_call 21 // func[GetTick] (rv)
func_call 23 // func[GetCurrentTick] (rv)
func_call 24 // func[GetDirection] (rv, event[c2])
func_call 25 // func[SetCookie]
func_call 26 // func[GetCookie]
func_call 27 // func[SetTeleportPosOnLost]
func_call 28 // func[AddTimerEx] (rv,1002,60000)
func_call 29 // func[GetIndexFromCreature] (rv, event[myself][sm])
func_call 30 // func[GetCreatureFromIndex]
func_call 31 // func[RegisterGlobalMap] (rv, rv from GetIndexFromCreature, push_parameter GM_ID)
func_call 32 // func[UnregisterGlobalMap]
func_call 33 // func[GetGlobalMap]
func_call 34 // func[SendScriptEvent]
func_call 36 // func[IsSpoiled]
func_call 37 // func[Say]
func_call 42 // func[Shout]
func_call 43 // func[ShowPage] (rv,event[talker],string(html_filename))
func_call 45 // func[Teleport]
func_call 46 // func[InstantTeleport] (rv, event[myself][sm],int(x),int(y),int(z))
func_call 47 // func[Sell]
func_call 48 // func[Buy]
func_call 51 // func[DistFromMe] (rv, event[myself][c_ai2])
func_call 52 // func[SetTimerPeriodByTick] (rv,int(0))
func_call 53 // func[SetTimerPeriod]
func_call 54 // func[GetWayPointDelay] (rv,WayPointDelays, event[way_point_index])
func_call 55 // func[Rand] (rv, int(max))
func_call 57 // func[FloatToInt] (rv)
func_call 58 // func[GetMemoCount]
func_call 59 // func[HaveMemo] (rv, event[talker], int(quest_id?))
func_call 60 // func[SetMemo]
func_call 61 // func[SetMemoState] (rv, event[talker], 212, 10)
func_call 62 // func[GetMemoState] (rv, event[talker], 212)
func_call 63 // func[RemoveMemo]
func_call 64 // func[SetJournal]
func_call 65 // func[GetOneTimeQuestFlag] (rv, event[talker], 255)
func_call 66 // func[SetOneTimeQuestFlag]
func_call 67 // func[GetAbnormalLevel] ** not full **
func_call 68 // func[SetDBValue] (rv, event[myself][sm],0)
func_call 74 // func[Pledge_GetLeader]
func_call 76 // func[GetPledge]
func_call 77 // func[GiveItem1] (rv, event[talker],int(item_code),int(quantity))
func_call 80 // func[DeleteItem1] (rv,event[talker],int(item_code),int(quantity))
func_call 81 // func[OwnItemCount] (rv, event[talker],int(item_code))
func_call 83 // func[GetLastAttacker] (rv)???????
func_call 84 // func[FHTML_SetFileName]
func_call 85 // func[FHTML_SetInt]
func_call 86 // func[FHTML_SetFloat]
func_call 87 // func[FHTML_SetStr]
func_call 88 // func[ShowFHTML]
func_call 89 // func[MakeFString]
func_call 100 // func[IsMyLord]
func_call 103 // func[Castle_GetSiegeTime]
func_call 104 // func[Residence_GetTaxRate]
func_call 105 // func[Residence_GetTaxRateCurrent]
func_call 106 // func[Residence_SetTaxRate]
func_call 111 // func[Residence_VaultTakeOutMoney]
func_call 114 // func[Castle_GateOpenClose]
func_call 115 // func[Castle_GetPledgeState]
func_call 116 // func[Castle_IsUnderSiege]
func_call 117 // func[Castle_GetHPRegen]
func_call 118 // func[Castle_GetMPRegen]
func_call 119 // func[Castle_BanishOthers]
func_call 120 // func[Castle_SetHPRegen]
func_call 121 // func[Castle_SetMPRegen]
func_call 122 // func[Castle_GetRawSiegeTime]
func_call 123 // func[Castle_GetRawSystemTime]
func_call 125 // func[Castle_GateOpenClose2]
func_call 126 // func[Castle_GetPledgeId]
func_call 127 // func[Castle_GetLifeControlLevel]
func_call 128 // func[Agit_SetMaster]
func_call 129 // func[Agit_GetTeleportLevel]
func_call 130 // func[Agit_SetTeleportLevel]
func_call 131 // func[AddChoice] (rv, int(0),string)
func_call 132 // func[ShowChoicePage] (rv, event[talker], 1)
func_call 133 // func[ShowSkillList]
func_call 134 // func[ShowGrowSkillMessage]
func_call 143 // func[IsInCategory] (rv, int, event[talker][occupation])
func_call 144 // func[ClassChange] (rv, event[talker],lv2_class11(-1))
func_call 145 // func[Castle_GetCropRate]
func_call 146 // func[Castle_GetCropPrice]
func_call 148 // func[Residence_GetTaxIncome]
func_call 152 // func[Castle_PostCropPurchase]
func_call 154 // func[Skill_GetConsumeHP] (rv, 1044481)
func_call 155 // func[Skill_GetConsumeMP] (rv, 1044481)
func_call 156 // func[Skill_GetEffectPoint]
func_call 157 // func[Skill_GetAttribute]
func_call 158 // func[Skill_GetAbnormalType] *** not full ***(rv, 1056004(skill_id))
func_call 160 // func[Skill_InReuseDelay] (rv, 1044481)
func_call 165 // func[CreatePrivates]
func_call 166 // func[CreateOnePrivate] (rv, 1005180, string("imperial_slave"),0,1)
func_call 168 // func[Maker_GetNpcCount]
func_call 169 // func[Maker_FindNpcByKey]
func_call 170 // func[CreateOnePrivateEx] (rv, 1005121, "actea_of_verdant_wilds",int(event[myself][sm][x]),int(event[myself][sm][y]),int(event[myself][sm][z]),0,0,0) ???????
func_call 171 // func[IncrementParam] (rv, event[talker], int, int)
func_call 173 // func[SoundEffect] (rv,talker[event],string(sound_resource))
func_call 174 // func[EffectMusic] (rv, myself[sm],10000,string(music))
func_call 175 // func[Despawn]
func_call 177 // func[InMyTerritory]
func_call 178 // func[InstantTeleportInMyTerritory] (rv, pos_x1,pos_y1,pos_z1,200)
func_call 180 // func[EarthQuakeByNPC] (rv, myself[sm],20,10,1,0,0,0)
func_call 181 // func[SpecialCamera] (rv, event[myself][sm],700,13,-19,0,10000,20000)
func_call 184 // func[PledgeLevelUp] (rv, event[talker], int)
func_call 188 // func[ShowTutorialHTML] (rv, event[talker], string(htmlFname))
func_call 189 // func[ShowTutorialHTML2]
func_call 190 // func[ShowQuestionMark] (rv, event[talker], 1)
func_call 192 // func[CloseTutorialHTML]
func_call 193 // func[EnableTutorialEvent] (rv, event[talker], event[i0] bit_or 4194304)
func_call 194 // func[ShowRadar] (rv, event[talker],x,y,z)
func_call 195 // func[DeleteRadar]
func_call 196 // func[CreatePet]
func_call 200 // func[OpenSiegeInfo]
func_call 201 // func[SetDoorHpLevel]
func_call 202 // func[GetDoorHpLevel]
func_call 203 // func[SetControlTowerLevel]
func_call 204 // func[GetControlTowerLevel]
Code:
Just an example of the available resources for now... Music: "antaras" Sounds: "ItemSound.quest_fanfare_1" "ItemSound.quest_tutorial" "ItemSound.quest_middle" "ItemSound.quest_itemget" "Itemsound.quest_before_battle" |
|||
|
|
|
|
#2 |
|
Архивный участник
Join Date: Jun 2005
Posts: 73
|
i for one say. Really great job there^^
|
|
|
|
|
#3 |
|
Архивный участник
Join Date: Jul 2005
Posts: 242
|
great, thanks!
|
|
|
|
|
#4 |
|
Архивный участник
Join Date: Sep 2005
Posts: 53
|
Great job! Very usefull, ill give you some cash
|
|
|
|
|
#5 |
|
Архивный участник
Join Date: Aug 2005
Posts: 605
|
omg first post and such a good job.thanks
|
|
|
|
|
#6 |
|
Архивный участник
Join Date: May 2005
Posts: 2,033
|
woot!
was really helpful to me... i think i got the important part now. thx again. :thumbup: but as far as i could figure it out now you all need this stack pointer, i mean "shift_sp" thingy if you call a function, right? |
|
|
|
|
#7 |
|
Архивный участник
Join Date: May 2005
Posts: 2,033
|
next question why cant i use:
"shift_sp -3" instead of "shift_sp -2" "shift_sp -1" |
|
|
|
|
#8 | |
|
Архивный участник
Join Date: Oct 2005
Posts: 18
|
Quote:
|
|
|
|
|
|
#9 |
|
Архивный участник
Join Date: Feb 2005
Posts: 705
|
all that is what you learn if you program a microprocessador like 6600 in asm ^^ or an intel processor, then you will see the stack pointer ^^. I think is the best languaje for me :P.
|
|
|
|
|
#10 |
|
Архивный участник
Join Date: Sep 2005
Posts: 731
|
This Guide is realy helpfull . Tnx for sharing !!!
|
|
|
|
|
#11 |
|
Архивный участник
Join Date: Jun 2005
Posts: 50
|
Nice guide, thank you
|
|
|
|
|
#12 |
|
Архивный участник
Join Date: Oct 2005
Posts: 102
|
event:
28 myself 32 talker 36 attacker 40 victim 44 private ? 48 ? 52 56 speller ? 60 ? 64 68 creature ? 72 ? 76 ? 80 84 damage ? 88 ? 92 ? 96 100 ask 104 reply 108 skill_id ? 112 ? 116 120 skill_name_id 124 occupation_name_id 128 way_point_index 132 next_way_point_index ? 136 140 weapon_id ? 144 148 x 152 y 156 z ? 160 164 desire 168 event_id 172 question_id 176 timer_id ? 180 ? 184 ? 188 192 i0 196 i1 200 i2 204 i3 208 i4 212 i5 216 i6 272 с0 276 c1 280 c2 324 _code 328 _choice_N 332 _from_choice CSharedCreatureData* talker, myself, attacker, private, creature, sm, master, boss, top_desire_target: 8 x 16 y 24 z 108 is_pc (bool) 112 alive 148 race 152 occupation 160 name 248 sp 344 hp (float) 352 mp (float) 384 target_index 388 target_id 412 karma 644 quest_last_reward_time 664 pledge_id 672 is_pledge_master (bool) 888 level 1000 max_hp 1144 equiped_weapon_class_id 1148 attack_type 1332 last_blow_weapon_class_id 1336 ai 1620 npc_class_id 1624 weight_point 1628 respawn_time 1716 flag 1892 db_value 2308 p_state ? m_state 2316 i_quest0 2320 i_quest1 2324 i_quest2 2336 i_ai0 2340 i_ai1 2344 i_ai2 2360 c_quest0 2364 c_quest1 2368 c_quest2 2380 c_ai0 2384 c_ai1 2388 c_ai2 2400 sm ??? what is it ??? 2404 master 2408 boss 2412 top_desire_target 2428 start_x (defined in npcpos.txt) 2432 start_y (defined in npcpos.txt) 2436 start_z (defined in npcpos.txt) 2500 sit_on_stop plz, add missing parameters |
|
|
|
|
#13 |
|
Архивный участник
Join Date: May 2005
Posts: 2,033
|
2316 i_quest0
2320 i_quest1 2324 i_quest2 2336 i_ai0 2340 i_ai1 2344 i_ai2 what do those do? they must have a sense... i found some i_ai codes in ai.obj but couldnt guess their meaning... |
|
|
|
|
#14 |
|
Архивный участник
Join Date: Feb 2005
Posts: 357
|
u can use it to save data. but it's not permanent cos once server is restarted info is deleted.
and btw u can use from 0 to 4 and i think c_ai0... is for strs while this one are for int. |
|
|
|
|
#15 |
|
Архивный участник
Join Date: Feb 2005
Posts: 357
|
i extracted this info fom sina ai.obj
Code:
fetch_i // karma push_const 412 fetch_i // start_x push_const 2428 fetch_i // start_y push_const 2432 fetch_i // start_z push_const 2436 fetch_i // i_ai1 push_const 2340 fetch_i // sp push_const 248 fetch_i // level push_const 888 fetch_i // is_pledge_master push_const 672 fetch_i // pledge_id push_const 664 fetch_i // race push_const 148 fetch_i // occupation push_const 152 fetch_i // sm push_const 2400 fetch_i // i_ai0 push_const 2336 fetch_i // p_state push_const 2308 fetch_i // is_pc push_const 108 fetch_i // npc_class_id push_const 1620 fetch_i // max_hp push_const 1000 fetch_i // i_ai2 push_const 2344 fetch_i // c_ai1 push_const 2384 fetch_i // hp push_const 344 fetch_i // c_ai0 push_const 2380 fetch_i // top_desire_target push_const 2412 fetch_i // mp push_const 352 fetch_i // weight_point push_const 1624 fetch_i // ai push_const 1336 fetch_i // respawn_time push_const 1628 fetch_i // attack_type push_const 1148 fetch_i // boss push_const 2408 fetch_i // alive push_const 112 fetch_i // master push_const 2404 fetch_i // target_index push_const 384 fetch_i // target_id push_const 388 fetch_i // sit_on_stop push_const 2500 fetch_i // flag push_const 1716 fetch_i // name push_const 160 fetch_i // x push_const 8 fetch_i // y push_const 16 fetch_i // z push_const 24 fetch_i // i_ai3 push_const 2348 fetch_i // i_ai4 push_const 2352 fetch_i // db_value push_const 1892 fetch_i // c_ai2 push_const 2388 fetch_i // c_ai3 push_const 2392 fetch_i // c_ai4 push_const 2396 fetch_i // attack_tick push_const 2356 fetch_i // quest_last_reward_time push_const 644 fetch_i // c_quest0 push_const 2360 fetch_i // i_quest0 push_const 2316 fetch_i // c_quest2 push_const 2368 fetch_i // i_quest2 push_const 2324 fetch_i // i_quest3 push_const 2328 fetch_i // i_quest4 push_const 2332 fetch_i // equiped_weapon_class_id push_const 1144 fetch_i // param1 push_const 1908 fetch_i // c_quest1 push_const 2364 fetch_i // i_quest1 push_const 2320 fetch_i // last_blow_weapon_class_id push_const 1332 fetch_i // param2 push_const 1912 fetch_i // param3 push_const 1916 fetch_i // skill_level push_const 232 ------------------------------------------------------ func_call 43 // func[ShowPage] func_call 2 // func[AddAttackDesire] func_call 12 // func[AddMoveToDesire] func_call 1 // func[AddDoNothingDesire] func_call 0 // func[AddMoveAroundDesire] func_call 9 // func[AddMoveToWayPointDesire] func_call 54 // func[GetWayPointDelay] func_call 28 // func[AddTimerEx] func_call 81 // func[OwnItemCount] func_call 80 // func[DeleteItem1] func_call 171 // func[IncrementParam] func_call 184 // func[PledgeLevelUp] func_call 143 // func[IsInCategory] func_call 144 // func[ClassChange] func_call 173 // func[SoundEffect] func_call 133 // func[ShowSkillList] func_call 134 // func[ShowGrowSkillMessage] func_call 47 // func[Sell] func_call 48 // func[Buy] func_call 100 // func[IsMyLord] func_call 84 // func[FHTML_SetFileName] func_call 146 // func[Castle_GetCropPrice] func_call 85 // func[FHTML_SetInt] func_call 88 // func[ShowFHTML] func_call 152 // func[Castle_PostCropPurchase] func_call 77 // func[GiveItem1] func_call 45 // func[Teleport] func_call 115 // func[Castle_GetPledgeState] func_call 126 // func[Castle_GetPledgeId] func_call 55 // func[Rand] func_call 46 // func[InstantTeleport] func_call 116 // func[Castle_IsUnderSiege] func_call 127 // func[Castle_GetLifeControlLevel] func_call 52 // func[SetTimerPeriodByTick] func_call 178 // func[InstantTeleportInMyTerritory] func_call 105 // func[Castle_GetTaxRateCurrent] func_call 104 // func[Castle_GetTaxRate] func_call 200 // func[OpenSiegeInfo] func_call 148 // func[Castle_GetTaxIncome] func_call 145 // func[Castle_GetCropRate] func_call 86 // func[FHTML_SetFloat] func_call 106 // func[Castle_SetTaxRate] func_call 125 // func[Castle_GateOpenClose2] func_call 114 // func[Castle_GateOpenClose] func_call 25 // func[SetCookie] func_call 26 // func[GetCookie] func_call 202 // func[GetDoorHpLevel] func_call 204 // func[GetControlTowerLevel] func_call 119 // func[Castle_BanishOthers] func_call 111 // func[Residence_VaultTakeOutMoney] func_call 201 // func[SetDoorHpLevel] func_call 203 // func[SetControlTowerLevel] func_call 117 // func[Castle_GetHPRegen] func_call 89 // func[MakeFString] func_call 87 // func[FHTML_SetStr] func_call 118 // func[Castle_GetMPRegen] func_call 120 // func[Castle_SetHPRegen] func_call 121 // func[Castle_SetMPRegen] func_call 103 // func[Castle_GetSiegeTime] func_call 128 // func[Agit_SetMaster] func_call 129 // func[Agit_GetTeleportLevel] func_call 130 // func[Agit_SetTeleportLevel] func_call 42 // func[Shout] func_call 13 // func[AddEffectActionDesire] func_call 20 // func[GetLifeTime] func_call 156 // func[Skill_GetEffectPoint] func_call 18 // func[MakeAttackEvent] func_call 51 // func[DistFromMe] func_call 6 // func[AddFleeDesire] func_call 37 // func[Say] func_call 177 // func[InMyTerritory] func_call 155 // func[Skill_GetConsumeMP] func_call 154 // func[Skill_GetConsumeHP] func_call 160 // func[Skill_InReuseDelay] func_call 10 // func[AddUseSkillDesire] func_call 165 // func[CreatePrivates] func_call 166 // func[CreateOnePrivate] func_call 158 // func[Skill_GetAbnormalType] func_call 67 // func[GetAbnormalLevel] func_call 56 // func[IntToStr] func_call 57 // func[FloatToInt] func_call 83 // func[GetLastAttacker] func_call 7 // func[AddFollowDesire] func_call 14 // func[AddPetDefaultDesire_Follow] func_call 30 // func[GetCreatureFromIndex] func_call 11 // func[AddUseSkillDesireEx] func_call 175 // func[Despawn] func_call 3 // func[AddAttackDesireEx] func_call 157 // func[Skill_GetAttribute] func_call 15 // func[RemoveAllAttackDesire] func_call 27 // func[SetTeleportPosOnLost] func_call 68 // func[SetDBValue] func_call 180 // func[EarthQuakeByNPC] func_call 21 // func[GetTick] func_call 33 // func[GetGlobalMap] func_call 29 // func[GetIndexFromCreature] func_call 31 // func[RegisterGlobalMap] func_call 174 // func[EffectMusic] func_call 181 // func[SpecialCamera] func_call 24 // func[GetDirection] func_call 32 // func[UnregisterGlobalMap] func_call 34 // func[SendScriptEvent] func_call 123 // func[Castle_GetRawSystemTime] func_call 122 // func[Castle_GetRawSiegeTime] func_call 62 // func[GetMemoState] func_call 192 // func[CloseTutorialHTML] func_call 190 // func[ShowQuestionMark] func_call 188 // func[ShowTutorialHTML] func_call 193 // func[EnableTutorialEvent] func_call 189 // func[ShowTutorialHTML2] func_call 194 // func[ShowRadar] func_call 61 // func[SetMemoState] func_call 65 // func[GetOneTimeQuestFlag] func_call 59 // func[HaveMemo] func_call 23 // func[GetCurrentTick] func_call 170 // func[CreateOnePrivateEx] func_call 36 // func[IsSpoiled] func_call 74 // func[Pledge_GetLeader] func_call 168 // func[Maker_GetNpcCount] func_call 195 // func[DeleteRadar] func_call 169 // func[Maker_FindNpcByKey] func_call 131 // func[AddChoice] func_call 132 // func[ShowChoicePage] func_call 58 // func[GetMemoCount] func_call 63 // func[RemoveMemo] func_call 60 // func[SetMemo] func_call 66 // func[SetOneTimeQuestFlag] func_call 53 // func[SetTimerPeriod] func_call 64 // func[SetJournal] func_call 196 // func[CreatePet] func_call 76 // func[GetPledge] ----------------------------------------------------------------------------- handler 0 // NO_DESIRE handler 4 // TALK_SELECTED handler 3 // TALKED handler 1 // ATTACKED handler 5 // SEE_CREATURE handler 63 // MOVE_TO_FINISHED handler 13 // CREATED handler 61 // MOVE_TO_WAY_POINT_FINISHED handler 12 // TIMER_FIRED_EX handler 42 // CREATE_PLEDGE handler 48 // CREATE_ALLIANCE handler 43 // DISMISS_PLEDGE handler 44 // REVIVE_PLEDGE handler 45 // LEVEL_UP_PLEDGE handler 32 // MENU_SELECTED handler 36 // CLASS_CHANGE_REQUESTED handler 33 // LEARN_SKILL_REQUESTED handler 34 // ONE_SKILL_SELECTED handler 28 // TELEPORT_REQUESTED handler 75 // DOOR_HP_LEVEL_INFORMED handler 76 // CONTROLTOWER_LEVEL_INFORMED handler 23 // CLAN_ATTACKED handler 16 // SEE_SPELL handler 18 // DESIRE_MANIPULATION handler 10 // MY_DYING handler 19 // PARTY_ATTACKED handler 21 // PARTY_DIED handler 17 // OUT_OF_TERRITORY handler 49 // SCRIPT_EVENT handler 62 // USE_SKILL_FINISHED handler 25 // STATIC_OBJECT_CLAN_ATTACKED handler 2 // SPELLED handler 50 // TUTORIAL_EVENT handler 51 // QUESTION_MARK_CLICKED handler 52 // USER_CONNECTED handler 31 // QUEST_ACCEPTED handler 11 // TIMER_FIRED ----------------------------------------------------------------------- push_event // talker push_const 32 push_event // attacker push_const 36 push_event // creature push_const 68 push_event // myself push_const 28 push_event // x push_const 148 push_event // y push_const 152 push_event // z push_const 156 push_event // next_way_point_index push_const 132 push_event // way_point_index push_const 128 push_event // timer_id push_const 176 push_event // reply push_const 104 push_event // ask push_const 100 push_event // occupation_name_id push_const 124 push_event // skill_name_id push_const 120 push_event // fhtml0 push_const 316 push_event // i0 push_const 192 push_event // i1 push_const 196 push_event // i2 push_const 200 push_event // level push_const 188 push_event // damage push_const 84 push_event // speller push_const 56 push_event // desire push_const 164 push_event // i6 push_const 216 push_event // i5 push_const 212 push_event // private push_const 44 push_event // i7 push_const 220 push_event // victim push_const 40 push_event // c0 push_const 272 push_event // c2 push_const 280 push_event // i3 push_const 204 push_event // event_id push_const 168 push_event // question_id push_const 172 push_event // i4 push_const 208 push_event // c1 push_const 276 push_event // weapon_class_id push_const 140 push_event // _from_choice push_const 332 push_event // _choiceN push_const 328 push_event // _code push_const 324 push_event // quest_id push_const 96 push_event // fhtml1 push_const 320 push_event // i9 push_const 228 push_event // i8 push_const 224 push_event // pledge0 push_const 292 |
|
|
|
|
#16 |
|
Архивный участник
Join Date: Oct 2005
Posts: 18
|
I have added the references section to the original post but only the function calls reference is populated (the resources reference has just some examples and the others will be updated soon).
In the next update I will go through the tutorial describing the event_handlers, the event data structure and the object oriented aspect of the stack machine. |
|
|
|
|
#17 |
|
Архивный участник
Join Date: Oct 2005
Posts: 102
|
I suggest two way to set VALUES into DB. Per-PC and per-NPC.
Per PC: There is "Quest" table in "lin2world" database. In this table is writed down quest data per each PC. Every PC have 16 sets of variables q,s,j. q - quest number s - state j - journal SetMemo(CSharedCreatureData *PC,int q) - add new set to "quest" table RemoveMemo(CSharedCreatureData* PC,int q) - clear the set of variables SetMemoState(CSharedCreatureData* PC,int q,int s) - set s for q SetJournal(CSharedCreatureData* PC,int q,int j) - set j for q First set of vars (q=255,s,j) is used by server (i dont know for which purposes). You may use other 15 sets for per-PC data storing (don`t forget about quests )Per NPC (more difficult :There is "npc_boss" table in "lin2world" database. In this table is writed down information about npcs: alive - =0 or =1 hp,mp,pos_x,pos_y,pos_z - HP,MP,POS current values time_low,time_high - ? (death_time and other) i0 - extra variable Look at npcpos.txt. NPC description may include "dbname=[<NPC_db_name>] dbsaving={parameters}" parameters. This parameters is allowed only for npcpos.txt. When server start, it read npcpos.txt and create NPCs. If "dbsaving" parameter is exist, server load alive,hp,mp,pos_x,pos_y,pos_z,time_low,time_high,i 0 values from "npc_boss" table (select * from npc_boss where npc_db_name=@NPC_db_name). What is the i0 variable? This is the db_value variable in CSharedCreatureData structure (offset 1892). How to use: 1) void CNPC::SetDBValue(CSharedCreatureData* c,int Value) - set i0 and myself.sm.db_value value 2) myself.sm.db_value - read this value. If you need to save not per-PC or per-NPC, you may create new NPCs (as many as u need) and use i0 & SetDBValue() method. How get CSharedCreatureData* pointer of any NPC from any NPC in ai-script? I will share later this info . -- sorry 4my english. Learn russian lang! |
|
|
|
|
#18 |
|
Архивный участник
Join Date: Sep 2005
Posts: 21
|
wow nice one, i want more !!
|
|
|
|
|
#19 |
|
Архивный участник
Join Date: Oct 2005
Posts: 18
|
Minor Update
In the references:
|
|
|
|
|
#20 |
|
Архивный участник
Join Date: Nov 2004
Posts: 1,405
|
very very nice guide!
here's some cash! ![]() keep up the good work!
|
|
|
|
|
#21 |
|
Архивный участник
Join Date: Jul 2005
Posts: 242
|
Sorry, im trying to understand.. first question: it is like asm tutorial, right?
second: Code:
handler 32 // MENU_SELECTED
variable_begin
"talker"
"ask"
"reply"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 8324
push_const 1
func_call 77 // func[GiveItem1]
shift_sp -3
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S20001. "nonexistent_menu_selected_ask_reply.htm"
push_string S20001
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
handler_end
|
|
|
|
|
#22 |
|
Архивный участник
Join Date: May 2005
Posts: 2,033
|
first it will give the character one item with the id 8324 and then it will show him the page "nonexistent_menu_selected_ask_reply.htm"
|
|
|
|
|
#23 |
|
Архивный участник
Join Date: Jul 2005
Posts: 242
|
Thanks.. this is the patch for default npc menu selected.. so why should it give item 8324? And is this ID a known item? I dont have it
|
|
|
|
|
#24 | |
|
Архивный участник
Join Date: May 2005
Posts: 2,033
|
Quote:
|
|
|
|
|
|
#25 |
|
Архивный участник
Join Date: Oct 2005
Posts: 18
|
The above code does exactly what toolpunk described. It seems to be an html exploit trap where the player is given a custom item to mark him.
If handler 32 isn't overriden* in a class that inherits the default npc class then this handler code will be executed. *you override a class handler by defining the handler in the inherited class. Handler 32 is executed every time that an ask-reply combo is given to an npc. |
|
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|