HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

AI & JASS FAQ

11-03-2003, 12:35 AM#61
-={tWiStÄr}=-
well.. i tryed making it in gui, and then converting it to jass and gave me exactly that (with a few spaces added but i dont think this matters) but just in case i C&Ped into my code then tryed and it gave me an error for my function.. but not the converted GUI function emote_confused and where does it see any (real) anythings
...
new update, wierdest thing ever! so i had it set up like this
set the item to var
set a name to var
item properties
right, so i moved the name line above the item line, thus changing the name line to line 85... the line that the item line used to be on... so now i have no provs on the item line... but the same error on name line emote_confused wtf is this about?
11-04-2003, 09:44 PM#62
-={tWiStÄr}=-
anyone emote_confused
11-05-2003, 04:39 AM#63
AIAndy
I think you should post the code of the rest of that function so we can see if the problem is not there.
11-05-2003, 01:08 PM#64
-={tWiStÄr}=-
[/code]
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
local integer gold = GetPlayerState ( Player(0), PLAYER_STATE_RESOURCE_GOLD )
set udg_board = CreateMultiboard()
call MultiboardSetTitleText ( udg_board, "IT WORKS!" )
call MultiboardSetTitleTextColor ( udg_board, 255, 255, 255, 255 )
call MultiboardSetRowCount ( udg_board, 2 )
call MultiboardSetColumnCount ( udg_board, 3 )
call MultiboardDisplay ( udg_board, true )
set udg_items[1] = MultiboardGetItem ( udg_board, 0, 0 )
call MultiboardSetItemValue ( udg_items[1], "Player" )
call MultiboardSetItemStyle ( udg_items[1], true, false )
call MultiboardSetItemWidth ( udg_items[1], .1 )
set udg_items[2] = MultiboardGetItem ( udg_board, 0, 1)
call MultiboardSetItemIcon ( udg_items[2], "UI\\Widgets\\ToolTips\\Human\\ToolTipGoldIcon.blp" )
call MultiboardSetItemWidth ( udg_items[2], .1 )
set udg_items[3] = MultiboardGetItem ( udg_board, 0, 2 )
call MultiboardSetItemIcon ( udg_items[3], "UI\\Widgets\\ToolTips\\Human\\ToolTipLumberIcon.blp" )
call MultiboardSetItemIcon ( udg_items[3], .1)
set udg_items[4] = MultiboardGetItem(udg_board, 1, 0)
set udg_name = GetPlayerName(Player(0))
call MultiboardSetItemValue ( udg_items[4], udg_name )
call MultiboardSetItemStyle ( udg_items[4], true, false )
call MultiboardSetItemWidth ( udg_items[4], .1 )
set udg_items[5] = MultiboardGetItem ( udg_board, 1,1 )
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent ( gg_trg_Untitled_Trigger_001, Player(0), "board", true )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
[/code]

here ya go... all other trigs are disabled except the mapintilization
11-05-2003, 02:26 PM#65
KaTTaNa
It's this line which doesn't work:
call MultiboardSetItemIcon ( udg_items[3], .1)

It should probably be:
call MultiboardSetItemWidth( udg_items[3], 0.01)

I set width to 0.01 here, since that's probably what you want (just wait and see), but the problem was that you was using the wrong function.
The compiler often complaints about the line just below the one containing the error. (If the line below is blank, it will use the next line with code on it).
11-05-2003, 09:12 PM#66
-={tWiStÄr}=-
THANK YOU!!! and now i have new knowledge to use to my advantage ;) oh and im just making a resource board... so i think .1 works
11-28-2003, 11:33 PM#67
-={tWiStÄr}=-
hehe another one :ggani:
Code:
function StringReverse takes string s returns string
    local integer i = 1
    local string result = ""
    local string t

    loop
        set t = SubString(s, i-1, i)
        exitwhen (t == "") or (t == null)

        set result = t + result
        set i = i + 1
    endloop
    return result
endfunction

