Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Sure, heres a couple of samples:

Sample 1

function AsciiCharToInteger takes string char returns integer local string charMap = " !\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFG +HIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" local string u = SubString(char, 0, 1) local string c local integer i = 0 loop set c = SubString(charMap, i, i + 1) exitwhen c == "" if c == u then return i + 32 endif set i = i + 1 endloop return 0 endfunction function IdStringToIdInteger takes string value returns integer return AsciiCharToInteger(SubString(value, 0, 1)) * 0x1000000 + Asci +iCharToInteger(SubString(value, 1, 2)) * 0x10000 + AsciiCharToInteger +(SubString(value, 2, 3)) * 0x100 + AsciiCharToInteger(SubString(value +, 3, 4)) endfunction function makeAdvancedUnit takes player who, string id, location where, + real angle, string life, string mana, string abil returns unit local integer unitid = S2I(id) local integer spellmnt = StringLength(abil)/4 local unit u = null local integer i = 0 if unitid == 0 then set unitid = IdStringToIdInteger(id) endif set u = CreateUnit(who, unitid, GetLocationX(where), GetLocationY(wher +e), angle) loop exitwhen i>=spellmnt call UnitAddAbility(u, IdStringToIdInteger(SubString(abil,i*4,(i+1)* +4)) ) set i = i + 1 endloop if StringCase(SubString(life,StringLength(life)-1,StringLength(life) ) +,false) == "p" then call SetUnitLifePercentBJ(u,S2R(SubString(life,0,String Length(life +)) )) else call SetUnitLifeBJ(u, S2R(life) ) endif if StringCase(SubString(mana,StringLength(mana)-1,StringLength(mana) ) +,false) == "p" then call SetUnitManaPercentBJ(u,S2R(SubString(mana,0,String Length(mana +)) )) else call SetUnitManaBJ(u, S2R(mana) ) endif return u endfunction

Sample 2

function Trig_respawn_Condition takes nothing returns boolean return true endfunction function Trig_respawn_Actions takes nothing returns nothing local location respawn_point local integer respawn_unit local unit u local integer i = 0 call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_013" ) loop exitwhen i > udg_max_units if ( GetTriggerUnit() == udg_all_monsters[i] ) then set respawn_unit = GetUnitTypeId(GetTriggerUnit()) set respawn_point = Location( udg_unit_pos_x[i], udg_unit_ +pos_y[i] ) call DisplayTextToForce( GetPlayersAll(), "Unit: " ) call DisplayTextToForce( GetPlayersAll(), I2S( i ) ) call TriggerSleepAction( 5.00 ) set u = CreateUnitAtLoc( GetOwningPlayer( GetTriggerUnit() + ), respawn_unit, respawn_point, bj_UNIT_FACING ) set udg_all_monsters[i] = u else endif set i = i + 1 endloop endfunction //==================================================================== +======= function InitTrig_respawn takes nothing returns nothing set gg_trg_respawn = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_respawn, EVENT_PLAYER_U +NIT_DEATH ) call TriggerAddCondition( gg_trg_respawn, Condition( function Trig +_respawn_Condition ) ) call TriggerAddAction( gg_trg_respawn, function Trig_respawn_Actio +ns ) endfunction

In reply to Re^2: Syntax highlighting EBNF grammar language by BUU
in thread Syntax highlighting EBNF grammar language by BUU

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-03-29 04:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found