wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Closed Thread
 
Thread Tools Search this Thread
Old 07-28-2003, 05:02 PM   #1
dataangel
User


Respected User
 
Join Date: May 2002
Posts: 1,239

Submissions (1)

dataangel will become famous soon enough (42)dataangel will become famous soon enough (42)

Approved Map: Battledome ]|[

Default

I'm basically looking to compile a bunch of new functions that people can include in their maps by copying and pasting them into the top of the .j file (in the trigger editor click the filename of your map -- it's at the very top of the categories -- to see where to do this).

What this thread is basically for is for people to debug the functions I've completed already, and to contribute their own functions. The only requirement is that no globals must be used -- these must be self contained functions.

Without further adu, here's the code so far:


MEH -- code shows up too crappily in window, look to next post for attachment.
dataangel is offline  
Sponsored Links - Login to hide this ad!
Old 07-30-2003, 05:25 PM   #2
dataangel
User


Respected User
 
Join Date: May 2002
Posts: 1,239

Submissions (1)

dataangel will become famous soon enough (42)dataangel will become famous soon enough (42)

Approved Map: Battledome ]|[

Default

Updated: Added the functions I didn't understand, and the rest of AIAndy's functions (whoops)
dataangel is offline  
Old 07-30-2003, 07:53 PM   #3
Aiursrage2k
User
 
Join Date: Sep 2002
Posts: 263

Aiursrage2k has little to show at this moment (0)

Default

I put them in a text file as well, because it was stretching the form. Added three functions rewrote two of the other ones.
Aiursrage2k is offline  
Old 07-31-2003, 12:41 AM   #4
Scio
User
 
Join Date: Jul 2002
Posts: 483

Scio has little to show at this moment (0)

Default

data you're not keeping me updated about changes :////
Scio is offline  
Old 07-31-2003, 07:49 AM   #5
Jatz
User
 
Join Date: Jul 2003
Posts: 41

Jatz has little to show at this moment (0)

Default

I'm just curious as to how you'd use one of these functions? Let's say I wanted to store the result of factorial(2) in a variable called temp.

I'd create a variable called temp of type integer.

and I'd probably run the Action: Custom Script: 'call factorial(2)'....right?

But how can I use the value the function returns?
Jatz is offline  
Old 07-31-2003, 09:08 AM   #6
AIAndy
User


Respected User
 
Join Date: Oct 2002
Posts: 1,296

AIAndy is on a distinguished road (21)

Default

@Jatz: If you created that variable in GUI, then use this:
Custom Script: 'set udg_temp = factorial(2)'

I'd like to contribute some functions to that pack, attached them as a text file.
An exp function for integers, an encode and a decode function for using integers as arrays of boolean and a function to sync any integers (for example to retrieve camera information).
AIAndy is offline  
Old 07-31-2003, 02:37 PM   #7
Peppar
User


Respected User
 
Join Date: Oct 2002
Posts: 113

Peppar has little to show at this moment (0)

Default

Felt like contributing with a bunch of string functions. I have
tested them to a certain degree but they aren't foolproof.
Includes some other functions of varying quality.

GetSubString, PositionCameraIfInRangeForPlayer, ByteToHex,
ColorToString, ToLower, ToUpper, InsertHotkey,
InsertHotkeyColor.

EDIT: Made some more string functions and some fluff functions
to make the life of a programmer easier.

LeftTrim, RightTrim, Trim, LeftString, RightString, MidString,
MidStringLength.

EDIT: Last upload is on page 2
Peppar is offline  
Old 08-02-2003, 06:35 AM   #8
dataangel
User


Respected User
 
Join Date: May 2002
Posts: 1,239

Submissions (1)

dataangel will become famous soon enough (42)dataangel will become famous soon enough (42)

Approved Map: Battledome ]|[

Default

whoa, sudden function influx! I'll get straight to adding these =)
dataangel is offline  
Old 08-02-2003, 06:52 AM   #9
dataangel
User


Respected User
 
Join Date: May 2002
Posts: 1,239

Submissions (1)

dataangel will become famous soon enough (42)dataangel will become famous soon enough (42)

Approved Map: Battledome ]|[

Default

Quote:
Originally posted by AIAndy
@Jatz: If you created that variable in GUI, then use this:
Custom Script: 'set udg_temp = factorial(2)'

I'd like to contribute some functions to that pack, attached them as a text file.
An exp function for integers, an encode and a decode function for using integers as arrays of boolean and a function to sync any integers (for example to retrieve camera information).


Whoa, sync integer is much cleaner than what I was using -- although I'm having trouble digesting parts.

The part where you set source_int[0] to 0 or 1, I get that you're just signing the integer so it's negative or positive. What I don't understand is how the operation for converting the rest of it works:

Code:
  loop
    exitwhen i >= bits_number
    set source_int[i] = ModuloInteger(sum, 2)
    set sum = sum / 2
    set i = i + 1
  endloop

You store whether or not the number is odd or even, then you halve it -- why?

Also -- why doesn't it use the encode/decode functions you just defined?
dataangel is offline  
Old 08-02-2003, 07:07 AM   #10
dataangel
User


Respected User
 
Join Date: May 2002
Posts: 1,239

Submissions (1)

dataangel will become famous soon enough (42)dataangel will become famous soon enough (42)

Approved Map: Battledome ]|[

Default

Quote:
Originally posted by Peppar
Felt like contributing with a bunch of string functions. I have
tested them to a certain degree but they aren't foolproof.
Includes some other functions of varying quality.

GetSubString, PositionCameraIfInRangeForPlayer, ByteToHex,
ColorToString, ToLower, ToUpper, InsertHotkey,
InsertHotkeyColor.

EDIT: Made some more string functions and some fluff functions
to make the life of a programmer easier.

LeftTrim, RightTrim, Trim, LeftString, RightString, MidString,
MidStringLength.


It maybe that it's 1AM, but I'm having the damndest time trying to figure out what your GetSubString function does. Could you explain?

I also feel very stupid at this moment for not realizing that "exitwhen true" could be used for a break;

:P

EDIT: I've added most of your functions, except GetSubString (need clarification so I can add a comment(s)), and the MidString, functions, because I don't really see what their usefulness is in wake of the SubString function. Feel free to enlighten me though =)
dataangel is offline  
Old 08-02-2003, 07:12 AM   #11
Panto
LASER DRAGONS IS RELEASED
 
