Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Come and join our gamer community by
registering for free here
Other Gaming Forum
PC games
WarCraft III Modding
Return Bug
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Mad-Ness" data-source="post: 116808" data-attributes="member: 5867"><p>Ok, so im going to explain the return bug.</p><p>The return bug in JASS is were you can return a varible different to the varible type to what it says it will return.</p><p>Classis example:</p><p></p><p>function H2I takes handle h returns integer</p><p> return h</p><p> return 0</p><p>endfunction</p><p></p><p>Here, it actually returns 'h', which is not the a integer.</p><p>'h' Is a handle, a handle is a unit, player, unit group, timer, dialog, or anything else that is NOT a integer, string, real or boolean.</p><p>The parser that checks if the script is ok, only checks if the last return type is correct.</p><p>So you can return practiaclly anything.</p><p>example:</p><p></p><p>function Unit2Integer takes unit u return integer</p><p> return u</p><p> return 0</p><p>endfunction</p><p></p><p>NOTE: always return 0, and not any other value, this can make your game get very strange if done otherwise.</p><p></p><p>This is where 'handle varibles' begin.</p><p>If you can convert any 'handle' into a integer. You can store any handle into a cache and reload it.</p><p>Without the return bug, JASS would be limited to the few BJ's and custom made function that are here today.</p><p>Really, it shouldent be called the return bug, more like the return blessing</p><p>To make things easier to understand handles and parameters, iv took this list out of common.j and made it easier to understand.</p><p></p><p>type: event.....Varible Type: handle </p><p>type: player.....Varible Type: handle </p><p>type: widget.....Varible Type: handle </p><p>type: unit.....Varible Type: widget </p><p>type: destructable.....Varible Type: widget</p><p>type: item.....Varible Type: widget</p><p>type: ability.....Varible Type: handle</p><p>type: buff.....Varible Type: ability</p><p>type: force.....Varible Type: handle</p><p>type: group.....Varible Type: handle</p><p>type: trigger.....Varible Type: handle</p><p>type: triggercondition.....Varible Type: handle</p><p>type: triggeraction.....Varible Type: handle</p><p>type: timer.....Varible Type: handle</p><p>type: location.....Varible Type: handle</p><p>type: region.....Varible Type: handle</p><p>type: rect.....Varible Type: handle</p><p>type: boolexpr.....Varible Type: handle</p><p>type: sound.....Varible Type: handle</p><p>type: conditionfunc.....Varible Type: boolexpr</p><p>type: filterfunc.....Varible Type: boolexpr</p><p>type: unitpool.....Varible Type: handle</p><p>type: itempool.....Varible Type: handle</p><p>type: race.....Varible Type: handle</p><p>type: alliancetype.....Varible Type: handle</p><p>type: racepreference.....Varible Type: handle</p><p>type: gamestate.....Varible Type: handle</p><p>type: igamestate.....Varible Type: gamestate</p><p>type: fgamestate.....Varible Type: gamestate</p><p>type: playerstate.....Varible Type: handle</p><p>type: playerscore.....Varible Type: handle</p><p>type: playergameresult.....Varible Type: handle</p><p>type: unitstate.....Varible Type: handle</p><p>type: aidifficulty.....Varible Type: handle</p><p></p><p>type: eventid.....Varible Type: handle</p><p>type: gameevent.....Varible Type: eventid</p><p>type: playerevent.....Varible Type: eventid</p><p>type: playerunitevent.....Varible Type: eventid</p><p>type: unitevent.....Varible Type: eventid</p><p>type: limitop.....Varible Type: eventid</p><p>type: widgetevent.....Varible Type: eventid</p><p>type: dialogevent.....Varible Type: eventid</p><p>type: unittype.....Varible Type: handle</p><p></p><p>type: gamespeed.....Varible Type: handle</p><p>type: gamedifficulty.....Varible Type: handle</p><p>type: gametype.....Varible Type: handle</p><p>type: mapflag.....Varible Type: handle</p><p>type: mapvisibility.....Varible Type: handle</p><p>type: mapsetting.....Varible Type: handle</p><p>type: mapdensity.....Varible Type: handle</p><p>type: mapcontrol.....Varible Type: handle</p><p>type: playerslotstate.....Varible Type: handle</p><p>type: volumegroup.....Varible Type: handle</p><p>type: camerafield.....Varible Type: handle</p><p>type: camerasetup.....Varible Type: handle</p><p>type: playercolor.....Varible Type: handle</p><p>type: placement.....Varible Type: handle</p><p>type: startlocprio.....Varible Type: handle</p><p>type: raritycontrol.....Varible Type: handle</p><p>type: blendmode.....Varible Type: handle</p><p>type: texmapflags.....Varible Type: handle</p><p>type: effect.....Varible Type: handle</p><p>type: effecttype.....Varible Type: handle</p><p>type: weathereffect.....Varible Type: handle</p><p>type: terraindeformation.....Varible Type: handle</p><p>type: fogstate.....Varible Type: handle</p><p>type: fogmodifier.....Varible Type: handle</p><p>type: dialog.....Varible Type: handle</p><p>type: button.....Varible Type: handle</p><p>type: quest.....Varible Type: handle</p><p>type: questitem.....Varible Type: handle</p><p>type: defeatcondition.....Varible Type: handle</p><p>type: timerdialog.....Varible Type: handle</p><p>type: leaderboard.....Varible Type: handle</p><p>type: multiboard.....Varible Type: handle</p><p>type: multiboarditem.....Varible Type: handle</p><p>type: trackable.....Varible Type: handle</p><p>type: gamecache.....Varible Type: handle</p><p>type: version.....Varible Type: handle</p><p>type: itemtype.....Varible Type: handle</p><p>type: texttag.....Varible Type: handle</p><p>type: attacktype.....Varible Type: handle</p><p>type: damagetype.....Varible Type: handle</p><p>type: weapontype.....Varible Type: handle</p><p>type: soundtype.....Varible Type: handle</p><p>type: lightning.....Varible Type: handle</p><p>type: pathingtype.....Varible Type: handle</p><p>type: image.....Varible Type: handle</p><p>type: ubersplat.....Varible Type: handle</p><p></p><p>Ok, that raps things up, thats the basics about the, the god, 'return bug'</p></blockquote><p></p>
[QUOTE="Mad-Ness, post: 116808, member: 5867"] Ok, so im going to explain the return bug. The return bug in JASS is were you can return a varible different to the varible type to what it says it will return. Classis example: function H2I takes handle h returns integer return h return 0 endfunction Here, it actually returns 'h', which is not the a integer. 'h' Is a handle, a handle is a unit, player, unit group, timer, dialog, or anything else that is NOT a integer, string, real or boolean. The parser that checks if the script is ok, only checks if the last return type is correct. So you can return practiaclly anything. example: function Unit2Integer takes unit u return integer return u return 0 endfunction NOTE: always return 0, and not any other value, this can make your game get very strange if done otherwise. This is where 'handle varibles' begin. If you can convert any 'handle' into a integer. You can store any handle into a cache and reload it. Without the return bug, JASS would be limited to the few BJ's and custom made function that are here today. Really, it shouldent be called the return bug, more like the return blessing To make things easier to understand handles and parameters, iv took this list out of common.j and made it easier to understand. type: event.....Varible Type: handle type: player.....Varible Type: handle type: widget.....Varible Type: handle type: unit.....Varible Type: widget type: destructable.....Varible Type: widget type: item.....Varible Type: widget type: ability.....Varible Type: handle type: buff.....Varible Type: ability type: force.....Varible Type: handle type: group.....Varible Type: handle type: trigger.....Varible Type: handle type: triggercondition.....Varible Type: handle type: triggeraction.....Varible Type: handle type: timer.....Varible Type: handle type: location.....Varible Type: handle type: region.....Varible Type: handle type: rect.....Varible Type: handle type: boolexpr.....Varible Type: handle type: sound.....Varible Type: handle type: conditionfunc.....Varible Type: boolexpr type: filterfunc.....Varible Type: boolexpr type: unitpool.....Varible Type: handle type: itempool.....Varible Type: handle type: race.....Varible Type: handle type: alliancetype.....Varible Type: handle type: racepreference.....Varible Type: handle type: gamestate.....Varible Type: handle type: igamestate.....Varible Type: gamestate type: fgamestate.....Varible Type: gamestate type: playerstate.....Varible Type: handle type: playerscore.....Varible Type: handle type: playergameresult.....Varible Type: handle type: unitstate.....Varible Type: handle type: aidifficulty.....Varible Type: handle type: eventid.....Varible Type: handle type: gameevent.....Varible Type: eventid type: playerevent.....Varible Type: eventid type: playerunitevent.....Varible Type: eventid type: unitevent.....Varible Type: eventid type: limitop.....Varible Type: eventid type: widgetevent.....Varible Type: eventid type: dialogevent.....Varible Type: eventid type: unittype.....Varible Type: handle type: gamespeed.....Varible Type: handle type: gamedifficulty.....Varible Type: handle type: gametype.....Varible Type: handle type: mapflag.....Varible Type: handle type: mapvisibility.....Varible Type: handle type: mapsetting.....Varible Type: handle type: mapdensity.....Varible Type: handle type: mapcontrol.....Varible Type: handle type: playerslotstate.....Varible Type: handle type: volumegroup.....Varible Type: handle type: camerafield.....Varible Type: handle type: camerasetup.....Varible Type: handle type: playercolor.....Varible Type: handle type: placement.....Varible Type: handle type: startlocprio.....Varible Type: handle type: raritycontrol.....Varible Type: handle type: blendmode.....Varible Type: handle type: texmapflags.....Varible Type: handle type: effect.....Varible Type: handle type: effecttype.....Varible Type: handle type: weathereffect.....Varible Type: handle type: terraindeformation.....Varible Type: handle type: fogstate.....Varible Type: handle type: fogmodifier.....Varible Type: handle type: dialog.....Varible Type: handle type: button.....Varible Type: handle type: quest.....Varible Type: handle type: questitem.....Varible Type: handle type: defeatcondition.....Varible Type: handle type: timerdialog.....Varible Type: handle type: leaderboard.....Varible Type: handle type: multiboard.....Varible Type: handle type: multiboarditem.....Varible Type: handle type: trackable.....Varible Type: handle type: gamecache.....Varible Type: handle type: version.....Varible Type: handle type: itemtype.....Varible Type: handle type: texttag.....Varible Type: handle type: attacktype.....Varible Type: handle type: damagetype.....Varible Type: handle type: weapontype.....Varible Type: handle type: soundtype.....Varible Type: handle type: lightning.....Varible Type: handle type: pathingtype.....Varible Type: handle type: image.....Varible Type: handle type: ubersplat.....Varible Type: handle Ok, that raps things up, thats the basics about the, the god, 'return bug' [/QUOTE]
Verification
Post reply
Other Gaming Forum
PC games
WarCraft III Modding
Return Bug
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top