function StringReverse_Actions takes string s returns string
    local string s = GetEventPlayerChatString( )
    call StringReverse(s )
    call DisplayTextToPlayer ( Player(0), 0, 0, s )
    return s
endfunction

//===========================================================================
function InitTrig_StringReverse takes nothing returns nothing
    set gg_trg_StringReverse = CreateTrigger(  )
    call TriggerRegisterPlayerEvent( gg_trg_StringReverse, Player(0), EVENT_PLAYER_CHAT )
    call TriggerAddAction( gg_trg_StringReverse, function StringReverse_Actions )
endfunction

Note: first function was written by KaTTaNa and the crappy bottom part was made by me 8))
edit: oh yeah, the prob is when i type something in Warcraft crashes
11-30-2003, 05:13 PM#68
PitzerMike
The Actions-Function of a trigger can never have a return type/statement

So change it from returns string to returns nothing and delete the line
return s
11-30-2003, 05:25 PM#69
-={tWiStÄr}=-
ya, i think i already did that and some other stuff so heres an updated version
Code:
function StringReverse takes string s returns string
    local integer i = 1
    local string result = ""
    local string t

    loop
        set t = SubString(s, (i-1), i)
        exitwhen (t == "") or (t == null)
        set result = t + result
        set i = i + 1
    endloop
    return result
endfunction

function StringReverse_Actions takes nothing returns nothing
    local string a = StringReverse(GetEventPlayerChatString( ))+"a"
    call DisplayTextToPlayer ( Player(0), 10, 10, a)
endfunction

// ==================================================
function InitTrig_StringReverse takes nothing returns nothing
    set gg_trg_StringReverse = CreateTrigger(  )
    call TriggerRegisterPlayerEvent( gg_trg_StringReverse, Player(0), EVENT_PLAYER_CHAT )
    call TriggerAddAction( gg_trg_StringReverse, function StringReverse_Actions )
endfunction
the +"a" at the end of the local string a line is just a test, and it doesnt show up
edit: ok i got it. i think the function EVENT_PLAYER_CHAT is buggy
01-02-2004, 06:13 PM#70
-={tWiStÄr}=-
ME AGAIN :ggani: I know im bad at this :( but im trying :D and i have a big multiboard i was making theres 25 items in it :bgrun: so i tried to make a loop to save time, but its a scary big loop that doesnt seem to work :bgrun: what happens is when i try to play through testing from WE is it goes into warcraft its about to work, and then it just stops and goes normaly into warcraft. I dont get any errorst from Jass Editor or WE. the variables are
Board and Multitem (spelled just like that)
Ill give it to you for jass editor cause its long
Edit:I fixed a little bit i found but still same prob
01-05-2004, 09:45 PM#71
Headfoot
If you ask me JASS looks exactly like VB6 except with a lot of custom modules, call functions, etc etc. Im waaaaaayyyy to lazy to learn any other new languages so Ill stick to my good ol' VB6
02-08-2004, 04:35 PM#72
kane635
You could force UI keys by replacing the string "Cheat Enabled!" with a global variable, and removing the comparison to see how many humans are playing, couldnt you?
02-25-2004, 01:01 AM#73
-={tWiStÄr}=-
I got another :) im making a trigger for it to spawn 20 random units, but it can only be 3 units, so heres the trigger
Code:
function Trolls_spawn_Actions takes nothing returns nothing
// local variable
    local integer n

// conditions for units in region matching    
function Trolls_spawn_conditions0001 takes nothing returns boolean
    return ( IsUnitType( GetFilterUnit(), 'nftr') == true )
endfunction    
function Trolls_spawn_conditions0001 takes nothing returns boolean
    return ( IsUnitType( GetFilterUnit(), 'nftb') == true )
endfunction 
   
