| 03-01-2003, 10:43 PM | #31 |
It doesn't make any difference, this is what it looks like now: Code:
function Trig_Converting_Actions takes nothing returns nothing
local integer x
local integer y
set x = GetConvertedPlayerId(udg_TriggeringPlayer)
set y = 0
set udg_Convert[GetConvertedPlayerId(udg_TriggeringPlayer)] = true
loop
exitwhen x > 215
loop
exitwhen y > 79
if ( udg_Password[x] == udg_Converting[y] ) then
set udg_PasswordCon[x] = udg_Converting2[y]
call DisplayTimedTextToPlayer( udg_TriggeringPlayer, 0, 0, 5.00, udg_PasswordCon[x] )
endif
set y = y + 1
endloop
set x = x + 12
set y = 0
endloop
set udg_Convert[GetConvertedPlayerId(udg_TriggeringPlayer)] = false
endfunction
//===========================================================================
function InitTrig_Converting takes nothing returns nothing
set gg_trg_Converting = CreateTrigger( )
call TriggerAddAction( gg_trg_Converting, function Trig_Converting_Actions )
endfunctionBut it doesn't display the text of what it should be. It displays (null) still. *sigh* Am I an idiot or is something not working? EDIT: By the way, only 1 (null) shows up. |
| 03-01-2003, 10:58 PM | #32 |
Guest | well I don't know the purpose of the 79/80 and 216/215 numbers but I suppose it's some sort of password check n convertin or juz some string check. Perhaps u can explain to me?? Sorry but English is not my native language and I don't really get what you mean in you first few posts. But if it's too much of a trouble then its ok :P. One more thing, what do you mean 1 null shows up now? can you give a better description as in which position the null show up or whatever ? Another way to help u find ur bug is to add some debug statements in it where u can turn then on via a flag. Juz add in a few display text statements within the suspect loops and display the values of the variables so you know what happens before, during and after each loop. |
| 03-01-2003, 11:08 PM | #33 |
Guest | Try this...I earmarked the lines I added. Code:
function Trig_Converting_Actions takes nothing returns nothing
local integer x
local integer y
set x = GetConvertedPlayerId(udg_TriggeringPlayer)
set y = 0
set udg_Convert[GetConvertedPlayerId(udg_TriggeringPla
yer)] = true
loop
exitwhen x > 215
loop
exitwhen y > 79
if ( udg_Password[x] == udg_Converting[y] ) then
set udg_PasswordCon[x] = udg_Converting2[y]
call DisplayTimedTextToPlayer( udg_TriggeringPlayer, 0, 0, 5.00, udg_PasswordCon[x] )
set y = 80 // line added by SID6.7
else // line added by SID6.7
set y = y + 1 // line added by SID6.7
endif // line added by SID6.7
endloop
set x = x + 12
set y = 0
endloop
set udg_Convert[GetConvertedPlayerId(udg_TriggeringPla
yer)] = false
endfunction
// ==================================================
=========================
function InitTrig_Converting takes nothing returns nothing
set gg_trg_Converting = CreateTrigger( )
call TriggerAddAction( gg_trg_Converting, function Trig_Converting_Actions )
endfunction |
| 03-02-2003, 06:55 PM | #34 |
Nah Sid, that doesn't work. It just doesn't print anything now, it doesn't lag to see if it is doing anything either. The code makes perfect sence though, I let it sit for about 2 minutes to see if it was computing anything, but didn't even print 1 thing, I checked the log to see if I maybe missed it... nope. Nothing. 1 Question about this though, when it exits after it hits 80, and it gets reset, will it run the inner loop again? It doesn't seem like it is, or it isn't in the first place. |
| 03-02-2003, 09:30 PM | #35 |
Quick question...how are you printing the array? Running a loop and printing each index, or just trying to display the array variable itself? As for the inner loop, it will be run again so long as the outer loop exit condition remains false. So when x = 0, the inner loop runs 80 times, or until a match is found. Then x is incremented by 12, y set back to 0, and the inner loop runs again, and so on. |
| 03-02-2003, 09:32 PM | #36 |
Code:
call DisplayTimedTextToPlayer( udg_TriggeringPlayer, 0, 0, 5.00, udg_PasswordCon[x] ) Would it take a long time to run through Y array values X times? It seems like alot of work, could it just be running slow and it would print after a while? |
| 03-03-2003, 02:20 AM | #37 | |
Guest | Quote:
Shoudn't take long at all coz Ur arrays size are consider small. I suggest u put in some Displaytext to all players within the functions displayin the values of all the variables. So you know what is happening before the loops are started, during the looping and after the looping. A bit tedious but at least u can pinpoint ur bug much faster than just lookin at the code, run it blindly and guess the bug. |
| 03-03-2003, 12:36 PM | #38 |
*sigh* I added it in before the loop and during the loop, but it STILL won't display anything. What is going on? Code:
function Trig_Converting_Actions takes nothing returns nothing
local integer x
local integer y
set x = GetConvertedPlayerId(udg_TriggeringPlayer)
set y = 0
set udg_Convert[GetConvertedPlayerId(udg_TriggeringPlayer)] = true
call DisplayTextToForce( GetPlayersAll(), udg_PasswordCon[x] )
loop
exitwhen x > 215
loop
exitwhen y > 79
if ( udg_Password[x] == udg_Converting[y] ) then
set udg_PasswordCon[x] = udg_Converting2[y]
call DisplayTextToForce( GetPlayersAll(), udg_PasswordCon[x] )
set y = 80 // line added by SID6.7
else // line added by SID6.7
set y = y + 1 // line added by SID6.7
endif // line added by SID6.7
endloop
set x = x + 12
set y = 0
endloop
set udg_Convert[GetConvertedPlayerId(udg_TriggeringPlayer)] = false
endfunction
//===========================================================================
function InitTrig_Converting takes nothing returns nothing
set gg_trg_Converting = CreateTrigger( )
call TriggerAddAction( gg_trg_Converting, function Trig_Converting_Actions )
endfunction |
| 03-03-2003, 02:41 PM | #39 |
Just so that everything is accounted for, add two more calls for displayed text to print out the values of x and y as the loop is run, and make sure they are behaving as expected. I'd add the calls to just before each variable is incremented. |
| 03-03-2003, 04:06 PM | #40 |
Okay things to make sure, that all of your data types are all the same kind (String Array), that they all contain data, and that your trigger is actually being executed. Call a print message at the very beggining of the trigger (after the locals of decleration of course) saying Preforming the password for player S2I(x). If that works it times to look at your arrays, because the code logic is sound, and should work. |
| 03-03-2003, 07:49 PM | #41 |
But it is displaying text at the beginning of the value of the string[x] I'll try just showing the value of X. But that still doesn't make sence why it doesn't print during the inner loop.... |
| 03-03-2003, 07:57 PM | #42 |
I just had a thought. Does each index in udg_Password contain a full blown string? Or did you hash the string into each of the appropriate indexes for the player? In other words, if udg_Password[0] (for player 1) is being set to the password they enetered, that if statement will never match on the individual symbols/letters/numbers in udg_Converting[]. If the password entered was say "jj34a0345", and udg_Password[0] = "jj34a0345" instead of udg_Password[0] = "j", udg_Password[12] = "j", etc... this could be the problem. |
| 03-03-2003, 08:53 PM | #43 |
Is your password like Method 1: Password[0] = "Apple" or Method 2: Password[0] = "A", Password[1]="p", Password[2]="p",Password[3]="l", Password[4]="e" if its the later we have been going at this the entirely wrong way. |
| 03-03-2003, 10:30 PM | #44 |
Using the apple thing, the array value starts at 1 (Player number of triggering player, which is player 1 right now) 1 = Apple 13 = A 25= p 37 = p 49 = l 61 = e It splits them up. |
| 03-04-2003, 12:35 AM | #45 | |
Quote:
Then that is the source of your problem. If you are Player 1 when you test the map, x will end up being set to 0. Remember that arrays start at 0 as the first index, and the same is true for player numbers. Player 1 as an integer is interprated as 0, not 1. Due to the way you are initialiazing your password string array, you are offsetting the initialization by 1 which causes the system not to work. So for player one, the indexes should be... 0 = Apple 12 = A 24 = p 36 = p 48 = l 60 = e This is the reason why you weren't getting data returned, because you were actually initializing your password string array into positions for player 2, and player 1's information remained empty. |
