• 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.

[JASS] JASS Trigger problem (text commands)

Status
Not open for further replies.
Level 9
Joined
Sep 8, 2004
Messages
633
Hey guys! My mapping partner made this code, we can't seem to find what's wrong with it. The purpose is fairly simple; A player can type several commands, -help xxxxx. For instance: -help zones will give information about zones, where -help objectives will give info on how to win the game.

The trigger can be found inside the attached .txt document. If some of you pro-Jassers would be so kind to take a look and point the error, would be great! Thanks in advance.
 

Attachments

  • help system.txt
    9.2 KB · Views: 110
Level 13
Joined
Nov 22, 2006
Messages
1,260
Omg, you're using vJass + locations?? I don't see how that goes together, why don't you use coordinates? Locations == leaks, lagging and a lot of BJs. Anyways, good to see you're using TESH :)

PurplePoot said:
What part isn't working?

Well it's not like it's a huge code or something :p

Anyways:

JASS:
function ShowHelp takes nothing returns nothing
    local player p=GetTriggerPlayer()
    local integer j=200+10*GetAttachedInt(GetTriggeringTrigger(),"whichhelp")
    local integer id=GetPlayerId(p)
    local location loc // = null
    call DisplayTimedTextToPlayer(p,0,0,20,txt[j])
    call DisplayTimedTextToPlayer(p,0,0,20,txt[j+1])
    if j==4 or j==5 or j==7 then
        set loc=building_loc[16+id]
    elseif j==6 or j==10 then
        set loc=building_loc[id]
    elseif j==13 then
        set loc=GetRectCenter(zone[StartZone(p)])
    elseif j==9 then
        set loc=building_loc[32+R2I(id/2)]
    endif
    if loc!=null then
        call PingMinimapEx(GetLocationX(loc),GetLocationY(loc),12.0,0,255,0,true)
        call RemoveLocation(loc)
        set loc=null
    endif
endfunction


I'm not sure if that helps anything. If you don't set a variable to anything, it is not null/0/0.00/false/"". Correct me if I'm wrong Pooty, I hate bolding if I'm wrong :)

Don't you need to nullify those trigger arrays in InitTrig_Help_System? Though I'm not a pro in nullifying arrays.
 
Level 9
Joined
Sep 8, 2004
Messages
633
Well, like I said, my partner - Doomhammer - created this. I can read it, but I don't really see why he used the math you speak of. Perhaps a sidenote that could have been important, systems used for my map; TESH, Vexorians Caster system (+CScache and CSsafety) and the NewGen worldeditor for JASSing convenience.

What isn't working is simple. It takes any random chat command and spouts out the help description for the bunker multiple times, whilst giving an error.
Now, I found that adding Silvenon's "=null" did remove the error (probably something Doomhammer overlooked), the system still isn't working.

Purplepoot, you say it can be done easier lining up the array slots, can you give an example?

Thing is, Doomhammer can't see what he's done wrong, perhaps one of you guys can see where the flaw is.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
In InitTrig_Help_System function it should be exitwhen k==13 because exitwhen k>13 is in this case == exitwhen k==14

Keep in mind that if you start with the int 0, i>x actually means i==x + 1.

The maximum integer Player() function can take is 13.

I'm confused, shouldn't call TriggerRegisterPlayerChatEvent(t[k], Player(i), txt[10*k+j], true ) be call TriggerRegisterPlayerChatEvent(t[k], Player(k), txt[10*k+j], true )?

Otherwise, this would only register that event to first 9 players, not all of them. Though that line is still confusing....maybe Pooty can help with that.

Wtf is this:

exitwhen false???

Crap, gotta go!!! I will finish later, sry

EDIT: Ok I'm back.

"k" doesn't refer to players, it refers to the text message. There are 14 help topics. On a sidenote; only players 1~8 need access to this, the rest is neutral.

Oh..... :)

I still think locations in ShowHelp can be avoided, bu I guess the author knew what he was doing......

Now, I found that adding Silvenon's "=null" did remove the error (probably something Doomhammer overlooked), the system still isn't working.

It isn't working at all? The system looks well-made, I don't see where the problem would be.....The problem may only be in InitTrig_Help_System function (I think).

Just to note: TriggerRegisterChatEvent can be a bitch sometime (meaning it sometimes doesn't work with no reason), but I doubt it has something to do with this case.....
 
Last edited:
Level 9
Joined
Sep 8, 2004
Messages
633
I do not even see why you need jass new gen pack to make this system when normal WE's jass works equally well, this is not some mega advanced spell.
You can't honestly think that this is the only thing the entire map contains. I must admit I can't judge whether or not the NewGen pack is needed here; I didn't create the code. The NewGen pack is used for the entire map and as this is part of my map, you can guess the rest. Now, we don't seem to get any further on this, so we'll keep to ourselves to try and find the problem. Perhaps it has something to do with the numbers, we'll find out. Thanks for the comments and attempts, none the less.
 
Last edited:
Status
Not open for further replies.
Top