MarkAsDone() - what does it do? How can it be implemented?
#1
Posté 19 avril 2012 - 12:15
MarkAsDone()
It does not seem to be in any include scripts and isn't in the script assist as a system function, but when I use it, the script seems to compile. It is used in common scripts, such as the ones in a speak trigger, so I think it must be a valid function. Does anyone use it? Based on the name and usage I suspect it may mark a script or function so that it only runs one time.
It's not in the lexicon, not in the new NWN script search, not in the bioware boards as far as I can tell. Any help is appreciated.
#2
Posté 19 avril 2012 - 12:23
#3
Posté 19 avril 2012 - 12:27
Make sure a script only runs once
There's a pair of functions in ginc_vars that we used for this purpose in the OC.
int IsMarkedAsDone(object oObject=OBJECT_SELF, int iFlag=0);
void MarkAsDone(object oObject=OBJECT_SELF, int iFlag=0);
It also appears in a SoZ script, with the same DoOnce functionality
http://kaedrin-nwn2....eport_party.NSS
also on this page.
http://nwvault.ign.c...s.Detail&id=156
Modifié par kamal_, 19 avril 2012 - 12:28 .
#4
Posté 19 avril 2012 - 12:38
#5
Posté 19 avril 2012 - 02:03
There's a nifty little function in one of the spell gincs that generates a random delay float between two specified numbers (min and max) that is very useful in AOE spell scripts, so that effects don't all try to happen at once on multiple targets. I'll be damned if I can remember what it is though.
Someone should start a thread that lists all the non-documented (and often useful) script functions...
Modifié par DannJ, 19 avril 2012 - 02:04 .
#6
Posté 19 avril 2012 - 02:58
The best way to see all those hidden Functions.
The functions show up in BLACK - right-click and viola! definition file!
Modifié par Morbane, 19 avril 2012 - 03:00 .
#7
Posté 19 avril 2012 - 03:05
M. Rieder wrote...
I've been looking through some code and found the function
MarkAsDone()
It does not seem to be in any include scripts and isn't in the script assist as a system function, but when I use it, the script seems to compile. It is used in common scripts, such as the ones in a speak trigger, so I think it must be a valid function. Does anyone use it? Based on the name and usage I suspect it may mark a script or function so that it only runs one time.
It's not in the lexicon, not in the new NWN script search, not in the bioware boards as far as I can tell. Any help is appreciated.
I made my own DoOnce() Function that has a TRUE/FALSE parameter - very handy to mark as "undone"
#8
Posté 19 avril 2012 - 03:08
{
SetLocalInt(oObject, sFunction, nFlag);
//SendMessageToPC(GetFirstPC(FALSE), sFunction + " Set as Done");
}
int GetIsDone(object oObject, string sFunction)
{
if(GetLocalInt(oObject, sFunction) != TRUE)
{
//SendMessageToPC(GetFirstPC(FALSE), sFunction + " Not Done");
return FALSE;
}
//SendMessageToPC(GetFirstPC(FALSE), sFunction + " Is Done");
return TRUE;
}
#9
Posté 19 avril 2012 - 03:44
Morbane wrote...
EC's Super Include
The best way to see all those hidden Functions.
The functions show up in BLACK - right-click and viola! definition file!
I don't think that will show up the *hidden* functions - just those defined in the gincs. There are a few core functions (not in gincs) that also refuse to show up.
Even if you have all the game's gincs referenced, some of them still still remain invisible in the script assist window (like SetWWPController or SetWalkCondition in ginc_wp). The functions that set the OnSpawn behaviour flags also insist on their anonymity.
#10
Posté 19 avril 2012 - 07:42
And you say the best way to get to them is to dissect the Campaigns?
This sounds like an opportunity to compile a comprehensive list that grows as they are discovered...
Sorry - you already said thatDannJ wrote...
Someone should start a thread that lists all the non-documented (and often useful) script functions...
Modifié par Morbane, 19 avril 2012 - 07:47 .
#11
Posté 19 avril 2012 - 03:41
----
// E.C.'s super include!
//03-12-07: added MotB ginc_'s
//23-01-08: made some corrections based on Baragg's list
//11-10-08: added ginc_symbol_spells from 1.13
//Added SoZ libraries. I forgot when.
//11.02.23: kevL's additions
//#include "0_inc_popups" // removed
#include "cmi_animcom" // Kaedrin includes
#include "cmi_ginc_chars"
#include "cmi_ginc_ol"
#include "cmi_ginc_palrng"
#include "cmi_ginc_polymorph"
#include "cmi_ginc_pwconstants"
#include "cmi_ginc_soz"
#include "cmi_ginc_spells"
#include "cmi_ginc_wpns"
#include "cmi_inc_sneakattack"
#include "cmi_includes"
#include "gdm_inc"
#include "ginc_2da"
#include "ginc_actions"
#include "ginc_ai"
#include "ginc_alignment"
#include "ginc_autosave"
#include "ginc_baddie_stream"
#include "ginc_bb_nasherset" // Kaldor include
#include "ginc_behavior"
#include "ginc_combat" // SoZ
#include "ginc_companion"
#include "ginc_companions" // OC Campaign
#include "ginc_crafting"
#include "ginc_cutscene"
#include "ginc_death"
#include "ginc_debug"
#include "ginc_effect"
#include "ginc_event_handlers"
#include "ginc_group"
#include "ginc_gui"
#include "ginc_henchman"
#include "ginc_ipspeaker"
#include "ginc_item"
#include "ginc_item_script"
#include "ginc_journal"
#include "ginc_math"
#include "ginc_misc"
#include "ginc_nx1spells" // MotB
#include "ginc_object"
#include "ginc_overland" // SoZ
#include "ginc_overland_ai" // SoZ
#include "ginc_param_const"
#include "ginc_reflection" // MotB
#include "ginc_restsys" // MotB
#include "ginc_roster"
#include "ginc_sound"
#include "ginc_symbol_spells"
#include "ginc_time" // MotB
#include "ginc_transition"
#include "ginc_trigger"
#include "ginc_utility"
#include "ginc_var_ops"
#include "ginc_vars"
#include "ginc_worldmap"
#include "ginc_worldmap_constants"
#include "ginc_wp"
#include "gui_bhvr_inc"
#include "hench_i0_assoc" // TonyK includes
#include "hench_i0_act"
#include "hench_i0_ai"
#include "hench_i0_assoc"
#include "hench_i0_attack"
#include "hench_i0_buff"
#include "hench_i0_dispel"
#include "hench_i0_equip"
#include "hench_i0_generic"
#include "hench_i0_heal"
#include "hench_i0_hensho"
#include "hench_i0_initialize"
#include "hench_i0_itemsp"
#include "hench_i0_melee"
#include "hench_i0_monsho"
#include "hench_i0_options"
#include "hench_i0_spells"
#include "hench_i0_strings"
#include "hench_i0_target"
#include "inc_mf_combat"
#include "inc_xp2_familiar"
#include "kinc_cohort"
#include "kinc_companion"
#include "kinc_spirit_eater" // MotB
#include "kinc_trade"
#include "kinc_trade_constants"
#include "kinc_trade_crafting"
#include "kinc_trade_system"
#include "nw_i0_assoc"
#include "nw_i0_generic"
#include "nw_i0_henchman"
#include "nw_i0_invocatns"
#include "nw_i0_plot"
#include "nw_i0_plotwizard"
#include "nw_i0_spells"
#include "nw_i0_tool"
#include "nw_o2_coninclude"
//#include "nwn2_inc_hlhm" // no longer exists?
#include "nwn2_inc_metmag"
#include "nwn2_inc_spells"
#include "nwn2_inc_talent"
#include "nx1_inc_epicsave" // kL added
#include "oei_i0_spells" // kL added
#include "Script3" // kL added
#include "x0_i0_anims"
#include "x0_i0_assoc"
#include "x0_i0_behavior"
#include "x0_i0_caltrops"
#include "x0_i0_campaign"
#include "x0_i0_combat"
#include "x0_i0_common"
#include "x0_i0_corpses"
#include "x0_i0_db"
#include "x0_i0_debug"
#include "x0_i0_deckmany"
#include "x0_i0_destroy"
#include "x0_i0_enemy"
#include "x0_i0_equip"
#include "x0_i0_henchman"
#include "x0_i0_highlight"
#include "x0_i0_infdesert"
#include "x0_i0_infinite"
#include "x0_i0_match"
#include "x0_i0_modes"
#include "x0_i0_npckilled"
#include "x0_i0_partywide"
#include "x0_i0_petrify"
#include "x0_i0_plotgiver"
#include "x0_i0_position"
#include "x0_i0_projtrap"
#include "x0_i0_secret"
#include "x0_i0_seennode"
#include "x0_i0_spawncond"
#include "x0_i0_spells"
#include "x0_i0_stringlib"
#include "x0_i0_talent"
#include "x0_i0_transform"
#include "x0_i0_transport"
#include "x0_i0_treasure"
#include "x0_i0_voice"
#include "x0_i0_walkway"
#include "x0_inc_generic"
#include "x0_inc_henai"
#include "x0_inc_portal"
#include "x0_inc_skills"
#include "x0_inc_states"
#include "x1_inc_cutscene"
#include "x2_am_inc"
#include "x2_inc_banter"
#include "x2_inc_beholder"
#include "x2_inc_compon"
#include "x2_inc_craft"
#include "x2_inc_cutscene"
#include "x2_inc_globals"
#include "x2_inc_intweapon"
#include "x2_inc_itemprop"
#include "x2_inc_plot"
#include "x2_inc_restsys"
#include "x2_inc_shifter"
#include "x2_inc_spellhook"
#include "x2_inc_summscale"
#include "x2_inc_switches"
#include "x2_inc_toollib"
#include "x2_inc_treasure"
#include "x2_inc_ws_smith"
//void main(){}
#12
Posté 19 avril 2012 - 05:31
int _Done(object oObject = OBJECT_SELF)
{
if (GetLocalInt(oObject, "_myDone"))
{
return TRUE;
}
SetLocalInt(oObject, "_myDone", TRUE);
return FALSE;
}This way one function functions as both set and check .... does anyone see a problem there? ( i don't.. )
+ expand to include Morbane's TRUE/FALSE switch! or vice versa
Modifié par kevL, 19 avril 2012 - 05:33 .
#13
Posté 19 avril 2012 - 07:52
1: It wouldn't be obvious to someone reading my code.
2: It wouldn't be obvious to myself after a few mugs of dwarven grog
Separate functions may not be as slick, but their logic is more easily understood by others looking at your code.
#14
Posté 19 avril 2012 - 09:00
#15
Posté 19 avril 2012 - 10:16
i just got so tired of writing GetLocal/SetLocal so many times ..... idk, but somehow reading this thread popped that trick into my head. It's used extensively in the AI scripting, assumedly when the AI tries to check "can NPC do this?" if so then <blah> if not then <blah blah blah ;> IE, it runs code while checking to see what other code it should run ( *shrug, i get confused reading other people's code, so why not )
Rj, do you mean like Morbane's string argument? when I get back into scripting (X-com ...) i'd like to consolidate these 3 ideas:
1. single function
2. string value ( w/ default )
3. on / off switch
just an idea for now, and once a fella gets used to it, can help the flow.
#16
Posté 22 avril 2012 - 10:54
I followed the include chain, and finally found the base includes that actually define the functions (mainly the x0_i0_* scripts). When you use them directly, the functions show up in Script Assist. If you use x0_i0_walkway instead of ginc_wp, for instance, then all the walk waypoint functions actually show up.
MarkAsDone remains truely hidden though, since it doesn't seem to originate in an include.
#17
Posté 22 avril 2012 - 11:08
#18
Posté 23 avril 2012 - 09:32
#19
Posté 23 avril 2012 - 11:17
I remarked "x0_i0_walkway" ( SetWWPController( ) ) from the SuperInclude, and left "ginc_wp" ( #include "x0_i0_walkway" ) -- but ScriptAssist refuses to show SetWWPController( ) as a function.
- reversing the above schema indeed shows SetWWPController( ) as a function. (the order doesn't seem to matter tho)
By opening the SuperInclude in the toolset and commenting out those #includes respectively, a filtered function accordingly appears and disappears on the list (gotta be patient w/ that)
#20
Posté 23 avril 2012 - 12:36
Modifié par Morbane, 23 avril 2012 - 12:36 .





Retour en haut