Panto's Avatar


Development Moderator
User Project: Panto
 
Join Date: Mar 2003
Posts: 3,167

Submissions (2)

Panto is a jewel in the rough (247)Panto is a jewel in the rough (247)Panto is a jewel in the rough (247)Panto is a jewel in the rough (247)Panto is a jewel in the rough (247)

Approved Map: Call to Arms

Default

Greets. Thought I'd make a recommendation.
I was confounded that they don't have a "Player Group is Empty" condition, like the "Unit Group is Empty" one. Is that something that someone could create?
__________________
Pantokrator Maps forum.
LASER DRAGONS RELEASED!.
"One good test is worth a thousand expert opinions." Wernher von Braun
"The perfect is the enemy of the good." Voltaire
"When I became a man I put away childish things, including the fear of childishness and the desire to be very grown up." C.S. Lewis
Panto is offline  
Old 08-02-2003, 07:16 AM   #12
dataangel
User


Respected User
 
Join Date: May 2002
Posts: 1,239

Submissions (1)

dataangel will become famous soon enough (42)dataangel will become famous soon enough (42)

Approved Map: Battledome ]|[

Default

Quote:
Originally posted by Panto
Greets. Thought I'd make a recommendation.
I was confounded that they don't have a "Player Group is Empty" condition, like the "Unit Group is Empty" one. Is that something that someone could create?


Yes, infact, that'd be ridiculously easy, I'll add it. :)

if numplayers in playergroup == 0, return true
dataangel is offline  
Old 08-02-2003, 07:28 AM   #13
dataangel
User


Respected User
 
Join Date: May 2002
Posts: 1,239

Submissions (1)

dataangel will become famous soon enough (42)dataangel will become famous soon enough (42)

Approved Map: Battledome ]|[

Default

Quote:
Originally posted by Aiursrage2k
I put them in a text file as well, because it was stretching the form. Added three functions rewrote two of the other ones.


Could you explain what the function ibox2 does?

Also, I recoded charIsNumber to be even simpler:

Code:
function CharIsNumber takes string whichChar returns boolean
    local integer i = 0

    loop
        exitwhen i >= 10
        if whichChar == I2S(i) then
            return true
        endif 
        set i = i + 1
    endloop

    return false
endfunction

BTW, what's the philosophy/reasoning behind a function only having one return statement? Performance wise it's negligible, especially if you have to declare a local var in order to keep it at 1.
dataangel is offline  
Old 08-02-2003, 07:42 AM   #14
Panto
LASER DRAGONS IS RELEASED
 
Panto's Avatar


Development Moderator
User Project: Panto
 
Join Date: Mar 2003
Posts: 3,167

Submissions (2)

Panto is a jewel in the rough (247)Panto is a jewel in the rough (247)Panto is a jewel in the rough (247)Panto is a jewel in the rough (247)Panto is a jewel in the rough (247)

Approved Map: Call to Arms

Default

Quote:
if numplayers in playergroup == 0, return true
I'm trying to put this together tonight. What's the format for taking a Player Group?
__________________
Pantokrator Maps forum.
LASER DRAGONS RELEASED!.
"One good test is worth a thousand expert opinions." Wernher von Braun
"The perfect is the enemy of the good." Voltaire
"When I became a man I put away childish things, including the fear of childishness and the desire to be very grown up." C.S. Lewis
Panto is offline  
Old 08-02-2003, 08:13 AM   #15
dataangel
User


Respected User
 
Join Date: May 2002
Posts: 1,239

Submissions (1)

dataangel will become famous soon enough (42)dataangel will become famous soon enough (42)

Approved Map: Battledome ]|[

Default

Quote:
Originally posted by Panto
I'm trying to put this together tonight. What's the format for taking a Player Group?


Download the pack again, I already added it ;)

But to answer your q: player group's in JASS are of type force
dataangel is offline  
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 04:31 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services