// main chunk for Troll Spawn 3       
    call CreateNUnitsAtLoc ( GetRandomInt(0, 20), 'nftr', PLAYER_NEUTRAL_AGGRESSIVE, GetRandomLocInRect(gg_rct_Troll_Quest_Spawn_3), bj_UNIT_FACING)         
    set n = (20 - CountUnitsInGroup (GetUnitsInRectMatching(gg_rct_Troll_Quest_Spawn_3, Condition(function Trolls_spawn_conditions0001 ))))
    call CreateNunitsAtLoc ( GetRandomInt(0, n), 'nftb', PLAYER_NEUTRAL_AGGRESSIVE, GetRandomLocInRect(gg_rct_Troll_Quest_Spawn_3), bj_UNIT_FACING)     
    set n = (n - CountUnitsInGroup (GetUnitsInRectMatching(gg_rct_Troll_Quest_Spawn_3, Condition(function Trolls_spawn_conditions0002 ))))
    call CreateNunitsAtLoc ( GetRandomInt(0, n), 'nftt', PLAYER_NEUTRAL_AGGRESSIVE, GetRandomLocInRect(gg_rct_Troll_Quest_Spawn_3), bj_UNIT_FACING)
    
// main chunk for Troll Spawn 2       
    call CreateNUnitsAtLoc ( GetRandomInt(0, 15), 'nftr', PLAYER_NEUTRAL_AGGRESSIVE, GetRandomLocInRect(gg_rct_Troll_Quest_Spawn_2), bj_UNIT_FACING)         
    set n = (15 - CountUnitsInGroup (GetUnitsInRectMatching(gg_rct_Troll_Quest_Spawn_3, Condition(function Trolls_spawn_conditions0001 ))))
    call CreateNunitsAtLoc ( GetRandomInt(0, n), 'nftb', PLAYER_NEUTRAL_AGGRESSIVE, GetRandomLocInRect(gg_rct_Troll_Quest_Spawn_2), bj_UNIT_FACING)     
    set n = (n - CountUnitsInGroup (GetUnitsInRectMatching(gg_rct_Troll_Quest_Spawn_3, Condition(function Trolls_spawn_conditions0002 ))))
    call CreateNunitsAtLoc ( GetRandomInt(0, n), 'nftt', PLAYER_NEUTRAL_AGGRESSIVE, GetRandomLocInRect(gg_rct_Troll_Quest_Spawn_2), bj_UNIT_FACING)
    
// main chunk for Troll Spawn 1       
    call CreateNUnitsAtLoc ( GetRandomInt(0, 15), 'nftr', PLAYER_NEUTRAL_AGGRESSIVE, GetRandomLocInRect(gg_rct_Troll_Quest_Spawn_1), bj_UNIT_FACING)         
    set n = (15 - CountUnitsInGroup (GetUnitsInRectMatching(gg_rct_Troll_Quest_Spawn_3, Condition(function Trolls_spawn_conditions0001 ))))
    call CreateNunitsAtLoc ( GetRandomInt(0, n), 'nftb', PLAYER_NEUTRAL_AGGRESSIVE, GetRandomLocInRect(gg_rct_Troll_Quest_Spawn_1), bj_UNIT_FACING)     
    set n = (n - CountUnitsInGroup (GetUnitsInRectMatching(gg_rct_Troll_Quest_Spawn_3, Condition(function Trolls_spawn_conditions0002 ))))
    call CreateNunitsAtLoc ( GetRandomInt(0, n), 'nftt', PLAYER_NEUTRAL_AGGRESSIVE, GetRandomLocInRect(gg_rct_Troll_Quest_Spawn_1), bj_UNIT_FACING)           
endfunction
lol, im sure its MUCH more work than i need to do but, oh well :ggani:
02-27-2004, 09:22 PM#74
-={tWiStÄr}=-
come on, anyone! :nono:
02-27-2004, 10:26 PM#75
PitzerMike
Hm. You actually did not ask a question.
Could you tell us what you want us to do?

Also I'd like to inform you about the fact that a FAQ is not here for asking questions. It's here for listing frequently asked questions and their answeres.

You should create a thread if you'd like to ask something.