[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs | Hosted Projects | Starcraft II Modding | Starcraft II Resources | Galaxy Wiki |
(Keeps Hive Alive)
Go Back   The Hive Workshop > Warcraft III Modding > Warcraft Editing Tools


Warcraft Editing Tools Discuss third party tools. Explore tool usage; get help using a tool, or search for a needed one.

Closed Thread
 
Thread Tools
Old 04-04-2012, 08:23 AM   #241 (permalink)
Registered User Nestharus
Left
 
Join Date: Jul 2007
Posts: 5,844
Nestharus has disabled reputation
Ahem, in constant timer loop 32, the code in the module may be calling code in the struct, and that code in the struct may be calling the code back in the module.


user timer code -> call destroy() (in struct)
struct code call stop (in module)

the destroyer has to be above the module so that the user's timer code can call it.
Nestharus is offline  
Old 04-04-2012, 08:52 AM   #242 (permalink)
Registered User Troll-Brain
cool != useful
 
Troll-Brain's Avatar
 
Join Date: Apr 2008
Posts: 2,234
Troll-Brain is a glorious beacon of light (469)Troll-Brain is a glorious beacon of light (469)Troll-Brain is a glorious beacon of light (469)
Then it's the design of the code which is flawed, because how jass work.
__________________
- There are bugs with wc3, but most of time, the bug is between the keyboard and the chair.
- Never believe some warcraft "fact" without a proof, even from an "experienced" user, that's how myths & legends born.
- I don't have wc3 installed anymore since a while, please consider it before answer me.
- less efficient != inefficient
- features, less verbosity, decent api, safety > ridiculous script "efficiency" "won" and map broken. That's all a matter of scale.
Troll-Brain is offline  
Old 04-04-2012, 08:53 AM   #243 (permalink)
Registered User Nestharus
Left
 
Join Date: Jul 2007
Posts: 5,844
Nestharus has disabled reputation
well, it relies on the inliner working properly ;\
Nestharus is offline  
Old 04-08-2012, 01:45 PM   #244 (permalink)
Registered User Tirlititi
User
 
Tirlititi's Avatar
 
Join Date: Jul 2010
Posts: 389
Tirlititi is a jewel in the rough (192)Tirlititi is a jewel in the rough (192)
I have a suggestion about the hooks. I think they should be more flexible.

There should be 2 more kinds of hooks, in my opinion :
- One that only calls the function instead of doing all this TriggerEvaluate thing. We definitely should have the choice, even if this solution causes problems in several situations, it would be usefull for the simpliest hooks that only use native functions and don't run much code. You may also give the option to use a TriggerExecute in the same way.
- One that totally replace the hooked function. Of course, the hook must not act inside the hooking function in that case. It would allow to call the function after the hooked one and get it's return value, for instance. It would also enable to make multiple calls (let's say if 2 objects are linked and that a function applying to one must apply to the other) or emulate the function with another.

An example of what could be done with those :

Code
Jass:
function CreateItemHook takes integer itemid, real x, real y returns item
    local item it = CreateItem(itemid, x, y)
    call SetItemInvulnerable(it, true)
    return it // I know it leaks but that's example.
endfunction

// call and replace are the hook options.
// The 2 last words are the usual arguments.
hook call replace CreateItem CreateItemHook

...

   local item it = CreateItem('I000', 0, 0)

And the output would be something like :
Jass:
globals
trigger array st___prototype2
item f__result_item
integer f__arg_integer1
real f__arg_real1
real f__arg_real2

endglobals

// In current jasshelper, those functions are always created even if the "execute" version is never used.
// You may adapt the creation of them to the hook option ("call", "evaluate" or "execute").
function sc___prototype2_execute takes integer i,integer a1,real a2,real a3 returns nothing
    set f__arg_integer1=a1
    set f__arg_real1=a2
    set f__arg_real2=a3

    call TriggerExecute(st___prototype2[i])
endfunction
function sc___prototype2_evaluate takes integer i,integer a1,real a2,real a3 returns item
    set f__arg_integer1=a1
    set f__arg_real1=a2
    set f__arg_real2=a3

    call TriggerEvaluate(st___prototype2[i])
 return f__result_item
endfunction

// Hook function moved to the header. In the worse case, it just pops an "undeclared function error".
function CreateItemHook takes integer itemid,real x,real y returns item
    //hook: CreateItemHook call replace
    local item it= CreateItem(itemid, x, y) // CreateItem not hooked here.
    call SetItemInvulnerable(it, true)
    return it
endfunction

...

    call CreateItemHook('I000', 0, 0)

...

// jasshelper__initstructs functions ...

And the same example with an "evaluate" option :
Jass:
function CreateItemHook takes integer itemid, real x, real y returns item
    local item it = CreateItem(itemid, x, y)
    call SetItemInvulnerable(it, true)
    return it
endfunction

// Same as "hook replace CreateItem CreateItemHook"
hook evaluate replace CreateItem CreateItemHook

