buildingproductionrun event wont pass vars threw customevent
buildingproductionrun event wont pass vars threw customevent
Software:Universal Client
Version Number:
________________________________________________________________________
Location
________________________________________________________________________
Description:
If you access a building and it triggers a custom event, building vars still work properly for the building. However if you have buildingproductionrun events activate a custom event, buildingvars will not work.
The sad result of this is that instead of one 5000 line file for zorics building production, I need 18 identical files and any changes made are a real pain
________________________________________________________________________
Steps to Replicate:
Version Number:
________________________________________________________________________
Location
________________________________________________________________________
Description:
If you access a building and it triggers a custom event, building vars still work properly for the building. However if you have buildingproductionrun events activate a custom event, buildingvars will not work.
The sad result of this is that instead of one 5000 line file for zorics building production, I need 18 identical files and any changes made are a real pain
________________________________________________________________________
Steps to Replicate:
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am
Customevents still exist?
functions are the future.
functions are the future.
Code: Select all
event("&command","functionsFTW")
{
$thisVar = 2
$thatVar = 13
$what = the total($thisvar,$thatvar)
*say The answer is $wat
}
function($thisvar,$thatvar)
{
$theAnswer = $thisvar + $thatvar
return ($theanswer)
}
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am
nevermind i totally blew that one XD
Code: Select all
event("&command","functionsFTW")
{
$thisVar = 2
$thatVar = 13
$what = TheTotal($thisvar,$thatvar)
*say The answer is $wat
}
function TheTotal($thisvar,$thatvar)
{
$theAnswer = $thisvar + $thatvar
return ($theanswer)
}
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am
Code: Select all
event("&command","functionsFTW")
{
$thisVar = 2
$thatVar = 13
$what = TheTotall($thisVar,$thatVar)
*say The answer is $what
}
function TheTotal($thisvar,$thatvar)
{
$theAnswer = $thisvar + $thatvar
return ($theAnswer)
}
=)
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am
not really. lol
Can you provide an example that basically follows this? or yields the same output?
buildingvar x is #
make sure buildingvar y (up to 7 different ones, varied depending on what var x is) is over #
then increase building var z by #, decrease (upto 7) buildinvar y by #
otherwise set buildingvar q to #
if buildingvar g is under # and buildingvar b > 0, random chance of setting buildingvar q to #
if builgingvar z goes over buildingvar s set buildingvar q to #
if builgingvar z goes over buildingvar m set buildingvar q to #
unless buildingvar b = 2, then set buildingvar q to a different # and recheck next prod to possibly change q back to 0
all of the above replicated for up to 5 different vars, and for 150+ items
the question might be, would it more more worthwhile size-wise to do it with functions vs a single event?
hmm...might be easier to post one of the production scripts to see if it can be made into a function.
Can you provide an example that basically follows this? or yields the same output?
buildingvar x is #
make sure buildingvar y (up to 7 different ones, varied depending on what var x is) is over #
then increase building var z by #, decrease (upto 7) buildinvar y by #
otherwise set buildingvar q to #
if buildingvar g is under # and buildingvar b > 0, random chance of setting buildingvar q to #
if builgingvar z goes over buildingvar s set buildingvar q to #
if builgingvar z goes over buildingvar m set buildingvar q to #
unless buildingvar b = 2, then set buildingvar q to a different # and recheck next prod to possibly change q back to 0
all of the above replicated for up to 5 different vars, and for 150+ items
the question might be, would it more more worthwhile size-wise to do it with functions vs a single event?
hmm...might be easier to post one of the production scripts to see if it can be made into a function.
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am
indeed, functions ftw If nothing else, there's no problem losing state with functions (and they're dealt with more efficiently by the server).
Anyway, I've had a quick look at the custom event code and can't see anything that explains the different behaviour in BuildingProductionRun. Are/were you using *event or the CustomEvent function?
Anyway, I've had a quick look at the custom event code and can't see anything that explains the different behaviour in BuildingProductionRun. Are/were you using *event or the CustomEvent function?
Code: Select all
Event("BuildingProductionRun", "69")
{
$gBuidlingVar1=123
*say $gBuidlingVar1
CustomEvent("testvar")
}
Event ("custom","testvar")
{
*say $gBuidlingVar1
}
123
0