• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Destroy Floating Text Problem

Status
Not open for further replies.
Level 14
Joined
Apr 20, 2009
Messages
1,543
Actually, there is much more to it then just setting a variable to be the last created floating text and then destroying them.
This game needs dynamically created triggers with registered chat events.
(You might also be abled to use 1 trigger with all the chat events. But I don't see why you want to do that instead of having a dynamically created trigger that does it for you.)

@Chaosy
The fact that you are using GetLastCreatedTextTag() which is a BJ is not so good. They should be avoided since BJ's take up execution time.

Also, this is wrong:
JASS:
local texttag variable = GetLastCreatedTextTag()
call DestroyTextTag(variable())

A variable is not a function...
And I also suggest using a different name for readability's sake ;P
(Not trying to piss you off or anything Chaosy, just trying to prevent you from giving bad information)

@bisnar13:
I made the entire thing for you. To see how it works look at the triggers, most of the triggers are in GUI. (It does use quite some Custom script) The rest is in the header script.

To check out the header script simply click on the map icon: Typing Machine.w3x in the top of your trigger list.

You can adjust the speed by changing the Move event, you can adjust the amount of words by changing the Words event, you can change the game timer in the Initialization of Words and in Restart.

I really liked playing it :) My highscore after playing 3 times was 160 with the current settings.

EDIT: tip: the chat events are exact matches so you might want to take away the first uppercase, it's quite annoying to keep using the shift key.
Also, you can always add more words if you like. It's your map anyways...
 

Attachments

  • Typing Master.w3x
    18.4 KB · Views: 34
Last edited:
Level 14
Joined
Apr 20, 2009
Messages
1,543
Well yeah it does indeed work if you created the floating text through GUI, but if you make it in Jass then GetLastCreatedTextTag() might do nothing depending on the coder ofc.

This is because all that GetLastCreatedTextTag() does is return bj_lastCreatedTextTag:

JASS:
function GetLastCreatedTextTag takes nothing returns texttag
    return bj_lastCreatedTextTag
endfunction

In fact you might even want to do this instead (1 less function call):
JASS:
local texttag floatingText = bj_lastCreatedTextTag

Which is set when a text tag is created through GUI (and since locals can only be declared at the top of a function, this might get a bit messy):
  • Floating Text - Create floating text that reads blah? at (Center of (Playable map area)) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
JASS:
function CreateTextTagLocBJ takes string s, location loc, real zOffset, real size, real red, real green, real blue, real transparency returns texttag
    set bj_lastCreatedTextTag = CreateTextTag()
    call SetTextTagTextBJ(bj_lastCreatedTextTag, s, size)
    call SetTextTagPosBJ(bj_lastCreatedTextTag, loc, zOffset)
    call SetTextTagColorBJ(bj_lastCreatedTextTag, red, green, blue, transparency)

    return bj_lastCreatedTextTag
endfunction

In other words, the best way would be:
JASS:
local texttag floatingText = CreateTextTag()

This way floatingText refers directly to the created text tag.
You can then use the non-BJ versions of the SetTextTag functions to do whatever you want with your floating text.
If you want to know how to use the non-BJ version of a function, simply search the BJ in the function list and see what it does.
Then use that code directly instead of calling the BJ.

Try to make sure that there is no red code in your script. (In rare cases it's inevitable though).
But the less you have, the better your scripts are optimized.

EDIT: By the way Bisnar13, sorry for going off-topic. But I saw your resources and saw some models you've created.
Would you perhaps be abled to help me out with 1 tiny model request that doesn't take too long?
http://www.hiveworkshop.com/forums/requests-341/requesting-simple-destructable-226104/
 
Last edited:
Thanks for the help! :D, but what I only really needed was to destroy the text.

btw, those were just sample words, I will of course add more, about a thousand if I can, and about the request, I can't see the picture D:

I tried the vJass/custom script for destroying the text, but it still wouldnt work D: I think I tested the disable permanence/ set lifespan and other stuff, but they dont work

OH LOL, FUUUUUU, IT WORKED ALL ALONG, It was just because of the capital letter. -_- Sorry, I really didn't have a problem. lol
 
Last edited:
Level 14
Joined
Apr 20, 2009
Messages
1,543
I'm glad you liked it.

And yeah, I said that in my previous post ;)

Hashjie said:
EDIT: tip: the chat events are exact matches so you might want to take away the first uppercase, it's quite annoying to keep using the shift key.

Also, this wasn't vJass, but simple regular Jass.


By the way did you test the map I made? I think it should do what you want to achieve...
 
Last edited:
I'm glad you liked it.

And yeah, I said that in my previous post ;)



Also, this wasn't vJass, but simple regular Jass.


By the way did you test the map I made? I think it should do what you want to achieve...
Yeah, thanks again :), btw could I add as many words as I want to your system?

and btw, which trigger there is the one, when you enter a word correct?
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Yeah, thanks again :), btw could I add as many words as I want to your system?

and btw, which trigger there is the one, when you enter a word correct?

Yes, and the trigger to check if a word is correct is done in Jass. It's in the map header. I've explained in my previous post how to access the map header and see the code.

DESTROYER123 said:
Hotdog!
XD

I don't even....
Dogfeces!
 
Status
Not open for further replies.
Top