...

   local item it = CreateItem('I000', 0, 0)

And the output would be something like :
Jass:
globals
trigger array st___prototype2
item f__result_item
integer f__arg_integer1
real f__arg_real1
real f__arg_real2

endglobals

function sc___prototype2_execute takes integer i,integer a1,real a2,real a3 returns nothing
    set f__arg_integer1=a1
    set f__arg_real1=a2
    set f__arg_real2=a3

    call TriggerExecute(st___prototype2[i])
endfunction
function sc___prototype2_evaluate takes integer i,integer a1,real a2,real a3 returns item
    set f__arg_integer1=a1
    set f__arg_real1=a2
    set f__arg_real2=a3

    call TriggerEvaluate(st___prototype2[i])
 return f__result_item
endfunction

function h__CreateItem takes integer a0, real a1, real a2 returns item
    //hook: CreateItemHook
return sc___prototype2_evaluate(1,a0,a1,a2) // As a side note : this doesn't leak anymore.
endfunction

...

// Function not moved to top.
function CreateItemHook takes integer itemid,real x,real y returns item
    local item it= CreateItem(itemid, x, y) // CreateItem not hooked here.
    call SetItemInvulnerable(it, true)
    return it
endfunction

//processed hook: hook evaluate replace CreateItem CreateItemHook

...

    call h__CreateItem('I000', 0, 0)

...

// jasshelper__initstructs functions called at map initialization :
function sa___prototype2_CreateItemHook takes nothing returns boolean
 local integer itemid=f__arg_integer1
 local real x=f__arg_real1
 local real y=f__arg_real2

    local item it= CreateItem(itemid, x, y) // CreateItem not hooked here either.
    call SetItemInvulnerable(it, true)
    set f__result_item= it
    return true
endfunction

function jasshelper__initstructs1712796703 takes nothing returns nothing
    set st___prototype2[1]=CreateTrigger()
    call TriggerAddAction(st___prototype2[1],function sa___prototype2_CreateItemHook)
    call TriggerAddCondition(st___prototype2[1],Condition(function sa___prototype2_CreateItemHook))

endfunction


I hope it's clear and not too hard to make.

Thanks and congrats to update this tool. That's really an usefull work .
Tirlititi is online now  
Old 04-08-2012, 06:28 PM   #245 (permalink)
Forum Moderator PurgeandFire
ʕ•͡ᴥ•ʔ
 
PurgeandFire's Avatar
Resource & Tutorial Moderator
 
Join Date: Nov 2006
Posts: 5,658
PurgeandFire has a reputation beyond repute (2036)PurgeandFire has a reputation beyond repute (2036)PurgeandFire has a reputation beyond repute (2036)PurgeandFire has a reputation beyond repute (2036)
Quote:
Originally Posted by Adiktuz View Post
Is it possible to change the color scheme on the editor? or do I have to live with it? ^_^
Do you mean the JASS text? That is a TESH thing, you can just click "Options" in your trigger editor to change it. (or whatever the button is) It should have some color scheme options iirc.

@Tirlititi: I also hope that update occurs, hooking would be pretty powerful then--and a lot more useful.
PurgeandFire is online now  
Old 04-10-2012, 08:20 PM   #247 (permalink)
Registered User Magtheridon96
~ Join The Daily Peon ~
 
Magtheridon96's Avatar
 
Join Date: Dec 2008
Posts: 6,298
Magtheridon96 has a reputation beyond repute (2195)Magtheridon96 has a reputation beyond repute (2195)Magtheridon96 has a reputation beyond repute (2195)Magtheridon96 has a reputation beyond repute (2195)Magtheridon96 has a reputation beyond repute (2195)Magtheridon96 has a reputation beyond repute (2195)
Former Staff Member: This user used to be on the Hive Workshop staff. Merit Badge - Level 1: Great Assistant: Offers the best solution to other users, when all hope fades. Under the shell of assistance, lies a powerful knowledge in the fields. 
edit
Nevermind >.>
__________________
Are you good at 2D animation? You wanna make $ good money $?
PM me.

Last edited by Magtheridon96; 04-11-2012 at 08:45 AM.
Magtheridon96 is offline  
Old 04-10-2012, 09:13 PM   #248 (permalink)
Registered User Tirlititi
User
 
Tirlititi's Avatar
 
Join Date: Jul 2010
Posts: 389
Tirlititi is a jewel in the rough (192)Tirlititi is a jewel in the rough (192)
I don't get it and I don't think you got it neither.
Tirlititi is online now  
Old 04-11-2012, 02:36 AM   #250 (permalink)
Registered User mckill2009
SSJ99999 Pinoy!
 
mckill2009's Avatar
 
Join Date: Mar 2009
Posts: 4,684
mckill2009 is a splendid one to behold (942)mckill2009 is a splendid one to behold (942)mckill2009 is a splendid one to behold (942)mckill2009 is a splendid one to behold (942)
Quote:
Originally Posted by Adiktuz View Post
I have a question, what are hooks? XD
Jass:
function hookme takes string s returns nothing
   call BJDebugMsg(s)
   call BJDebugMsg("hookme")
endfunction

hook BJDebugMsg hookme
__________________
Maps Systems AI Systems

I believe in miracles as I've seen them all come true
mckill2009 is offline  
Old 04-11-2012, 08:35 AM   #251 (permalink)
Forum Moderator Bribe
Keep it simple
 
Bribe's Avatar
Spells, Help Zones & JASS Moderator
 
Join Date: Sep 2009
Posts: 5,768
Bribe has a brilliant future (1283)Bribe has a brilliant future (1283)Bribe has a brilliant future (1283)Bribe has a brilliant future (1283)
PayPal Donor: This user has donated to The Hive. 
Quote:
Originally Posted by mckill2009 View Post
Jass:
function hookme takes string s returns nothing
   call BJDebugMsg(s)
   call BJDebugMsg("hookme")
endfunction

hook BJDebugMsg hookme
That's an infinite loop.
__________________
How to post your triggers on the Hive Workshop.
JPAG - Bettering the cause of readable source code.

Bribe is offline  
Old 04-11-2012, 08:46 AM   #252 (permalink)
Registered User Magtheridon96
~ Join The Daily Peon ~
 
Magtheridon96's Avatar
 
Join Date: Dec 2008
Posts: 6,298
Magtheridon96 has a reputation beyond repute (2195)Magtheridon96 has a reputation beyond repute (2195)Magtheridon96 has a reputation beyond repute (2195)Magtheridon96 has a reputation beyond repute (2195)Magtheridon96 has a reputation beyond repute (2195)Magtheridon96 has a reputation beyond repute (2195)
Former Staff Member: This user used to be on the Hive Workshop staff. Merit Badge - Level 1: Great Assistant: Offers the best solution to other users, when all hope fades. Under the shell of assistance, lies a powerful knowledge in the fields. 
Quote:
Originally Posted by Tirlititi View Post
I don't get it and I don't think you got it neither.
And that, my friends, is what happens when you read a post backwards and expect to get anything out of it. >.>
(No, I'm not talking about you, I'm talking about myself.)
__________________
Are you good at 2D animation? You wanna make $ good money $?
PM me.
Magtheridon96 is offline  
Old 04-16-2012, 08:14 AM   #253 (permalink)
Registered User cohadar
User
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 234
cohadar will become famous soon enough (95)cohadar will become famous soon enough (95)cohadar will become famous soon enough (95)
Quote:
Originally Posted by Adiktuz View Post
I have a question, what are hooks? XD
Hooks are one of those arcane jasshelper features used by 0.0001% of mapmakers.
They replace standard wc3 functions with your own wrapper function.
In this they are similar to blizzard's BJ functions, but are worse because it is not obvious in other triggers code that something has changed.

Imho when you need to replace a default wc3 function with your own you should do it manually.

You can easily find all instances of a certain function by searching through your input .j script.
It is located in:
jassnewgenpack5d\logs\input_war3map.j - my jasshelper mod
jassnewgenpack5d\logs\inputwar3map.j - original jasshelper
__________________
Cohadar spoke.
cohadar is offline  
Old 04-16-2012, 11:19 PM   #254 (permalink)
Forum Moderator PurgeandFire
ʕ•͡ᴥ•ʔ
 
PurgeandFire's Avatar
Resource & Tutorial Moderator
 
Join Date: Nov 2006
Posts: 5,658
PurgeandFire has a reputation beyond repute (2036)PurgeandFire has a reputation beyond repute (2036)PurgeandFire has a reputation beyond repute (2036)PurgeandFire has a reputation beyond repute (2036)
It isn't for personal mapping so much as it is for systems. Hooking is rarely used because it is slow and very limited--we tend to avoid it even if it is a viable option either because: (A) it is slow or (B) we can't do what we actually want to 100%.

There are certain systems such as IDDS (just giving an example) which could benefit off this, as it makes the implementation/use much easier; especially if you already have code in your map.

At the moment hooks are weak and don't have many uses, but with a hook rewrite option people may be a bit more creative with their systems. For example, one could hook-rewrite certain registered player events and make them so they apply only for players actively playing to reduce handle count. Of course, that sort of thing isn't necessary, but it can give people more creativity in system design and will make implementation of certain systems far easier. (especially for GUI users)
PurgeandFire is online now  
Old 05-14-2012, 10:44 PM   #255 (permalink)
Registered User Adiktuz
Engr. Shana, ChE
 
Adiktuz's Avatar
 
Join Date: Oct 2008
Posts: 10,034
Adiktuz has a brilliant future (1350)Adiktuz has a brilliant future (1350)Adiktuz has a brilliant future (1350)
I've read the new manual and well, I just want to ask what is the limit for the sized arrays and the struct instance with more space... XD
Adiktuz is offline  
Closed Thread

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 10:53 PM.




Powered by vBulletin
Copyright 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.1 PL2
Copyright © Ralle