(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Tutorials > Tutorial Submission

Tutorial Submission Do you wish to submit a tutorial? README before posting!
Submissions are accepted in this forum.

Reply
 
LinkBack Thread Tools Display Modes
Old 08-28-2008, 03:36 AM   #1 (permalink)
 
hawk900's Avatar

Holiday Avatar
 
Join Date: May 2007
Posts: 1,817

hawk900 has a spectacular aura about (141)hawk900 has a spectacular aura about (141)hawk900 has a spectacular aura about (141)hawk900 has a spectacular aura about (141)


A Collection of GUI Systems > Basic to Advanced (Incomplete)

Is a collection of GUI, systems that I have refined throughout my GUI career. I'm now moving on to JASS, and thought that I would share some of this knowledge. I plan to have a large collection of systems. I realize that a few of these may already be done, but I believe that mine are improvements/refinements in some cases.

If there is a specific topic you are interested in having covered, please just tell me and I'll do my best.

Completed Systems:

* Setting Integers Through Chat (Completed)


In Development:

* Victory Conditions 101


Setting Integers Through Chat

Setting Integers Through Chat

This tutorial teaches and explains how to construct a system, that when the player types a chat string, followed by a collection of numbers, a variable is set to the value of the entered numbers. I'll explain how to add a cap to the maximum as well. This tutorial is very simple but goes into a lot of detail. Remember to add a space after "-number "

Variables

  • YourInteger
  • And Later: YourInteger[]


Poorly Done Version

Trigger
Events
Player - Player 1 (Red) types a chat message containing -number as A substring
Conditions
Actions
Set YourInteger = (Integer((Substring((Entered chat string), 9, 12))))
Game - Display to (Player group((Triggering player))) the text: (YourInteger now = + (String(YourInteger)))

De-Construction

Is a simple way of doing it. Now, I'll de-construct it, explain and improve.

Player - Player 1 (Red) types a chat message containing -number as A substring

Is rather simple really. If the player (1 red in this case) types a chat message, containing the string "-number " then the event will trigger. This is not foolproof, so don't go rushing off yet.

Set YourInteger = (Integer((Substring((Entered chat string), 9, 12))))

Sets YourInteger (a integer variable) to the substring of the entered chat string. In this case it picks all of the characters, in between, 9 and 12 of your message, and converts them to an integer. If there are non-integer characters in this area (ie: a or b) it will ignore them.

(Game - Display to (Player group((Triggering player))) the text: (YourInteger now = + (String(YourInteger)))

Just, displays a message so that you know you got it right.


Getting Better!

There are however some issues with this message. What I will revise it to will look like this:

Trigger
Events
Player - Player 1 (Red) types a chat message containing -number as A substring
Player - Player 2 (Blue) types a chat message containing -number as A substring
Player - Player 3 (Teal) types a chat message containing -number as A substring
Player - Player 4 (Purple) types a chat message containing -number as A substring
Player - Player 5 (Yellow) types a chat message containing -number as A substring
Player - Player 6 (Orange) types a chat message containing -number as A substring
Player - Player 7 (Green) types a chat message containing -number as A substring
Player - Player 8 (Pink) types a chat message containing -number as A substring
Player - Player 9 (Gray) types a chat message containing -number as A substring
Player - Player 10 (Light Blue) types a chat message containing -number as A substring
Player - Player 11 (Dark Green) types a chat message containing -number as A substring
Player - Player 12 (Brown) types a chat message containing -number as A substring
Conditions
(Substring((Entered chat string), 1, 8)) Equal to -number
Actions
Set YourInteger[(Player number of (Triggering player))] = (Integer((Substring((Entered chat string), 9, 12))))
Game - Display to (Player group((Triggering player))) the text: ((|c00FFFF00 + (String(YourInteger[(Player number of (Triggering player))]))) + |r)

Before you try to do this the first thing you need to go is to go to your variables (ctrl-D). Click on the array box and set "Size = # of players in your map"

De-Construction

Now, I'll break it down again.

Events
Player - Player 1 (Red) types a chat message containing -number as A substring
Player - Player 2 (Blue) types a chat message containing -number as A substring
Player - Player 3 (Teal) types a chat message containing -number as A substring
Player - Player 4 (Purple) types a chat message containing -number as A substring
Player - Player 5 (Yellow) types a chat message containing -number as A substring
Player - Player 6 (Orange) types a chat message containing -number as A substring
Player - Player 7 (Green) types a chat message containing -number as A substring
Player - Player 8 (Pink) types a chat message containing -number as A substring
Player - Player 9 (Gray) types a chat message containing -number as A substring
Player - Player 10 (Light Blue) types a chat message containing -number as A substring
Player - Player 11 (Dark Green) types a chat message containing -number as A substring
Player - Player 12 (Brown) types a chat message containing -number as A substring

Just checks for all of the players exactly what it did for Player One in the first trigger. Remember to add a space after the "-number"

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring((Entered chat string), 1, 8)) Equal to -number

This checks if the substring 1-8 ("-number ") actually says "-number ". This prevents players typing things like "10 -number ".

Then - Actions
Set YourInteger[(Player number of (Triggering player))] = (Integer((Substring((Entered chat string), 9, 12))))

And, now we get to the actions. This does the same thing as, before but with an array added. This means that they're are actually 12 different variables (One for each player). This means that each player can set their own YourInteger.

Game - Display to (Player group((Triggering player))) the text: ((|c00FFFF00 + (String(YourInteger[(Player number of (Triggering player))]))) + |r)

And, now we display the message. This time with pretty colour. use concatenate strings, and the colour codes on either side of the variable string.

Adding a Ceiling

Now, one last thing:

Adding a ceiling.

Trigger
Events
Player - Player 1 (Red) types a chat message containing -number as A substring
Player - Player 2 (Blue) types a chat message containing -number as A substring
Player - Player 3 (Teal) types a chat message containing -number as A substring
Player - Player 4 (Purple) types a chat message containing -number as A substring
Player - Player 5 (Yellow) types a chat message containing -number as A substring
Player - Player 6 (Orange) types a chat message containing -number as A substring
Player - Player 7 (Green) types a chat message containing -number as A substring
Player - Player 8 (Pink) types a chat message containing -number as A substring
Player - Player 9 (Gray) types a chat message containing -number as A substring
Player - Player 10 (Light Blue) types a chat message containing -number as A substring
Player - Player 11 (Dark Green) types a chat message containing -number as A substring
Player - Player 12 (Brown) types a chat message containing -number as A substring
Conditions
(Substring((Entered chat string), 1, 8)) Equal to -number
Actions
Set YourInteger[(Player number of (Triggering player))] = (Integer((Substring((Entered chat string), 8, 99))))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
YourInteger[(Player number of (Triggering player))] Greater than or equal to 500
Then - Actions
Set YourInteger[(Player number of (Triggering player))] = 500
Game - Display to (Player group((Triggering player))) the text: ((|c00FFFF00 + (String(YourInteger[(Player number of (Triggering player))]))) + |r)
Else - Actions
Set YourInteger[(Player number of (Triggering player))] = (Integer((Substring((Entered chat string), 9, 12))))
Game - Display to (Player group((Triggering player))) the text: ((|c00FFFF00 + (String(YourInteger[(Player number of (Triggering player))]))) + |r)

De-Construction

Lets take a more detailed look.

If - Conditions
YourInteger[(Player number of (Triggering player))] Greater than to 5000
Then - Actions
Set YourInteger[(Player number of (Triggering player))] = 5000

Simply, if <YouInteger>[Trigger Player Number] is larger than 5000, it resets it to 5000.

With the addition of a simple if/then/else the ceiling (maximum value) is added. If you want it so that it has no effect, then just leave the area blank. Instead of re-setting the variable.


Additional Notes

You could replace the integer with a real if you wanted, just change the variable type and all of the conversions.

This wraps up my tutorial here. I hope that you enjoyed it, and that you find it useful. If you think that I need to improve something, or have found a bug, then please contact me.

Thanks to PurplePoot for pointing out a further refinement.

Changelog



~Updated Demo Map. Now has add gold, and spawn.
~Changed if/then/else to condition
~Fixed Error with order of ceiling in demo



~hawk900

Attached Files
File Type: w3x SettingIntegersThroughChat.w3x (16.8 KB, 7 views)

Last edited by hawk900; 08-29-2008 at 05:46 AM.
hawk900 is offline   Reply With Quote
Old 08-29-2008, 06:36 AM   #2 (permalink)
 
James7's Avatar

Turn off your mind relax
 
Join Date: Dec 2005
Posts: 411

James7 has little to show at this moment (26)James7 has little to show at this moment (26)James7 has little to show at this moment (26)


I request a Alliance system that utilized Dialogs to inform someone that someone wishes to be thier ally.

Example:

Player 1: -ally blue

*displays dialog to player blue saying: Player 1 would like to ally you, do you accept?*

Answers: Yes or No

But if you unally it just unallies both people no dialogs involved.
__________________
(this post brought to you by toast, mmmm bread that goes into a toaster)

Click my banner or message me for info on Clan LSI and joining.
James7 is offline   Reply With Quote
Old 08-29-2008, 04:24 PM   #3 (permalink)
 
hawk900's Avatar

Holiday Avatar
 
Join Date: May 2007
Posts: 1,817

hawk900 has a spectacular aura about (141)hawk900 has a spectacular aura about (141)hawk900 has a spectacular aura about (141)hawk900 has a spectacular aura about (141)


Ahha!

A good idea.

The questions is: should it be blue, or just 2. I can do blue.
__________________
www.RawrCraft.net - The latest and greatest
hawk900 is offline   Reply With Quote
Old 08-29-2008, 05:18 PM   #4 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,908

PurplePoot is a name known to all (737)PurplePoot is a name known to all (737)PurplePoot is a name known to all (737)PurplePoot is a name known to all (737)PurplePoot is a name known to all (737)

Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

You could always do both.

--check for colours
--if fails, check for playernames?
--if fails, check for numbers
PurplePoot is offline   Reply With Quote
Old 08-29-2008, 07:17 PM   #5 (permalink)
 
hawk900's Avatar

Holiday Avatar
 
Join Date: May 2007
Posts: 1,817

hawk900 has a spectacular aura about (141)hawk900 has a spectacular aura about (141)hawk900 has a spectacular aura about (141)hawk900 has a spectacular aura about (141)


Quote:
You could always do both.

--check for colours
--if fails, check for playernames?
--if fails, check for numbers
Good Idea. I'll get on that I guess. The colour is going to be a little bit annoying, but no big deal.
__________________
www.RawrCraft.net - The latest and greatest
hawk900 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
GUI - Hero Click-Selection (Advanced) Fulla Trigger (GUI) Editor Tutorials 38 07-23-2008 02:04 PM
Advanced GUI Editor Thunderbuff246 Requests 5 05-26-2008 05:56 PM
RPG Systems Pack !!! (GUI) Diehard@Azeroth Triggers & Scripts 3 10-18-2007 02:46 PM
Basic Graphics - GUI - Static Shapes Daelin "Graveyard" 1 03-12-2007 02:48 AM
Advanced Gui Help Modeler Map Development 0 10-12-2005 08:17 AM

All times are GMT. The time now is 05:52 PM.






Your link here 
Online advertising | Cycling Training Logs | Mortgages | Debt Consolidation | Power Rangers
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle